0% found this document useful (0 votes)
65 views3 pages

C++ Question Bank 2

This document contains 27 questions related to various C++ concepts like inline functions, friend functions, static functions and variables, classes, operator overloading, inheritance, pointers, and dynamic memory allocation. Some of the questions ask to explain concepts like inline functions and their use, friend functions and their need in object oriented programming, static functions and variables, defining classes to store student or distance data, overloading operators like > and ++, inheritance and its types, pointers, dynamic memory allocation using new and delete, and derived classes. Other questions ask to write programs implementing concepts like defining classes, overloading operators, inheritance with base and derived classes.

Uploaded by

Rashmi Angane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views3 pages

C++ Question Bank 2

This document contains 27 questions related to various C++ concepts like inline functions, friend functions, static functions and variables, classes, operator overloading, inheritance, pointers, and dynamic memory allocation. Some of the questions ask to explain concepts like inline functions and their use, friend functions and their need in object oriented programming, static functions and variables, defining classes to store student or distance data, overloading operators like > and ++, inheritance and its types, pointers, dynamic memory allocation using new and delete, and derived classes. Other questions ask to write programs implementing concepts like defining classes, overloading operators, inheritance with base and derived classes.

Uploaded by

Rashmi Angane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

C ++ Question Bank

1. What is inline function? What is its use? In what situations inline functions are not

recommended?

2. What is friend function? Explain its need in object oriented programming. OR What is

friend function? Explain with suitable example OR What is friend function? How a

friend function is implemented in C++.OR What is friend function? Explain advantages

and disadvantages of friend function.

3. Explain the use of static function in a class with example. OR Explain static variable and

static function.

4. Write a class “student” with roll number, name, qualification, course name and fees.

Define a method to display student information. Declare array of 5 objects of the class.

Display information of all students and total fees.

5. Define static data. Explain how static variables are declared and used.

6. What are C-type strings? How are they different from strings defined by standard C++

string class?

7. Explain the use of string functions.

8. Write a short note on:

1) Inline function

2) Constant data members and Functions

3) Types of pointer

4) explicit and mutable keyword

9. Write a program to convert a distance from meter to centimeter and centimeter to meter

using object to object conversion.


10. Write a program that defines a class “distance” that stores distance in kilometers and

meters. Perform operations d3=d1+d2 on its objects.

11. How is operator overloading performed using:-


1. Member function
2. Friend function
12. What is operator overloading? Explain with example how pre and post increment
operators are overloaded. OR What is operator overloading? Write a program to overload
preincrement and post increment operator.
13. Write a program in C++ to overload operator > to compare two numeric objects.
14. Define operator overloading. Explain data conversions possible using operator
overloading(Write any two data conversions)
15. Define a class which contains integer array. Overload unary ++ operator to increment
array element by 1.
16. Define a string class .Write a C++ program to overload <,> operators to compare two
strings.
17. What is multipath inheritance? What ambiguity arises in it? How it can be resolved
explain with example.
18. Explain pointers and virtual functions in C++.
19. Explain the concept of dynamic memory allocation. Explain the use of new and delete
operator in detail.
20. What is Dynamic Memory allocation? Write A Program to Convert Primitive Data Type
To Object?
21. Create a class Distance that stores the distance in feets and inches. Write member
functions to accept and display the distance. Write main function that displays the
distance. The program should use ‘new’ operator to create distance objects and delete to
delete the objects.
22. What is pointer? How to declare a pointer? Explain with suitable example.
23. What is inheritance? Explain different types of inheritance with an example and write a
program to show virtual base class?
24. Explain the concept of diamond shaped inheritance.
25. Define multiple inheritance. Explain with e.g. how diamond shaped inheritance leads to
ambiguity.
26. What is the difference between multiple and multilevel inheritance? What type of
ambiguity occurs in multiple inheritance and how it is resolved?
27. Define Employee class with emp-no and name and member functions like getdata() and
putdata().Define student class with degree and class and member functions getedu and
and putedu().Derive manager and Scientist classes from employee and student
classes.Write a C++ program to implement manager and scientist classes.

You might also like