C++ Question Bank
C++ Question Bank
C++ Question Bank
P.T.O.
12322/C220 *12322C220*
_______________
*32322C220* 32322/C 220
Reg. No.
SECTION A
P.T.O.
32322/C 220 *32322C220*
SECTION B
SECTION C
8. Write a CPP program to read the data of N employees and compute the net
salary of each employee.
(DA 60% of Basic, IT 15% of Gross, HRA 20% of Basic)
Given that an employee class contains the following members.
a) Data members : Emp No., Emp Name, Basic sal, DA, IT, HRA, NetSal.
b) Member Functions : To Read the data, to compute net salary and to print data
members. 10
10. a) Write a CPP program to concatenate and compare two strings using + &
==.
b) What are the limitations of increment operator ? (5+5)
_____________
*22322C220* 22322/C 220
Reg. No.
SECTION A
SECTION B
14. What is a friend function ? Write a C++ program to swap two numbers using
friend function.
17. Write a C++ program to concatenate and compare two strings using + and = = .
19. What are class templates ? Write a program to demonstrate class templates.
SECTION C
23. Explain with an example how do you convert one class type to another class type.
24. Explain in brief the following types of inheritance along with an example.
a) Hierarchical Inheritance.
b) Single Inheritance.
______________
*22322C220* 22322/C 220
Reg. No.
SECTION – A
SECTION – B
4. Write a program to print sum of even and odd numbers. (Use the class concept.)
5. Write a program to overload the operator ‘++’ using unary operator overloading.
6. How do you access data and member functions using ‘this’ pointer ?
SECTION – C
_______________
*12322C220* 12322/C 220
Reg. No.
8. a) What is the use of 'this' pointer ? How do you access member data and
member function using 'this' pointer ?
b) Explain the following with example :
1) Conversion from basic type to class type.
2) Conversion from class type to basic type.
c) Write a C++ program to concate two strings. (5+6+5=16)
*22322C220* 22322/C 220
Reg. No.
SECTION A
3. Write the syntax to derive the derived class D from the base class B.
P.T.O.
22322/C 220 -2- *22322C220*
SECTION B
16. Write a C++ program to swap two integers using friend function.
18. What are templates ? Explain briefly the types with syntax.
19. Write a C++ program to overload the operator ++ using unary operator
overloading.
SECTION C
21. a) What are inline functions ? Write a program using inline function to find square
and cube of a give integer number. 5
22. What is inheritance ? explain briefly with syntax the various forms of inheritance. 10
23. a) What is operator overloading ? Explain the syntax of operator function with
the help of an example. 5
b) Write a program to illustrate the use of conversion from class type of basic
type. 5
*22322C220* -3- 22322/C 220
b) Write a program to illustrate the use of static data members and static member
functions. 5
*12322C220* -1- 12322/C 220P
Reg. No.
3. a) What is a class ? Write the syntax for declaring class with an example.
b) How do you pass objects as arguments ? Explain with an example.
c) Write a program to illustrate function overloading. (4+8=4=16)
P.T.O.
12322/C 220 *12322C220*
_______________________
*32322/C22* (1) 32322/C22
Reg. No.
SECTION- C
Answer Any Four questions of the following: (4×10=40)
8. Explain Basic concepts of oop’s. (10)
9. Explain different types of Inheritance. (10)
10. What is constructor? Write a cpp program to overload constructors. (10)
11. a) Explain exception handling mechanism. (5)
b) Explain class Templates with an example. (5)
12. Write a cpp program to Add two complex numbers using Friend Function. (10)
__________________
P.T.O.