C++ Programming Important Questions
C++ Programming Important Questions
Q1. What are tokens in C++ language? How many Keywords are there in C++ language?
Q2. Explain the User defined data types and their advantages with the help of an example.
Explain the typecasting and conversion in C++ Language,
Q3. What is the difference between Procedural and Object Oriented Programming Language?
Q4. Differentiate between the following:-
1. local and global variable
2. printf() and scanf()
3. gets() and puts()
4. While and Do – While Loop
5. Break and Continue
6. Call by Value and Call by Reference
7. getch(), getche(), gets() and getchar
8. auto, extern, register, and static
Q5. Where was C++ originally developed and by whom? Explain the Significance, history and
structure of C++ Program.
Q6. What is meant by precedence of operators? Provide a brief outline of all the operators
supported by C++ Language along with their hierarchy within expressions with suitable
examples.
Q7. Write a program to determine whether a number is:
a) Prime or not
b) Palindrome or not
c) Armstrong or not
d) Factorial or not
e) Fibonacci Series or not
Q8. What is memory management? How is it implemented in C++.
Q9. What do you mean by Pointer? Explain its features and explain various operations on
pointers by using suitable example. Write a program to concate two string using poiners.
Q10. What is an array? Explain the concept of Array with a function by giving a suitable
example.
Q11. Explain Nested If Statement and Else If Ladder with example. Discuss the advantages of
object – oriented modelling with examples.
Q12. Write the Characteristics of Object Oriented Programming Systems in detail with the help
of suitable example. Also explain the data hiding concepts in c++.
Q13. Describe the following with suitable C++ examples;-
1. Static Members and Abstract Data Types
2. Constructor, Destructor, Friend Function
3. Exception Handling
4. New and Delete Operators
5. Inline Functions
6. Class and Function Templates
7. Namespace
8. Recursion
9. Virtual Function and Pure Virtual Function
10. Function Overloading and Method Overriding
11. Public and Private Visibility
12. Scope Resolution Operator
13. Classes and Objects
14. Try – Catch Excepetion
15. Flow Control
16. Resource Capture and Release
17. Iterator and Hash
18. Data Member and Member Functions
19. Expected and Unexpected Exception
Q14. Write a program for the following:-
1. Addition, Subtraction, Multiplication and Transpose of two matrices of order m*n
2. Sum of the digit of a given number
3. Reverse a number
4. String Manipulation Functions
Q15. What do you mean by Function Prototyping? List the advantages of Function Prototypes in
C++ Language. Explain in detail about the user defined functions.
Q16. Write a program to extract a substring from the given sting.
Q17. What do you mean by Decision Making Statements in C++ Language?
Q18. Explain the Input and Output Functions used in C++ Language?
Q19. What do you mean by Algorithm and Flowchart? What are the various basic symbols used
in flowcharting? Explain in detail.
Q20. A) What is a function? How can you pass parameters to a function?
B) What do you mean by Operators and Expressions in C++ Language? Explain the types of
operators used in C++ Language in detail by giving a suitable example.
Q21. What is an exception? How is it handled in C++? Explain in detail with the help of an
example.
Q22. Define References. How are these useful and used? Explain with the help of example.
Q23. Describe two major uses of abstraction.
Q24. Discuss the base and derived class in C++ with the help of example. Also explain the types
of inheritance in detail with the help of an example.
Q25. Write a C++ program for the following:-
1. Calculate the area of rectangle, square using function overloading.
2. Parameter passing mechanism using pass by address method.
3. Search for a given element in an array using linear search.
4. Create a base class Patient (pat-name, age, sex) and IPD (ward-no, bed-no, charge-per-
day). Derive a class IPD-patient from these two base classes with no-of-days-admitted
attribute.
5. Dynamic memory allocation in C++.
6. Hybrid Inheritance
7. Create two classes dist1 (meters, centimeters) and dist2 (feet, inches). Accept two distances
from the user, one in meter and centimeter and other in feet and inches. Find the sum and
differences of the two distances. Display the result in, meters and centimeters as well as
feet and inches (using friend function). (1 inch = 2.54 cm and 1 feet = 0.30 m)
8. Write a C++ program to define a class employee having members Emp-id, Emp-name,
basic salary and functions accept() and display(). Calculate DA=25% of basic salary,
HRA=800, I-tax=15% of basic salary. Display the payslip using appropriate output format.
9. Addition of multiple types of data using generic function or template.
10. try, throw and catch statement