C++ MCQ-12

Q.1   The address of a variable temp of type float is     
    (A) *temp  (B) &temp
    (C) float& temp  (D) float temp&
 
  Ans: B
 
Q.2   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
 
Q.3   The process of building new classes from existing one is called ______.
(A)  Polymorphism  (B) Structure
(C)  Inheritance  (D) Cascading
 
  Ans: C
 
Q.4   If a class C is derived from class B, which is derived from class A, all through public inheritance, then a class C member function can access   
                               
(A)   protected and public data only in C and B.  
(B)   protected and public data only in C.  
(C)   private data in A and B.  
(D)   protected data in A and B.
 
   Ans: D
 
Q.5   If the variable count exceeds 100, a single statement that prints ΓÇ£Too manyΓÇ¥ is    

(A)  if (count<100) cout << ΓÇ£Too manyΓÇ¥;   
(B)  if (count>100) cout >> ΓÇ£Too manyΓÇ¥;   
(C)  if (count>100) cout << ΓÇ£Too manyΓÇ¥;   
(D)  None of these.

Ans: C
 
Q.6   Usually a pure virtual function

(A)  has complete function body.
(B)  will never be called.
(C)  will be called only to delete an object.
(D)  is defined only in derived class.
 
   Ans: D
 
Q.7   To perform stream I/O with disk files in C++, you should

(A)   open and close files as in procedural languages.  
(B)  use classes derived from ios.
(C)   use C language library functions to read and write data.  
(D)   include the IOSTREAM.H header file.
 
   Ans: B
 
Q.8   Overloading the function operator 
   
(A)   requires a class with an overloaded operator.
(B)   requires a class with an overloaded [ ] operator.  
(C)   allows you to create objects that act syntactically like functions.
(D)   usually make use of a constructor that takes arguments.
 
  Ans: A
 
Q.9   In C++, the range of signed integer type variable is ________ 
 
     ^=raised to
     (A) 0 to 2^16   (B)  -2^15    to 2^15
     (C) -2^7   to 2&7 (D) 0 to 2^8
 
   Ans: B
 
Q.10   If  2 y,5 x = =  then  y x ?  equals________.

      (where  ?  is a bitwise XOR operator)                    
        (A) 00000111  (B) 10000010
        (C) 10100000  (D) 11001000
   
  Ans: A
 
Q.11   If an array is declared as int a[4] = {3, 0, 1, 2}, then values assigned to a[0] & a[4] will be ________

(A)  3, 2  (B) 0, 2
(C)  3, 0  (D) 0, 4  
 
   Ans: C
   
Q.12   Mechanism of deriving a class from another derived class is known as____ 
                                 
(A) Polymorphism  (B)  Single Inheritance
(C) Multilevel Inheritance  (D)  Message Passing
     
   Ans: C
 
Q.13  RunTime Polymorphism is achieved by ______ 
   
(A)  friend function  (B)  virtual function
(C)  operator overloading  (D)  function overloading
 
  Ans: B
 
Q.14   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
 
Q.15   In C++, dynamic memory allocation is accomplished with the operator ____

(A) new  (B)  this
(C) malloc( )  (D)  delete
 
   Ans: A

Similar Posts

  • 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…

  • C++ MCQ-14

    Q.61  An array element is accessed using (A)  a FIFO approach  (B)  an index number (C)  the operator  (D)  a member name     Ans:B   Q.62   If there is a pointer p to object of a base class and it contains the address of an object of a derived class and both classes contain…

  • C++ MCQ -2

    Question 1: The void specifier is used if a function does not have return type. a.       True b.      False   Question 2: You must specify void in parameters if a function does not have any arguments. a.       True b.      False   Question 3: Type specifier is optional when declaring a function a.       True b.      False…

  • 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 -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-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…

Leave a Reply

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