CPP Questions
Short Questions:
a) What is reference variable?
b) What is the use of extraction operator.
c) Explain any two manipulators.
d) Write the use of scope resolution operator.
e) What is keyword in C++?
f) Define memory management operator.
g) What is access specifier?
h) Define Pure virtual function.
i) Explain width ( ) and fill ( ).
j) What is destructor?
a) Short note on 'This' pointer
b) Short note on Exception handling
c) Short note on Inline function.
a) What is Object Oriented Programming (OOP)?
b) What are applications of C++?
c) Define the scope resolution operator in C++.
d) List the memory management operators in C++.
e) Define inline functions.
f) What are default arguments in C++?
g) Define a class and an object in C++.
h) List the access specifiers in C+++.
i) What is the scope resolution operator in C++?
j) Define a destructor in C++ with its syntax.
Short note on Virtual functions
b) Short note on Exception handling
c) Short note on Friend Function
a) Define Encapsulation.
b) What is inline function?
c) What is Class? Give its syntax.
d) What is Constructor?
e) Explain any two use of Scope Resolution operator.
f) List the operators which cannot be overloaded?
g) What is virtual function?
h) What is stream?
i) Explain get () and put () function.
j) What are the access specifiers used in C++
a) Short note on Manipulators in C++.
b) Short note on Exception Handling.
c) Short note on ‘this’ pointer.
a) List any four features of OOP's.
b) Define pure virtual function.
c) What is cascading of I/O operator?
d) List the ways to define a constant.
e) What is an abstract class?
f) Define multiple inheritance.
g) Define destructor.
h) What is 'this' pointer?
i) What is Run-Time Polymorphism?
j) Enlist manipulators in C++.
a) Short note on Array of object
b) Short note on Access specifier
c) Short note on Constructor in derived class
a) Explain tellg() and tellp() with syntax.
b) Explain any two manipulators.
c) What is destructor?
d) What are the visibility lables used in C++.
e) What is extraction and insertion operator?
f) What is abstraction and Encapsulation?
g) What is default argument in function?
h) Write any two uses of scope resolution operator.
i) What is static Polymorphism.
j) Explain structure of C++ program
a) Short note on This pointer
b) Short note on function overriding
c) Short note on Exception handling
Long Questions and Programs:
1. Explain memory allocation for objects with non-static data member
and static data member.
2. What is inheritance? Explain any 3 types of inheritance.
3. What is constructor? Explain parameterised constructor with the help
of example.
4. What is template? Explain with its types.
5. Explain polymorphism with its types.
6. What is function overloading? Explain with example.
7. Explain features of C++.
8. Write a program to accept worker information worker_name,
no_of_hours_worked, pay_rate and salary. Write necessary function
to calculate calculate and display the salary of workers. (Use default
value for pay_ rate)
9. Create a C++ Class Number with integer data member. Write necessary
member function to overload unary '--' (decrement) operator.
10. Write a C++ program to create a class Book which contains data
members as B-Id, B-Name, B-Author, B-publication. Write member
functions to accept and display Book information also display count
of books. (Use static data member to maintain count of books)
Explain various stream classes used to perform console input/output
(I/o) operations.
11. Explain friend function with the help of example.
12. Write a C++ program to find area of circle and triangle (Use function
overloading)
13. Write a program to check maximum and minimum of two integer
numbers (use conditional operators)
14. What are manipulators in C++? Give an example.
15. Define reference variable in C++ and explain its use with an example.
16. Define Constructor. Explain any of its type along with example.
17. Define inheritance and its types in C++.
18. Explain operator overloading in C++ with an example
19. Explain the difference between a structure and a class in C++.
20. Explain the use of a static data member and a static member function in
C++ with an example.
21. Write a C++ which define a class named Bank Account with two private
data members balance and interestRate. Implement a friend class named
Bank with a function named get Interest() that calculates and returns the
interest on the bank account using the interest rate.
22. Explain the concept of virtual base class in C++ with an example.
23. Explain the concept of objects as a function argument in C++.
[Link] a C++ program to demonstrate function overloading using the
following functions:
i) int sum(int a, int b)
ii) float sum(float a, float b)
iii) int sum(int a, int b, int c)
25. Write a class template named ‘Pair’ that can store a pair of values of
different data types. The class should have two private data members,
‘first’ and ‘second’, and a constructor that can initialize both data
members. The class should also have public member functions to get
and set the values of the data members.
26. Write a C++ program to read data from a file named “[Link]” and write
the data to a new file named “[Link]”. The program should remove
any blank lines from the input file.
27. Create a class called “Shape” with a protected member variable “color”.
Add a public method called “getColor()” that returns the value of “color”.
Create two subclasses of “Shape” called “Rectangle” and “Circle”. The
“Rectangle” class should have private member variables for “width” and
“height” and a public method called “getArea()” that returns the area of
the rectangle. The “Circle” class should have a private member variable
for “radius” and a public method called “getArea()” that returns the area
of the circle. Override the “getColor()” method in both subclasses to
return the color of the shape
[Link] Memory management operators in detail.
29. What is friend function? Explain with an example?
30. Explain array of object in C++ with example.
31. Explain the different types of Inheritance with example.
32. List different types of constructor. Explain any one constructor with
example
33. Write a C++ program to find the maximum of two integer numbers using
inline function.
34. Write a C++ program to find the area of circle and area of triangle using
function overloading.
35. Write a C++ program to swap the values using call by reference method.
36. Write a C++ program to create a class employee which contains data
members as e_id, e_name, e_Salary. Write member functions to accept
and display employee information, also display information of employee
having maximum salary.
37. Write a C++ Program to overload unary ++ operator.
38. What is Template? Explain its types in detail.
39. Explain file opening methods in C++ with syntax.
40. Explain the types of polymorphism in detail.
41. Write a C++ program to calculate the Simple Interest. (Use default value
for rate)
42. What is the output of the following program? (Assume there are no
syntax errors)
# include < iostrearn.h>
void stat( )
int m = 0;
static int n = 0;
m++;
n++;
cout<<m<< '' ''<<n<< ''\n'';
void main( )
stat( );
stat( );
getch ( );}}
43. Explain function overloading with example.
44. What is inheritance? Explain types of inheritance.
45. Explain static data members and static member functions with example.
[Link] is friend function? Write characteristics of friend function.
47. Explain use of any four file opening modes.
48. Write a C++ program to create a class product which contains data
members as pname, price, quantity. Write member functions to accept
quantity for n products and accordingly generate and display bill.
49. Design a base class person (name, address, phoneno). Derive a class
employee (eno,ename) from person derive a class manager (designation,
department, basic-salary) from Employee. Accept all details of 'n'
managers and display manager having highest basic salary.
50. Write a C++ program to overload the functions to calculate area of
circle, square and rectangle.
51. Write a C++ program to print the following pattern
A
BC
DEF
GHI J
52. Write a C++ program to accept length and width of a rectangle. Calculate
and display perimeter of a rectangle by using inline function.
[Link] parameterized constructor with the help of suitable example.
[Link] virtual base class with example.
55. Write a C++ program to find maximum of two integer numbers using
function template.
[Link] a program to overload binary plus operator to concatenation of
two strings.
57. Explain operator overloading in C++ with an example.
58. Explain memory allocation for objects with non-static data member and
static data member.
59. What is pure virtual function and explain with the help of example program.
60. Explain Dynamic constructor with suitable example.
61. What is inheritance and explain the hierarchical inheritance.
62. Write a C++ program to create a class which contains two data members.
63. Write member functions to accept, display and swap two entered numbers
using call by reference.
64. Write a C++ program to create a class customer which contains data
members as C_id, C_name, C_Salary. Write member functions to accept
and display customer information, also display information of customer
having maximum salary.
65. Write a C++ program to calculate factorial of integer number by using
inline function.
[Link] C++ class which contains function count(). Write a program to
count number of time count() is called. (Use static data member.)
67. Write a C++ program to copy the contents of a text file into another
text file.
68. Explain object as function arguments? Explain with the help of an example
program.
[Link] different characteristics of friend function.
70. What is class Template? Explain syntax of class template with suitable
example.
[Link] a program to overload binary + operator to add two strings.