Professional Documents
Culture Documents
A. 14
18. int max( void );
Identify above function type according to the prototype (declaration) of function.
A. return type with no argument
19. Consider the following code:
int a=10, b=20, c;
c = addition(a,b);
in above code identify the parameters passing techniques of function.
A. Call by value
20. What is polymorphism?
A. Polymorphism means that same code of operations or objects behave differently in different
instances.
21. Give an example of polymorphism.
A.
Example: Suppose if you are in class room that time you behave like a student, when you are
in market at that time you behave like a customer, when you are at your home at that time you
behave like a son or daughter, here one person have different-different behaviours.
So this is polymorphism in that same code of operations behaves differently in different
instances.
38. A member declared as a protected is accessible by the member functions within its class
and ______________
A. It’s derived class
39. Which operators are used to allocate and de-allocate the memory run-time?
A. new operator is used to allocate memory and delete operator is used to de-allocate the memory
40. A static member function can be called using the class name. True or False?
A. True
41. When one class is derived from two or more class is called _________ inheritance.
A. Multiple Inheritance
42. What is hybrid inheritance?
A. A combination of hierarchical and multiple inheritances or a combination of two or more types
of inheritance is called hybrid inheritance.
43. What is the return type of destructor?
A. Destructor has no return type.
44. STL stands for __________________.
A. Standard Template Library
45. A file can be open with help of ______________ or _____________
A. Constructor or fopen( ) function
46. What is reference variable?
A. A reference provides an alias (alternative name) for a previously defined variable.
47. A template function cannot be overloaded. True or false?
A. False
48. The member of class in C++ is by default __________.
A. Private
49. How protected keyword is useful?
A. Protected keyword is useful for accessing members of base class in derived class.
50. In C++, the string literal “C++” occupies exactly _________ of memory.
A. 4 bytes
51. What is inheritance?
A. Creating a new class from the existing class is called inheritance.
52. What is the difference between get( ) and getline( ) function?
A. get( ) function is used to get a single character while getline( ) function get a line of string.
53. What is exception handling?
A. Exception handling is a mechanism provided by the C++ to handle run-time error.
54. What are the C++ stream classes?
A. C++ provides many classes that work with console and file operations. These classes are
called stream classes. i.e. ios, istream, ostream, iostream, etc are the C++ stream classes.
55. What are the modes of files used in file program?
A.
In order to open a file with a stream object open( ) function is used.
Syntax: open (filename, mode) ;
Where file name is sequence of characters that represents the file name to be opened and
mode is an optional parameter with a combination of the following flags:
ios :: ate ios :: app ios :: in ios :: out ios :: trunc, etc.
56. Which classes are used to create input stream and output stream of file in C++?
A. ifstream class and ofstream class
cout.fill('*') ;
cout.setf ( ios : : left, ios : : adjustfield) ;
cout.width(20):
cout << "I/O Operations";
A. I/O Operations******
64. ifstream and ofstream classes are derived from _________ class
A. fstream base class
65. Write down the syntax to create generic type using template.
A. template <class generic_type>
66. Run-time polymorphism is achieved by _______ function.
A. Virtual
67. A pure virtual function can never have a body. True or False?
A. True
68. RTTI stands for _________________.
A. Run Time Type Identification
69. Early binding is also known by the term ___________________.
A. Compile time polymorphism
70. resetiosflags() manipulator is equivalent to which ios function?
A. unsetf ( ) function
2 MARKs QUESTIONs
1. Polymorphism
2. Encapsulation
3. Inheritance
4. Abstraction
5. Extraction operator
6. Insertion operator
7. Cascading of I/O operators
8. Dynamic initialization of variable
9. Reference variable
10. Scope resolution operator
11. Member dereferencing operator
12. New
13. Delete
14. Const arguments
15. Class
16. Object
17. Private
18. Public
19. Object as function argument
20. Returning object from function
21. Pointer to object
22. Pointer to data member
23. Default constructor
24. Copy constructor
25. Parameterized constructor
26. Destructor
27. List out operators which cannot be overloaded
28. List out types of inheritance available in C++
29. Protected
30. Virtual Base Class (Only definition)
31. Abstract Class
32. this pointer
33. put()
34. get()
35. width()
36. precision()
37. fill()
38. unsetf()
39. setw()
40. setprecision()
41. setfill()
42. resetiosflags()
43. ios::adjustfield
44. ios::floatfield
45. ios::basefield
46. ios::showbase
47. ios::showpos
48. ios::showpoint
49. ios::uppercase
50. seekg and seekp
51. tellg and tellp
52. eof()
53. fail()
54. bad()
55. good()
56. Define template (only definition)
57. Exception (definition)
58. try
59. catch
60. throw
3 MARKs QUESTIONs
5 MARKs QUESTIONs