You are on page 1of 4

C++ Question bank

Object oriented Programming


Prepared By: Syed Amidul Islam
UNIT I PART A

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20.

Define the terms : (a) Encapsulation (b). Inheritance. Define data abstraction and abstract data type (ADT). Differentiate data abstraction and encapsulation. What are the different kinds of polymorphism? How is dynamic binding implemented in C++? How do objects interact? Name atleast four OOPS languages other than C++. What are benefits or advantages of OOP? What are the applications of OOP? Give the structure of a C++ program. List the different phases of C++ program execution. Name the operators available in C++ which is not available in C. Define enumeration data type with example. What is a variable in C++? How to form a variable? What are the types of variables in C++ that can have floating point values? Write the range of each type of variable. What are wild pointers? Where do you initialize in a C++ program? (or)What do you mean by dynamic initialization? Define reference variable in C++. What is the need for type conversion. Explain the different types of type conversion with example. What do mean by manipulators? Discuss with examples

PART B

1. 2. 3. 4. 5. 6. 7.

Compare the various programming paradigms. List the difference between OOP and procedural oriented programming. What is the main drawback of structured programming? How OOP address this issue? Explain the basic concepts of OOPS (or) basic characteristics or elements of OOP. How do these make OOPS approach best suited to address real world problems? Explain benefits and applications of OOP. Explain C++ data types and operators in C++ in detail. Explain control structures available in C++ with syntax and examples. Explain the different parameter passing mechanisms in C++ with example.

UNIT II PART A 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. What are the elements (components )of function? What is function prototype? (or) How a function is declared in C++? Write the disadvantages of function and explain how it is overcome by inline functions? (or) What are inline functions ?explain with example? What are their advantages? Differentiate macro and inline function. Explain default arguments with an example. How to map real world entity into object oriented program? (or) Why is an OOP methodology considered to be the better approach for real life problems? What is a class? What are the parts of class specification (or) How are data and functions organized in C++? Explain the ways of defining a member function in a class with example. Explain private member function and nesting of member function with example. Define constant argument with example. Define constant member function with example. What are the merits and demerits of friend function? Define a empty class. Define nameless objects. Define nested classes. Define constant(read only) objects.

PART B 1. Explain the declaration of a class in C++, access specifiers and different ways of defining a member function in a class with example. 2. Explain static data members and static member function with an example program. 3. Explain the need, characteristics and syntax for friend function and friend class with example program. 4. Explain function overloading with example program. 5. Explain how the objects are passed as function arguments and the function return objects with an example program. UNIT III PART A 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. Is the following statements correct? Give reasons. Destructors can be overloaded. There can be any number of constructors. Differentiate between constructor and destructor. Differentiate implicit and explicit call. Explain constructor overloading (or) multiple constructors in a class. Define operator overloading. State the advantages of operator overloading? Write the rules for operator overloading? How will you define operator overloading? (or) Define operator function. Write the characteristics of operator function. Mention few operators which cant be overloaded Mention few operators which cant be overloaded by friend functions. Mention few operators which cant be overloaded by member functions. Differentiate overloaded and overridden functions.

PART B

1.

Explain the different types of constructors and destructors with an example program (or) What is the need for parameterized constructors? Explain the function of constructors with their declaration and definition? 2. Write a C++ program to add two amounts maintained in rupees and paisa using pass by reference method. The function should take objects as arguments and should return objects. Use constructors for initializing data members. 3. Write a C++ program to add two times maintained in hours and minutes using pass by value method. The function should take objects as arguments. Use constructors for initializing data members. 4. Write a C++ program to add two distances maintained in feet and inches using pass by address method. The function should take objects as arguments and should return objects. . Use constructors for initializing data members. 5. Write a C++ program to add two complex numbers using pass by value method. The function should take objects as arguments and should return objects. Use constructors for initializing data members. 6. Explain unary and binary operator overloading with example program. 7. Explain insertion and extraction operator overloading with example program. 8. Explain the various types of data conversion with example program.

UNIT IV PART A

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14.

Define inheritance(class derivation). State the features and advantages and syntax of inheritance. Name the visibility modes in inheritance (or) Give the three possible styles of derivation in inheritance State the different types(forms) of inheritance. Define the term code reusability. How the base class members behave when inherited in pubic visibility mode, private visibility mode, protected visibility mode (or) Differentiate three types of derivation? Define virtual base class(multipath inheritance). Explain containership(has a relationship or object composition) and delegation? How dynamic binding implemented in C++? (or) What is meant by virtual function ? Define pure virtual function(do-nothing or dummy function). Define abstract (base) class and write the purpose of it and concrete class. State the member dereferencing operators with its purpose. Explain how to create (declare) pointers for objects, class members and derived classes with example. Define this pointer with example. Explain virtual destructors with example.

PART B
1. 2. 3. 4. 5. 6. Explain inheritance, its types with syntax and example program. Explain each type separately. Explain the role of constructors with reference to inheritance. Provide a suitable example. Explain multi path inheritance (or) virtual base classes with an example program. Explain the need of virtual function. Explain its usage with an example program. Write notes on memory management(free store) operators.

UNIT V PART A
1. 2. What is a stream? State different types of streams? (or) What is an I/O stream? List the stream objects that are created by default. (or) What are the streams opened automatically before the execution of main() function and closed after main() has completed? (or) What are the predefined console streams provided by C++? 3. What are the classes in iostream.h header file? 4. Explain with example unformatted I/O operations provided by console stream classes. (or) What is the purpose of put ( ) function, get ( ) function, getLine( ) function, say with example program. 5. What are the classes in fstream.h header file? 6. Give the methods to open a file in C++ with syntax 7. Give the modes & its meaning by which a file can be opened. 8. Explain the use of any 4 functions related to file operations in C++? 9. List the errors to be handled during file operations. 10. List the functions provided by C++ to handle the errors during file operations. 11. What is file pointer? Explain different types of file pointers?

PART B
1. 2. 3. 4. 5. 6. 7. 8. Explain the concept of streams in C++ and give the hierarchy of different types of stream? (or) Draw the stream class hierarchy. Mark the classes defined in iostream.h and fstream.h file. Describe the(hierarchy of) stream classes for file operations. Explain with example various formatted console I/O operations provided by stream classes for console operations (ios class functions, Std. Manipulators, User defined Manipulators) Describe the (hierarchy of) stream classes for file operations. What is file pointer? Explain the default actions of different types of file pointers? Explain the manipulations of file pointer with example. Write a C++ file program to store the details of 10 students .Get inputs from user (name,m1,m2,m3).Find total & average and store it in a file called studin.dat. Write a C++ program using function template for sorting an array(assume for float array and int array). Write a C++ file program to store the details of employee in a file called emp.dat (empno, empname., deptno, salary). Read the contents of file emp.dat and if deptno =10 increment salary by 10% and store the new salary along with empname, empno and deptno in a new file called sal.dat.

You might also like