1) Additional information sent when an exception is thrown may be placed in
A. The throw keyword
B. The function that caused the error
C. The catch block
D. An object of the exception class
Ans:- C
2) It is possible to declare as a friend
A. A member function
B. A global function
C. A class
D. All of the above
Ans:- D
3) In a class specifier ,data or function designated private are accessible
A. To any function in the program
B. Only if you the password
C. To member functions of that class
D. Only to public members of the class
Ans:-C
4) What is the output of the following code
char symbol[3]={‘a’,‘b’,‘c’};
for (int index=0; index<3; index++)
cout << symbol [index];
A. a b c
B. “abc”
C. abc
D. ‘abc’
Ans:-C
5) This pointer
A. Implicitly points to an object
B. Can be explicitly used in a class
C. Can be used to return an object
D. All of the above
Ans:- D
6) cfront
A. is the front end of a C compiler
B. is the per-process of a C compiler
C. is a tool that is translated a C++ code to its equivalent C code
D. None of above
Ans:- C
7) A pure virtual function is a virtual function that
A. Has no body
B. Returns nothing
C. Is used in base class
D. Both (A) and (C)
Ans:-D
8) Access to private data
A. Restricted to methods of the same class
B. Restricted to methods of other classes
C. Available to methods of the same class and other classes
D. Not an issue because the program will not compile
Ans:-B
9) What will be the output of the following program?
#include<iostream.h>
void main()
{
float x=5,y=2;
int result;
result=x % y;
cout<<result;
}
A. 1
B. 1.0
C. Error message
D. 2.5
Ans:- C
10) A function call mechanism that passes arguments to a function by passing a copy of the values of the arguments is __________
A. Call by name
B. Call by value
C. Call by reference
D. Call by value result
Ans:- B
11) _________ members of a base class are never accessible to a derived class.
A. Public
B. Private
C. Protected
D. A,B and C
Ans:- B
12) Real world objects contain
A. State and behavior
B. Date and time
C. Data and information
D. None of these
Ans:- A
13) This type of inheritance is a mixture of multiple inheritance and hierarchical inheritance
A. Single inheritance
B. Multiple inheritance
C. Hierarchical inheritance
D. Hybrid inheritance
Ans:- D
14) In access control in a protected derivation, visibility modes will change as follows
A. Private, public and protected become protected
B. Only public becomes protected
C. Public and protected become protected
D. Only private becomes protected
Ans:-C
15) Within a switch statement
A. Continue can be used but Break cannot be used
B. Continue cannot be used but Break can be used
C. Both Continue and Break can be used
D. Neither Continue nor Break can be used
Ans:-B
16) A virtual class is the same as
A. An abstract class
B. A class with a virtual function
C. A base class
D. None of the above
Ans:- D
17) A struct is the same as a class except that
A. There are no member functions
B. All members are public
C. Cannot be used in inheritance hierarchy
D. It does have a this pointer
Ans:- C
18) Which of the following cannot be legitimately passed to a function
A. A constant
B. A variable
C. A structure
D. A header file
Ans:- D
19)If x =5, y =2 then x ^y equals________.
(where ^ is a bitwise XOR operator)
A. 00000111
B. 10000010
C. 10100000
D. 11001000
Ans:- A
20) In multiple inheritance
A. The base classes must have only default constructors
B. Cannot have virtual functions
C. Cannot have virtual classes
D. None of the above
Ans:- C
A. The throw keyword
B. The function that caused the error
C. The catch block
D. An object of the exception class
Ans:- C
2) It is possible to declare as a friend
A. A member function
B. A global function
C. A class
D. All of the above
Ans:- D
3) In a class specifier ,data or function designated private are accessible
A. To any function in the program
B. Only if you the password
C. To member functions of that class
D. Only to public members of the class
Ans:-C
4) What is the output of the following code
char symbol[3]={‘a’,‘b’,‘c’};
for (int index=0; index<3; index++)
cout << symbol [index];
A. a b c
B. “abc”
C. abc
D. ‘abc’
Ans:-C
5) This pointer
A. Implicitly points to an object
B. Can be explicitly used in a class
C. Can be used to return an object
D. All of the above
Ans:- D
6) cfront
A. is the front end of a C compiler
B. is the per-process of a C compiler
C. is a tool that is translated a C++ code to its equivalent C code
D. None of above
Ans:- C
7) A pure virtual function is a virtual function that
A. Has no body
B. Returns nothing
C. Is used in base class
D. Both (A) and (C)
Ans:-D
8) Access to private data
A. Restricted to methods of the same class
B. Restricted to methods of other classes
C. Available to methods of the same class and other classes
D. Not an issue because the program will not compile
Ans:-B
9) What will be the output of the following program?
#include<iostream.h>
void main()
{
float x=5,y=2;
int result;
result=x % y;
cout<<result;
}
A. 1
B. 1.0
C. Error message
D. 2.5
Ans:- C
10) A function call mechanism that passes arguments to a function by passing a copy of the values of the arguments is __________
A. Call by name
B. Call by value
C. Call by reference
D. Call by value result
Ans:- B
11) _________ members of a base class are never accessible to a derived class.
A. Public
B. Private
C. Protected
D. A,B and C
Ans:- B
12) Real world objects contain
A. State and behavior
B. Date and time
C. Data and information
D. None of these
Ans:- A
13) This type of inheritance is a mixture of multiple inheritance and hierarchical inheritance
A. Single inheritance
B. Multiple inheritance
C. Hierarchical inheritance
D. Hybrid inheritance
Ans:- D
14) In access control in a protected derivation, visibility modes will change as follows
A. Private, public and protected become protected
B. Only public becomes protected
C. Public and protected become protected
D. Only private becomes protected
Ans:-C
15) Within a switch statement
A. Continue can be used but Break cannot be used
B. Continue cannot be used but Break can be used
C. Both Continue and Break can be used
D. Neither Continue nor Break can be used
Ans:-B
16) A virtual class is the same as
A. An abstract class
B. A class with a virtual function
C. A base class
D. None of the above
Ans:- D
17) A struct is the same as a class except that
A. There are no member functions
B. All members are public
C. Cannot be used in inheritance hierarchy
D. It does have a this pointer
Ans:- C
18) Which of the following cannot be legitimately passed to a function
A. A constant
B. A variable
C. A structure
D. A header file
Ans:- D
19)If x =5, y =2 then x ^y equals________.
(where ^ is a bitwise XOR operator)
A. 00000111
B. 10000010
C. 10100000
D. 11001000
Ans:- A
20) In multiple inheritance
A. The base classes must have only default constructors
B. Cannot have virtual functions
C. Cannot have virtual classes
D. None of the above
Ans:- C