PGDCA C&C++ LAB ASSIGNMENT QUESTION
PGDCA C&C++ LAB ASSIGNMENT QUESTION
LAB ASSIGNMENT
Subject - Programming using C & C++
List of The Practical Questions (Lab-II)
Submission Deadline : 10-01-2025
10. Create a menu-driven program using the switch statement to perform basic arithmetic operations
(Addition, Subtraction, Multiplication, and Division).
11. Write a program to input a day number (1-7) and print the corresponding day of the week using the
switch statement.
12. Create a single program to perform following tasks using if. Else, loop and single dimension
integer array:
a) Sort the elements.
b) Find greater number and average.
13. Create a single program to perform following tasks using if, Else, loop and double dimension
integer array of size 3x3:
a) Addition of two matrix.
b) Subtraction of two matrix.
c) Multiplication of two matrix.
14. Write a program of swapping two numbers and demonstrates call by value and call by reference.
15. Create a program to return the largest of three numbers using return by reference.
16. Write a program to use an inline function for calculating the area of a circle and a rectangle.
17. Develop a program to calculate the perimeter of a rectangle, ensuring the dimensions remain
constant in the function.
18. Write overloaded functions to calculate the area of a circle, rectangle, and triangle.
19. Develop a program to create a class Rectangle with data members for length and width, and
member functions to calculate and display the area and perimeter.
20. Write a program to store and display details of 5 employees (ID, name, salary) using an array
of objects.
21. Write a program where a friend function calculates the average of marks of a student, accessing
private members of a Student class.
22. Write a program to create a class Circle with a parameterized constructor to initialize the radius
and calculate the area.
23. Develop a program to copy the details of a student (roll number, name, marks) from one object
to another using a copy constructor.
24. Write a program to count the number of objects created and destroyed using constructors and
destructors.
25. Write a program to overload the unary ++ and -- operator to increment and decrement the value
of a private data member.
26. Write a program to overload the + operator to add two complex numbers using a class Complex.
27. Write a program to overload the * operator to multiply two matrices using a class Matrix.
28. Create a class String and overload the + operator to concatenate two strings.
29. Develop a program to create a class Distance that converts a float value representing kilometers
into meters and centimeters.
30. Develop a program to convert objects of a Fahrenheit class to a Celsius class using operator
overloading.
31. Write a program to demonstrate multilevel inheritance with a base class Shape (basic properties),
derived class Rectangle (length and width), and further derived class Cuboid (height).
32. Create a program to handle data from two base classes Person (personal information) and
Employee (job details) using a derived class Manager.
33. Write a program to demonstrate hierarchical inheritance where a base class Animal has derived
classes Dog, Cat, and Bird, each with specific methods.
34. Write a program to create an abstract class Shape with a pure virtual function calculateArea() and
derived classes Circle and Rectangle that implement the function.
35. Write a program to demonstrate the use of a pointer to an object by creating a class Student with
data members for roll number and name. Use a pointer to access and modify object data.
36. Create a program to use the this pointer to return the current object from member functions in a
ChainedFunction class that supports method chaining.
37. Write a program to open a file in read mode and display its contents line by line until the end of
the file is reached.
38. Write a program to count the number of words, characters, and lines in a file.