[go: up one dir, main page]

0% found this document useful (0 votes)
18 views5 pages

Object Oriented Programme USING C++ Exercise

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views5 pages

Object Oriented Programme USING C++ Exercise

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Object Oriented prOgramme USing c++

Basic Class & Object (1–20)


1. Create a class called Student with name and age.
2. Create a class Car with model and color.
3. Create a class Book with title and author.
4. Write a program to create an object of Teacher.
5. Create a class Person with a function to display details.
6. Write a program to create two objects of Animal.
7. Create a class Mobile with brand and price.
8. Create a class Employee with name, salary, and id.
9. Write a program to input and print details of a student.
10. Create a class Rectangle with length and width.
11. Write a function inside class to calculate area of Rectangle.
12. Create a class Circle with radius and area function.
13. Create a class Square with side and area function.
14. Create a class Laptop with brand and RAM size.
15. Write a program to create multiple Book objects.
16. Create a class Bank Account with account number and balance.
17. Create a class Dog with name and breed.
18. Create a class Pen with color and price.
19. Create a class Player with name and score.
20. Write a program to print all details using a member function.

Constructor & Destructor (21–35)


21. Create a class Car with constructor to set values.
22. Write a program with default constructor in class Student.
23. Create a class Employee with parameterized constructor.
24. Write a program to show constructor and destructor.
25. Create a class Bank Account that initializes balance in constructor.
26. Write a constructor to set radius of a Circle.
27. Create a class Book with constructor that sets title.
28. Create a constructor to initialize Rectangle length and width.
29. Write a program with multiple constructors in Laptop.
30. Create a destructor message in class Person.
31. Create a class Pen with parameterized constructor.
32. Write a constructor for class Mobile to set brand.
33. Create a class Teacher with constructor and destructor.
34. Write a program with constructor overloading in Student.
35. Create a class Player with default constructor.

Encapsulation (36–45)
36. Create a class Bank Account with private balance.
37. Write functions to deposit and withdraw money.
38. Make balance accessible only through functions.
39. Create a class Student with private marks.
40. Write getter and setter for marks.
41. Create a class Employee with private salary.
42. Write function to increase salary.
43. Create a class Car with private speed.
44. Write function to set and get speed.
45. Create a class Rectangle with private data and public functions.

Inheritance (46–65)
46. Create a base class Person and derived class Student.
47. Create a base class Animal and child class Dog.
48. Create a class Teacher derived from Person.
49. Create a class Employee derived from Person.
50. Write a program to show single inheritance.
51. Write a program to show multiple inheritance.
52. Create a class Car and derived class Electric Car.
53. Write a program to show multilevel inheritance.
54. Create a class Shape and derived classes Circle, Rectangle.
55. Write a program to show hierarchical inheritance.
56. Create class Vehicle and derived classes Bike, Car.
57. Write program to inherit data members from base class.
58. Create base class Player and derived class Cricketer.
59. Write program to call base class function in derived class.
60. Create class Parent and derived class Child.
61. Write program to show protected access in inheritance.
62. Create class Bird and derived class Parrot.
63. Write program to show constructor in inheritance.
64. Create class Device and derived class Laptop.
65. Write program with hybrid inheritance example.

