0% found this document useful (0 votes)
7 views

Program List

The document contains practice programming questions on C++ topics like functions, classes, inheritance and polymorphism. Questions include programs to generate patterns, swap values, perform arithmetic operations using functions and classes, calculate areas of shapes, count characters and vowels, calculate interest, create a student class, create static member functions, perform complex number operations, demonstrate call by value/reference, work with multiple and multilevel inheritance, bank accounts, circles/spheres/cylinders, polar coordinates and friend functions.

Uploaded by

Lucky Saxena
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Program List

The document contains practice programming questions on C++ topics like functions, classes, inheritance and polymorphism. Questions include programs to generate patterns, swap values, perform arithmetic operations using functions and classes, calculate areas of shapes, count characters and vowels, calculate interest, create a student class, create static member functions, perform complex number operations, demonstrate call by value/reference, work with multiple and multilevel inheritance, bank accounts, circles/spheres/cylinders, polar coordinates and friend functions.

Uploaded by

Lucky Saxena
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Acropolis Institute of Technology & Research

CSE (Artificial Intelligence & Machine Learning)


B. Tech. II Yr. IV Semester
Practice Program

Q1. Write program to generate following pattern

a)
1
12
12 3
1234
b)
*
* *
* * *
* * * *

Q2. Write a program in C++ which uses functions to swap two integer & two float numbers by
using reference variable.

Q3. Create a single program to perform following tasks without using library functions:
 To reverse the string accepted as an argument.
 To count the number of characters in string passed as argument in form of character
array.

Q4. WAP in C++ to create a structure named complex having data member real and image.
Create member function add_complex which takes structure as an argument and return structure.
Using function add two complex numbers.

Q.5 Write a program to perform arithmetic operations using inline function.

Q6.WAP in C++ to calculate the area of circle, rectangle, square and triangle using inline
function.

Q7. WAP in c++ To count no. of vowels, consonants in each word of a sentence passed as
argument in form of character array.

Q8.Write program in C++ to calculate simple interest and compound interest using default
argument.

Q9.Create a class named calculate that uses overloaded function calclulate_area of circle,
rectangle, square and triangle.
Q10.Create a class Student having data members to store roll number, name of student, name of
three subjects, max marks, min marks, obtained marks. Declared an object of class student.
Provide facilities to input data in data members and display result of student?

Q11. Create a class student having data members to store rollno, name of student, name of 3
subjects , max marks, min marks, obtain marks .use nesting of member function Declare an array
of object to input data of 3 students. Provide facilities to display result of all students and to
display result of specific student whose roll number is given?

Q12. Create a class named ‘array’ having an array of integers having 5 elements as data member
provide following facilities:
Constructor to get number in array elements.

Q13.Create a class Static_demo with static member functions for following tasks:-
 To find factorial by recursive member function
 To check whether a no. is prime or not.

Q14.Write a class complex having data members to store real and imaginary part provide
following:
 Add two complex no using object as an argument.
 Subtract two complex no using object as an argument.

Q15. Write swapping program to demonstrate call by value, call by address and call by reference
in a single program?

Q16.Write a program for to create class polar data member radius and angle define constructor of
all three types and create destructor and test function in main.

Q17. Create a class student. The student class has data members such as roll number, name of
student, contact number and address .create the derived class test which contains data members
representing name of subject, and test marks of 5 subjects. Display all the information of student.

Q18. Write a program in C++ for multiple inheritances using book as derived class having
different base classes Journals, Magazines, Newspaper.

Q19. Consider an example of declaring the examination result. Design 3 classes student, exam,
result. The student class has data members such as that representing number, name of
student ,create the class exam, which contains data members representing name of subject,
minimum marks, maximum marks, obtained marks for 3 subject derive class result from both
student and exam classes. Test the result class in main function?

Q20.WAP to generate Fibonacci series uses the concept of function overriding.

Q21. Write a program in C++ using constructor and destructor in Multiple and multilevel
inheritance.
Q22.Create a class accounts that stores customer name, account number and type of account.
From this derive the classes cur_acct and sav_acct to make them more specific to their
requirements. Include necessary member functions in order to achieve the following tasks:
a) Accept deposit from customer.
b) Display the balance

Q23.Create a class circle with data member radius; provide member function to calculate area.
Derive a class sphere from class circle; provide member function to calculate volume. Derive
class cylinder from class sphere with additional data member for height and member function to
calculate volume.

Q24.Create class Polar having data members radius and angle. It contains member functions for
taking input in data member function for displaying value of data members. Class Polar contains
declaration of friend function add which accepts two objects of class Polar and returns objects of
class Polar after addition. Test the class using main function and object of class Polar.

You might also like