Question Bank OOP - KNK
Question Bank OOP - KNK
KNK_OOP
20) Write a C++ program to generate all the prime numbers between 1 and n, where n is a
value supplied by the user.
KNK_OOP
Question bank Unit III
KNK_OOP
Question bank Unit IV
KNK_OOP
Question bank Unit V
1) What is visibility mode? What are different inheritance visibility modes supported by
C++? Explain. 6/7m
2) What is a virtual function? Why does we need virtual function? 6m
3) What is inheritance? How to define a derived class? Write advantages of inheritance.
7m
4) What are different forms of inheritance? Give an example for each. 7m
5) With suitable example explain multiple inheritance. 6m
6) What is the difference between normal member function and virtual member function in
inheritance? Explain with suitable program. 7m
7) What are pure virtual functions? How do they differ from normal virtual functions? 6m
8) Describe the rules for implementing virtual functions in C++. 6m
9) With suitable example, explain single inheritance. 6m
10) With suitable example, explain multilevel inheritance. 6m
11) What are abstract classes? Write a program having student as an abstract class and create
many derived classes such as Engineering, Science, Medical, etc. from student class.
Create their objects and process them. 7m
12) Write a C++ program to implement the structure shown below.
Class student has data members roll no and name. Class test has data members marks1
and marks2 and Class sports has data member sports marks. Define necessary member
functions in these classes. Class result has data member for total marks. Finally display
roll no, name, marks obtained and total marks.
student
test sports
result
13) Write a C++ program to implement the structure shown below using the concept of
virtual base class. Define necessary data members and member functions in the
respective class and finally display roll no, marks1, marks2, sports score and total result.
student
test sports
result
KNK_OOP
14) Consider the class structure shown in figure below. Class student stores name and roll no,
class test stores marks obtained in sub1 and sub2, class result contains total marks in sub1
and sub2 and class division contains the division student has passed based on the
percentage of marks. Create all classes and include necessary functions to read name and
roll no of student, read marks in sub1 and sub2, calculate total marks in sub1 and sub2
and division obtained and display the division obtained.
student
test
result
division
KNK_OOP