Monday, October 5, 2015

Important Question Bank of C++




MOST IMP QUESTION BANK





Chapter 1 : CONCEPTS OF OOP
1)
Explain basic concepts of Object-Oriented Programming. (07 marks)
2)
How does main() function in C differ from C++? Give General format of
Class. (02 marks)





Chapter 2 : C++ BASICS
1)
What is Reference variable? What is its major use? Give Example.(04 marks)
2)
Describe various operators in C++. (07 marks)





Chapter 3 : C++ FUNCTIONS
1)
Define Function Overloading. Give proper example. (03 marks)
2)
Explain Scope Resolution Operator with example. (03 marks)
3)
What is Inline Function? In which Situation Inline Function may not work? How
does an inline function differ from a preprocessor macro? Write program using
Inline Function to find largest of three numbers. (07 marks)
4)
Describe following terms in C++ with suitable examples.
Function overloading, Inline function, Default arguments, Call by reference. (07 marks)








Chapter 4 : CLASSES AND OBJECTS , CONSTRUCTOR & OPERATOR OVERLOADING
1)
What is the purpose of Static? Write Characteristics of Static Data Member and
Static Member Function. Write a program that demonstrates the Static Data
Member And static member function. (07 marks)
2)
Create a class Account. It has three data member account id, name and balance.
Define function to assign value and display value. Define function that search
account number given by the user. If account number exists, print detail of that
account. Write a program using array of object. Declare at least 5 account and
print details. (07 marks)
3)
Define a class Time with hours and minutes as two data members, add
necessary member functions to initialize and display data of class. Do not use
constructors in a class. Define a member function sum() which adds two Time
objects. Invoke the statements like T3.sum(T1, T2) in main (). (07 marks)
OR
Define a class complex with real and imaginary as two data member, add
necessary constructors and member function to initialize and display data of
class. Class should overload the + operator to add two complex objects and
return the results. Invoke the statements like C3=C1+C2 in main ().(07 marks)

4)
Define Friend Function. Create two classes DM and DB which store the value of
distances. DM stores distances in meters and centimeters and DB in feet and
inches. Write a program that can read values for the class objects and add one
object of DM with another object of DB. Use a friend function to carry out the
addition operation. The object stores the results may a DM object or DB
object, depending on the units in which the results are required. The display
should be in the format of feet and inches or meters and centimeters depending
on the object on display.
1 Feet = 0.3048Meter 1Meter = 3.28 Feet
1 Inch = 2.54 Centimeter 1 Centimeter = 0.3937 Inch (07 marks)

OR
Explain Friend function and its characteristics. Define a class matrix with an
integer array of 3X3 as a data member. Define a friend function which adds
two matrix objects and returns resultant matrix object. (07 makrs)
5)
What is a constructor? Which are the special characteristics of constructor
functions? What is the need of “do-nothing” implicit constructor? When the
destructor function invoked? (07 marks)
6)
What is Constructor? Write the characteristics of constructor function. Define Class named point which represents 2-D Point, i.e P(x, y). Define Default constructor to initialize both data member value 5, Parameterized constructor to initialize member according to value supplied by user and Copy Constructor. Define Necessary Function and Write a program to test class Point. (07 marks)


7)
Define Operator overloading. Create class Time that has three data members
hour, minute and second and two constructor, default constructor and
parameterized constructor to initialize data member. Write a program to add two
times by overloading operator +. (07 marks)
8)
What is Type conversion? Explain Basic to class type conversion with
example. (04 marks)
OR
Explain the type conversion from basic type to class type and from class type
to basic type with proper example. (07 marks)





Chapter 5 : Inheritances
1)
Explain Visibility mode. (Marks :3)
2)
Define Inheritance. Write the types of Inheritance. Explain Inheritance with
Example. Consider Example with respect to print result of Student and Student
Details. (Marks :7)
3)
Explain Virtual base class with example. (Marks :7)



Chapter 6 : Polymorphism
1)
Explain this pointer. (Marks :3)
2)
Explain generic pointer. (Marks :2)
3)
How is Polymorphism achieved at Compile Time and Run Time. (Marks :3)
4)
Define and Discuss Pure Virtual Function. (Marks :2)
5)
How do they differ ? :
char const * ptr (Marks :2)
char * const ptr
6)
Explain pointer to objects. What is this pointer? Write a complete program to
illustrate the use of this pointer. (Marks :7)


7)
Explain Runtime polymorphism. Explain and demonstrate, how virtual
function to achieve runtime polymorphism? (Marks :7)




Chapter 7 : I/O File Management
1)
Write a program that reads a text file and creates another file that is identical
except that every character is in upper case. (Marks :7)
2)
What is a stream? Describe various stream classes for console I/O operations. (Marks :7)
3)
Explain File Pointers and functions for their manipulation. (Marks :7)



Chapter 8 : Templates , Exception and STL
1)
What is Generic Programming? How it is implemented in C++.Write General
format of class templates and function Template. Write program to swap
Number using Function Template. Function prototype is given below:
void swap(int, int , float , float ).
Swap two integer number and swap two float number. (Marks :7)
2)
What is Exception? Explain Exception HandlingMechanism.Write a program
that demonstrates use of multiple catch. Add at least three catch block in your program. (Marks :7)
3)
Explain with the help of an example why templates are used in programming? (Marks :7)
4)
What is an exception? What are the advantages of using exception handling in
a program? Illustrate C++ exception handling mechanism. (Marks :7)




1 comment:

Unknown said...

where is the answer of this question bank ?