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

CPP Question Bank

The document outlines a comprehensive curriculum for learning C++, covering topics such as object-oriented concepts, classes and objects, functions, constructors, operator overloading, inheritance, virtual functions, file handling, and exception handling. Each chapter includes specific questions and programming tasks designed to reinforce understanding of C++ concepts and practices. The content is structured to guide learners through both theoretical knowledge and practical application in C++ programming.

Uploaded by

Prem Dhawan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views3 pages

CPP Question Bank

The document outlines a comprehensive curriculum for learning C++, covering topics such as object-oriented concepts, classes and objects, functions, constructors, operator overloading, inheritance, virtual functions, file handling, and exception handling. Each chapter includes specific questions and programming tasks designed to reinforce understanding of C++ concepts and practices. The content is structured to guide learners through both theoretical knowledge and practical application in C++ programming.

Uploaded by

Prem Dhawan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Chapter 1 Introduction to C++

1. List any six keywords used in C++ for Object Oriented Concepts (3)
2. List and explain data types in C++ with sizes in bytes(3)
3. What is the use of scope resolution operator?(2)
4. Explain insertion and extraction operators in C++(2).
5. Write the purpose of New and Delete operators.(2)
6. What is a reference variable?(2)
7. Explain two manipulators with examples.(2)
Chapter 2 Classes and Objects
1. Enumerate object oriented concepts in C++.(3)
2. Explain access specifiers in C++.(3)
3. Can we define member functions outside the class? Give an example.(5)
4. Differentiate between string and character array.
5. Explain push_back and resize string functions.(2)
6. Explain pop_back, length and capacity string functions. (3)
7. Write a C++ program to read two strings and swap them using swap string function.
Display length of both strings(3)
8. Define ‘this’ pointer. State the purpose of ‘this’ pointer.
9. Write a program to create an array of ten objects of Student(rollno, name, percentage)
class and sort the array on percentage. (5)
10. .

Chapter 3 Functions in C++


1. Give examples of call by reference and return by reference. (5)
2. Write a program to Overload function simple_interest(P,T,R ) (5)
3. Explain Default argument(2)
4. Explain Inline function(2)
5. Differentiate between macro and inline functions. (5)
6. Pass and return objects from function.(3)
7. What is a friend function? Explain with an example.(3)
8. What is the use of friend class?explain.(5)
9. Write a C++ program to calculate Compound Interest using concept of pass by reference
and return by reference. Read principal amount, rate of interest and period from the user.
10. Write a function Interest(principal, int_rate, year). Use function overloading and default
arguments to set the values of int_rate and year.
11. Create a class Cone(radius, height). Declare a static member count that will store the
number of objects created. Write a static function that display() the number of objects
created.
12. Create two classes Academics(rollno, name, m1, m2,m3) and Curricular(c1,c2). Write a
friend class result to calculate percentage of a student using academics and curricular
marks.
13. Create a class Account(Ano, Name, balance, int_rate). Write a friend function Total_bal()
to calculate total interest earned on the balance.

Chapter 4 Constructors and Destructors


1. Define constructor and destructor.
2. Enumerate types of constructors and explain with examples.
3. Differentiate between constructor and destructor.
4. Can the destructor be overloaded? Justify your answer.
5. Create a class Manager(id, name, department, designation). Use default, parameterized
and copy constructors to initialize the members of the class.
6.
Chapter 5 Operator Overloading

1. List the rules of operator overloading? (5)

2. What is the need to overload the operator?

3. Tabulate the operators that can be and can’t be overloaded in C++.


4. Write the rules to overload unary operators as friend and member functions.(5)
5. Write the rules to overload binary operators as friend and member functions?(5)
6. Write a program to overload +,*,/ operator using friend function for class
Complex(real,img).
7. Write a program to overload <,>,!= operator using friend function for class
Circle(radius).
8. Write a program to overload +,<= and = operator using member functions for class
Rectangle(length, breadth).
9. Write a program to overload insertion and extraction operators for class Distance(inch,
feet) .

Chapter 6 Inheritance
1. Define inheritance.
2. What are the types of inheritance.
3. Short note on Multiple inheritance, multilevel inheritance, hierarchical
inheritance,Hybrid inheritance
4. What is the calling sequence of constructors and destructors in inheritance?
5. How the ambiguity problem in multiple inheritance is resolved?
6. Create a class Shape with abstract methods area() and volume(). Derive classes
Cube(side) and Cone(radius, height) from Shape and calculate area and volume for each
shape.
7. Define virtual base class.
8. Short note on virtual base class.

Chapter 7 Virtual Functions and Polymorphism


1. Differentiate between method overloading and overriding.(5)
2. Define virtual function.
3. List the rules for virtual function.
4. Define pure virtual function.
5. Create a class Author(name, category). Derive a class Book(Title, version, price) from
Author. Write print() method in both classes. Use method overriding. Show how to
access the print using pointers.
6. a) Create a class Account (Accno, Name). Derive a class SavingsAC (Bal, I_rate) from
Account. Write Cal_interest() method in both classes. Use method overriding. Show how
to access the Cal_interest() using pointers.
7.

Chapter 8 Working with files


1. List the types of files.(2)
2. List and explain the file modes and operations.(5)
3. Write a program to handle following file operations (5)
a. Read file name.
B. Check if the file exists.
C. If a file already exists, read data from it and display it.
4. Write a program to handle following file operations (5)
a. Read two file names.
B. Check if both the files exist.
C. Append the contents of the second file to the first file.
Chapter 9 Exception Handling
1. Define exception(1)
2. Explain keywords to handle the exception.(3)

You might also like