Polymorphism (66–80)
66. Create a base class Shape with function area().
67. Override area() in derived class Circle.
68. Override area() in derived class Rectangle.
69. Write program to show function overriding.
70. Write program to show function overloading.
71. Create class Math with overloaded add() functions.
72. Overload operator + in a class.
73. Overload operator - in a class.
74. Overload operator * in a class.
75. Write program with runtime polymorphism.
76. Create a virtual function speak() in class Animal.
77. Override speak() in class Dog.
78. Override speak() in class Cat.
79. Write program to use pointer to base class.
80. Create example with pure virtual function.
Advanced OOP (81–100)
81. Create abstract class Shape.
82. Write program to make interface with pure virtual function.
83. Create class Bank Account with static variable.
84. Write program with static function in class.
85. Create friend function example.
86. Write program with friend class.
87. Create example of copy constructor.
88. Write program with dynamic memory allocation in class.
89. Create class with array of objects.
90. Write program to store 5 students’ data using objects.
91. Create class with pointer to object.
92. Write program with object as function argument.
93. Write program with object as return type.
94. Write program to use this pointer.
95. Create example of method chaining.
96. Write program with namespace in C++.
97. Create template class example.
98. Write program with exception handling in class.
99. Create program with file handling in class.
100.Write a mini project: Library Management System using classes.
100 OOP in C++ Math-Based Questions
Basic Math with Class & Object (1–20)
1. Create a class to add two numbers.
2. Create a class to subtract two numbers.
3. Create a class to multiply two numbers.
4. Create a class to divide two numbers.
5. Create a class to find the square of a number.
6. Create a class to find the cube of a number.
7. Create a class to calculate the average of 3 numbers.
8. Create a class to swap two numbers.
9. Create a class to find maximum of two numbers.
10. Create a class to find minimum of two numbers.
11. Create a class to calculate percentage.
12. Create a class to calculate simple interest.
13. Create a class to calculate compound interest.
14. Create a class to find factorial of a number.
15. Create a class to check prime number.
16. Create a class to check even or odd number.
17. Create a class to check palindrome number.
18. Create a class to check Armstrong number.
19. Create a class to reverse a number.
20. Create a class to find sum of digits of a number.
Geometry (21–40)
21. Create a class to calculate area of a rectangle.
22. Create a class to calculate perimeter of a rectangle.
23. Create a class to calculate area of a square.
24. Create a class to calculate perimeter of a square.
25. Create a class to calculate area of a circle.
26. Create a class to calculate circumference of a circle.
27. Create a class to calculate area of a triangle.
28. Create a class to calculate perimeter of a triangle.
29. Create a class to calculate area of a parallelogram.
30. Create a class to calculate area of a rhombus.
31. Create a class to calculate area of a trapezium.
32. Create a class to calculate surface area of a cube.
33. Create a class to calculate volume of a cube.
34. Create a class to calculate surface area of cuboid.
35. Create a class to calculate volume of cuboid.
36. Create a class to calculate surface area of sphere.
37. Create a class to calculate volume of sphere.
38. Create a class to calculate surface area of cylinder.
39. Create a class to calculate volume of cylinder.
40. Create a class to calculate volume of cone.

Algebra (41–60)
41. Create a class to solve linear equation (ax+b=0).
42. Create a class to solve quadratic equation.
43. Create a class to calculate sum of first N natural numbers.
44. Create a class to calculate sum of squares of first N numbers.
45. Create a class to calculate sum of cubes of first N numbers.
46. Create a class to generate multiplication table of a number.
47. Create a class to calculate power of a number.
48. Create a class to find GCD of two numbers.
49. Create a class to find LCM of two numbers.
50. Create a class to check whether numbers are co-prime.
51. Create a class to generate Fibonacci series.
52. Create a class to find nth Fibonacci number.
53. Create a class to check if a number is Fibonacci or not.
54. Create a class to calculate arithmetic progression sum.
55. Create a class to calculate geometric progression sum.
56. Create a class to calculate harmonic mean.
57. Create a class to calculate quadratic roots.
58. Create a class to solve simultaneous linear equations.
59. Create a class to evaluate polynomial expression.
60. Create a class to calculate determinant of 2×2 matrix.

Matrix & Vector (61–80)


61. Create a class to add two matrices.
62. Create a class to subtract two matrices.
63. Create a class to multiply two matrices.
64. Create a class to transpose a matrix.
65. Create a class to calculate trace of a matrix.
66. Create a class to check identity matrix.
67. Create a class to check diagonal matrix.
68. Create a class to check symmetric matrix.
69. Create a class to calculate determinant of 3×3 matrix.
70. Create a class to calculate inverse of 2×2 matrix.
71. Create a class to add two vectors.
72. Create a class to subtract two vectors.
73. Create a class to calculate dot product of vectors.
74. Create a class to calculate cross product of vectors.
75. Create a class to calculate magnitude of vector.
76. Create a class to calculate unit vector.
77. Create a class to calculate angle between two vectors.
78. Create a class to calculate distance between two points.
79. Create a class to check if two vectors are perpendicular.
80. Create a class to check if two vectors are parallel.

Advanced Math with OOP (81–100)


81. Create a class to calculate permutation (nPr).
82. Create a class to calculate combination (nCr).
83. Create a class to calculate binomial expansion.
84. Create a class to generate Pascal’s Triangle.
85. Create a class to calculate mean of numbers.
86. Create a class to calculate median of numbers.
87. Create a class to calculate mode of numbers.
88. Create a class to calculate standard deviation.
89. Create a class to calculate variance.
90. Create a class to calculate probability of an event.
91. Create a class to simulate tossing a coin.
92. Create a class to simulate rolling a dice.
93. Create a class to calculate factorial using recursion.
94. Create a class to calculate power using recursion.
95. Create a class to generate prime numbers up to N.
96. Create a class to check twin primes.
97. Create a class to check perfect number.
98. Create a class to check abundant number.
99. Create a class to check amicable numbers.
100.
101. Create a class to solve linear system using matrices.

You might also like