C++ MCQ-11

Q.31  Use of virtual functions implies
(A)  overloading.  (B)  overriding.
(C)  static binding.  (D)  dynamic binding.
Ans: D
 
Q.32   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
 
Q.33   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
 
Q.34   Data members which are static

    (A) cannot be assigned a value
    (B) can only be used in static functions
    (C) cannot be defined in a Union  
    (D) can be accessed outside the class
    
  Ans:B
 
Q.35   Which of the following is false for cin?  
 
(A)  It represents standard input.  
(B)  It is an object of istream class.
(C)  It is a class of which stream is an object.  
(D)  Using cin the data can be read from userΓÇÖs terminal.
 
  Ans:C
 
Q.36  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
 
Q.37  In multiple inheritance  

(A)  the base classes must have only default constructors   
(B)  cannot have virtual functions
(C)  can include virtual classes   
(D)  None of the above.
 
  Ans:C

Q.38 Declaration of a pointer reserves memory space  
(A)  for the object.
(B)  for the pointer.
(C)  both for the object and the pointer.
(D)  none of these.
 
   Ans:B
 
Q.39  for (; 😉

(A)  means the test which is done using some expression is always true   
(B)  is not valid
(C)  will loop forever  
(D)  should be written as for( )
 
  Ans:C
 
Q.40   The operator << when overloaded in a class

(A)  must be a member function  (B)  must be a non member function  
(C)  can be both (A) & (B) above  (D)  cannot be overloaded
 
  Ans:C
 
Q.41  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
 
Q.42   Identify the operator that is NOT used with pointers
 
     (A)  ->  (B)  &
     (C)    *  (D)  >> 
 
  Ans:D
 
Q.43   Consider the following statements

          char *ptr;
          ptr = ΓÇ£helloΓÇ¥;
         cout << *ptr;                    
       What will be printed?     
(A)  first letter  (B)  entire string  
(C)  it is a syntax error  (D)  last letter       
   
   Ans:A
 
Q.44  In which case is it mandatory to provide a destructor in a class?
 
(A)  Almost in every class
(B)  Class for which two or more than two objects will be created
(C) Class for which copy constructor is defined  
(D) Class whose objects will be created dynamically
 
  Ans:D
 
Q.45   The members of a class, by default, are  

 (A)  public  (B) protected
 (C)  private  (D)  mandatory to specify  
   
  Ans:C

Similar Posts

  • C++ MCQ-10

    Q.16   If we create a file by ΓÇÿifstreamΓÇÖ, then the default mode of the file is _________    (A)  ios :: out  (B)  ios :: in (C)  ios :: app  (D)  ios :: binary     Ans: B   Q.17   A variable defined within a block is visible        (A) from the point of…

  • C++ MCQ -4

    Question 1:   cin extraction stops execution as soon as it finds any blank space character   a.       true b.      false   Question 2:   Observe the following statements and decide what do they do.   string mystring;   getline(cin, mystring);   a.       reads a line of string from cin into mystring b.      reads a…

  • C++ MCQ-15

    Q.76   Which of the following expressions is illegal? (A)  ( ) 6 10 .  (B)  (false && true) (C)  bool (x) = (bool)10;  (D)  float y = 12.67;       Ans:C   Q.77  The actual source code for implementing a template function is created when   (A) The declaration of function appears. (B) The…

  • C++ MCQ -5

    Question 1 Streams are a.       Abstraction to perform input and output operations in sequential media b.      Abstraction to perform input and output operations in direct access media c.       Objects  where a program can either insert or extract characters to and from it d.      Both a and c   Question 2 Which of the following is…

  • C++ MCQ -1

    Question 1. What is the correct value to return to the operating system upon the successful completion of a program? A. -1 B. 1 C. 0 D. Programs do not return a value.   Question 2. What is the only function all C++ programs must contain? A. start() B. system() C. main() D. program()  …

  • C++ MCQ -7

    Question 1 A variable is/are a.    String that varies during program execution b.    A portion of memory to store a determined value c.    Those numbers that are frequently required in programs d.    None of these   Question 2 Which of the following can not be used as identifiers? a.    Letters b.    Digits c.    Underscores d.   …

Leave a Reply

Your email address will not be published. Required fields are marked *