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 definition onward in the program.    
   (B) from the point of definition onward in the function.
   (C) from the point of definition onward in the block.   
   (D) throughout the function.
 
   Ans: C   
 
Q.18   The break statement causes an exit   
                 
        (A) from the innermost loop only.  (B) only from the innermost switch.
        (C) from all loops & switches.  (D) from the innermost loop or switch.
   
  Ans: D
 
Q.19   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
 
Q.20  A property which is not true for classes is that they 
                                 
(A)   are removed from memory when not in use.   
(B)   permit data to be hidden from other classes.
(C)   bring together all aspects of an entity in one place.  
(D)   Can closely model objects in the real world.
     
   Ans: C
 
Q.21  You can read input that consists of multiple lines of text using
 
(A)   the normal cout << combination.  
(B)   the cin.get( ) function with one argument.
(C)   the cin.get( ) function with two arguments.  
(D)   the cin.get( ) function with three arguments.
 
   Ans: C
 
Q.22   The keyword friend does not appear in 
 
(A)   the class allowing access to another class.   
(B)   the class desiring access to another class.
(C)   the private section of a class.  
(D)   the public section of a class.
 
   Ans: C
 
Q.23   The process of building new classes from existing one is called

(A)  Structure.  (B)  Inheritance.
(C)  Polymorphism.  (D)  Template.
 
   Ans: B
 
Q.24  If you wanted to sort many large objects or structures, it would be most efficient to
 
    
(A)    place them in an array & sort the array.   
(B)    place pointers to them in an array & sort the array.
(C)    place them in a linked list and sort the linked list.  
(D)    place references to them in an array and sort the array.
   
   Ans: C
 
Q.25   Which statement gets affected when i++ is changed to ++i?
   
   (A) i = 20; i++;    
   (B) for (i = 0; i<20; i++) { }
   (C) a = i++;  
   (D) while (i++ = 20) cout <<i;
 
   Ans: A
 
Q.26   A friend function to a class, C cannot access 
                   
    (A) private data members and member functions.
    (B) public data members and member functions.
    (C) protected data members and member functions.  
    (D) the data members of the derived class of C.
   
  Ans: D
 
Q.27  The operator that cannot be overloaded is  
 
(A)  ++  (B) ::
(C)  ( )  (D) ~  
 
   Ans: B   
 
Q.28   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
 
Q.29  Pure virtual functions
 
(A) have to be redefined in the inherited class.   
(B) cannot have public access specification.
(C) are mandatory for a virtual class.  
(D) None of the above.
 
   Ans: A
 
Q.30  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