OBJECT ORIENTED PROGRAMMING WITH C++
IMPORTANT QUESTIONS FOR CIE – III
1. By applying the concepts of Inheritance Write a C++ program to create a Base
class called student. Use this class to store roll number, member functions as
get_number( ), put_number( ). Derive specific class called “test” from the base
“student” ,to get sub1, sub2 using member function as get_marks( ), put_marks(
) to get sub1 and sub2 marks. Then derive another class “result” from class “test”
marks add sub1, sub2 marks to display result.
2. Discuss about pointers and develop a program to display number, code, price of
items using pointer.
3. List the rules of Virtual Functions.
4. Discuss how can the members of Base class be accessed in derived class and
compile a program to show working of pointers in the derived class using *bptr,
*dptr as pointers B, D as base and derived class, show( ) as member function for
both base and derived class.
5. Compile a C++ program to compare ages of 3 persons, using “this” pointer.
6. What is stream? Explain with a neat diagram the C++ class hierarchy for stream
handling.
7. Evaluate the role with examples for unformatted I/O operation functions :
i) get( ) ii) put( ) iii) getline( ) iv) write( )
8. Write a C++ program to define a class called phone book with data members
name, code, prefix and number and member functions read_data( ) which reads
the values of the data members from the keyboard and write_data( ) which
displays the values of the data members. Enter the data for at least 5 phone
numbers and store details in binary file phone and read the stored details and
display on the screen.
9. Explain End of file (EOF) operator in detail.
10. Evaluate with examples how can a file be opened for both reading and writing?
Compare the difference between opening a file using the constructor of stream
class and open( ) function.
11. Evaluate the output Manipulators: setw( ), setprecision( ) and setfill( ) with
examples.
12. Discuss base class and derived class with suitable example.
13. What is hybrid inheritance? Explain the diamond problem of inheritance in c++
with suitable example.
14. Give the significance of ‘this’ pointer with a program.
15. What is an abstract class? Write the advantages with an example program.
16. Differentiate virtual and pure virtual functions.
17. Write the syntax and example to create user defines manipulators.
18. Write a c++ program to copy the content of one file to another.
19. Why it is necessary to detect the EOF? Give example.
20. Give the syntax and example for defining different typed of derived class.
Explain the access specifies public, private and protected with example.