C++ Programming Assignment Paper
Duration: 3 Hours
Total Marks: 100
Instructions:
• Attempt all questions as per section requirements.
• Write clear and well-commented code.
• Use proper indentation and meaningful variable names.
• Submit all programs at the end of the session.
Section A – Basic Programs (Any 3 out of 4) (3 × 5 = 15 Marks)
1. Write a program to find the sum and average of 5 numbers using a user-defined function.
2. Write a program to check whether a number is prime or not.
3. Write a program to demonstrate the use of all types of tokens in a simple C++ code.
4. Write a program to display a multiplication table using for loop.
Section B – Functions and Overloading (Any 2 out of 3) (2 × 10 = 20 Marks)
5. Write a program using function overloading to calculate the area of a circle, rectangle, and
triangle.
6. Write a program to find the factorial of a number using a recursive function.
7. Write a program that demonstrates nesting of member functions.
Section C – Classes & Objects (Any 3 out of 4) (3 × 10 = 30 Marks)
8. Create a class Student with data members name, roll number, and marks of 3 subjects.
Use member functions to input and display the details.
9. Write a program to demonstrate the use of static data members and static member
functions.
10. Create a class Number with a private integer. Write a friend function to find the greater
number between two Number objects.
11. Write a class Box with constructor and destructor. Show the order of constructor and
destructor calls for multiple objects.
Section D – Inheritance and Polymorphism (Attempt All) (2 × 10 = 20
Marks)
12. Write a program to demonstrate Multilevel Inheritance with appropriate classes (e.g.,
Person → Employee → Manager).
13. Create a class hierarchy to demonstrate function overriding and use a virtual function to
achieve runtime polymorphism.
Inheritance ( 5 Marks)
14. Write a program to demonstrate the concept of virtual base class using a diamond-
shaped multiple inheritance problem.
Menu Driven Program ( 10 Marks)
15. Write a program of calculator which represents the menus for selection of arithmetic
operations (Addition, subtraction, multiplication, division)