0% found this document useful (0 votes)
12 views3 pages

Practice Questions OOP

The document contains a list of practice questions for a course on Object Oriented Programming using C++. It covers various topics such as access specifiers in inheritance, types of inheritance, polymorphism, operator overloading, file handling, and includes programming exercises in C++. The questions are designed to test knowledge and application of C++ concepts and programming skills.

Uploaded by

temphakar
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)
12 views3 pages

Practice Questions OOP

The document contains a list of practice questions for a course on Object Oriented Programming using C++. It covers various topics such as access specifiers in inheritance, types of inheritance, polymorphism, operator overloading, file handling, and includes programming exercises in C++. The questions are designed to test knowledge and application of C++ concepts and programming skills.

Uploaded by

temphakar
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/ 3

Practice Questions

Course: Object Oriented Programming using C++ Class:CO3I A/B/C

Questions:

1. List different access specifiers used in Inheritance and Describe use of private access
specifier used in the class.

2. List different access specifiers used in Inheritance and Describe use of protected access
specifier used in the class.

3. List different access specifiers used in Inheritance and Describe use of public access
specifier used in the class.

4. Define multilevel inheritance. Draw the diagram to show multilevel inheritance. using classes
with data member and member function.

5. Define multiple inheritance. Draw the diagram to show multiple inheritance. using classes with
data member and member function.

6. Differentiate between Compile time polymorphism and Run time polymorphism.

7. Define polymorphism. List its types with example.

8. Write rules for operator overloading.

9. Give syntax to define operator function.

10. Explain Pointer arithmetic with example.

11. Write the use of following w.r.t file

ios : : trunc and ios : : app

open() and close()

ios : : in and ios : : out

seekg() and seekp()

12. Give syntax to define derived class constructor and describe the order of execution of
constructor for following Figure.
13. Describe the use of Virtual Function.
14. Describe the use of pure Virtual Function.
15. Describe the use of abstract base class.
16. Give meaning of following statements:
int a[5]={1,2,3,4,5};
int * ptr;
ptr = & a ;
cout << * ptr<<”\n” ;
cout << ptr++;
cout << * ptr<<”\n” ;

17. Give meaning of following statements:


int * ptr, a = 5;
ptr = & a ;
cout << * ptr ;
cout << (* ptr) + 1;
18. Write a C++ program to implement following in heritance. Refer following Figure

19. Write a C++ program to implement following in heritance. Refer following Figure

20. Write a program in C++ to overload unary ‘--’ operator to decrease value of data member of
class.
21. Write a program in C++ to overload unary ‘++’ operator to increase value of data member of
class.
22. Write a program in C++ to overload unary ‘-’ operator to negate values of data members of
class.
23. Write a program in C++ to overload unary ‘+’ operator to concatenate two strings.
24. Write a C++ program to declare a class product with members as product_no and name. Accept
and display data for one object of product. Use pointer to object to call functions of class.

25. Write a C++ program to declare a class employee with members as employee_no and name.
Accept the information for 5 objects and display it using pointer to array of objects.

26. Write a C++ program to write ‘Welcome to First lecture’ in a file. Then read the data from file
and display it on screen.

27. Write a C++ program to copy content of one file to another file.

28. Write a C++ program to calculate number of words in the “abc.txt” file.

29. Write a program to define add() function to add two integers and to add three integers.

30. Write a program to overload ‘+‘ operator to add two time objects having data members as
hours and minutes. Display the result using third object.

You might also like