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-16

    Q.91   What will be the result of the expression 13 & 25? (A) 38  (B)  25 (C)  9  (D)  12      Ans:C  Q.92   Which of the following operator can be overloaded through friend function? (A)  ->   (B)  = (C)  ( )   (D)  *        Ans:D   Q.93  To access the public function…

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

    Question 1 Identify the correct statement a. Programmer can use comments to include short explanations within the source code itself. b. All lines beginning with two slash signs are considered comments. c. Comments very important effect on the behaviour of the program d. both   Question 2 The directives for the preprocessors begin with a.   …

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

Leave a Reply

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