You are on page 1of 4

OOPs with C++ Questions

Lab Manual
PCS-307
1. Write a C++ program to overload increment, decrement and
binary operators.
2. Write a C++ program to get the marks of a student in six
subjects and calculate the result.
3. Write a C++ program to check whether the entered number is
Armstrong or not.
4. Write a C++ program to take an input of object array and sort
the strings stored in it.
5. Write a C++ program to create static data members and
member functions and access them.
6. Write a C++ program to find the factorial of any given number.
7. Write a C++ program to find whether a enter year is a leap year
or not.
8. Write a C++ program to calculate area of square, area of
rectangle and area of circle using function overloading.
9. Write a C++ program to swap the values of any two variable
using call by reference.
10. Write a C++ program for array rotation.
11. Write a C++ program to remove the character from 1st
string which are present in 2nd string.
12. Write a C++ program the function power() to raise a
number m to a power n. the function take double value for m
and integer value for n and return the result correctly. Use a
default value of 2 for n to make the function to calculate squares
when this argument is omitted. Write a main function that gets
the values of m and n from the user to test the function.
13. Write a C++ program to reverse the array elements, which
are entered by the user.
14. Write a C++ program to change every letter in a given
string with the letter following it in the alphabet (i.e. a becomes
b, p becomes q, z becomes a).
15. Write a C++ program to count palindrome words in a
string. a. With the help of inbuilt functions of c++ libraries. b.
With the character array. (i.e. char ch[20]) c. With the string
data type. (i.e. string s)
16. Write a C++ program to multiply two 4x4 matrices and
print the matrix in the tabular form. i.e. 1 2 3 4 5
6 7 9 10 11 12 13 14 15 16 17

17. An electricity board charges the following rates to


domestic users to discourage large consumption of energy: For
the first 100 units – 60P per unit
For the next 200 unit – 80P per unit
For beyond 300 unit – 90P per unit
All users are charged a minimum of rupee 50.00 If the total
amount is more than Rs. 300 then an additional surcharge of
15% is added. WAP to read the names of users and no. of units
consumed and print out the charges with names.
18. Write a C++ program to make a pointer to the derived
class.
19. Write a C++ program to to show constructor in a derived
class.
20. Write a C++ program to to make a class virtual.
21. Write a C++ program to show multilevel inheritance.
22. Write a C++ program to show multiple inheritance.
23. Write a C++ program to overload and add two strings
using + operator.
24. Write a C++ program to overload + operator using friend
function.
25. Write a C++ program to overload * operator.
26. Write a C++ program to count the number of objects of a
class.
27. Write a C++ program to to create a class tollbooth. The
two data element are type unsigned int to hold the total no. of
cars and a type double to hold total amount of money collected.
A member function initializes both of these to zero. The member
function called paying car increment the car total and add 50 to
the car total. Another function called non-paying car increment
the car but add nothing to the car total. Finally the member
function called display, displays the two total. Make the program
menu driven.
28. Write a C++ program for:-
i. A function to read double type of number from the keyboard.
ii. A function to calculate division of these two numbers.
iii. A try block to throw an exception when a wrong type of data is
keyed in.
iv. A try block to detect and throw an exception if the NULL
condition divide by 0 occurs.
v. Appropriate catch block to handle the exception thrown.

29. Write a C++ program to do read and write operations on


a file.
30. Write a C++ program to create a template and pass integer
and float array to it and print their sum.

Instructions for students:


 You should have total 15 practicals
 Each practical can have 2 questions
 Font would be TIMES NEW ROMAN and size would be 12
and for headings its 14.
 Format was discussed in class. Do it accordingly
 LAST DATE TO SUBMIT PRACTICAL FILE IS 25 TH JANUARY
2022
 SUBMIT THE FILE WHILE UPLOADING INTO GOOGLE
FORM.

You might also like