C++ programming language
41. Usually a pure virtual function
- has complete function body.
- will never be called.
- will be called only to delete an object.
- is defined only in derived class.
Correct answer: (D)
is defined only in derived class.
42. What is the output of the following code char symbol[3]={,a',b',,c'}; for (int index=0; index<3; index++) cout <#60;< symbol [index];
- a b c
- 'abc'
- abc
- abc'
43. Which of the following cannot be legitimately passed to a function
- A constant.
- A variable.
- A structure.
- A header file.
Correct answer: (D)
A header file.
44. Which of the following is false for cin?
- It represents standard input.
- It is an object of istream class.
- It is a class of which stream is an object.
- Using cin the data can be read from user's terminal.
Correct answer: (C)
It is a class of which stream is an object.
45. Which of the following statements is NOT valid about operator overloading?
- Only existing operators can be overloaded.
- Overloaded operator must have at least one operand of its class type.
- The overloaded operators follow the syntax rules of the original operator.
- none of the above.
Correct answer: (D)
none of the above.
46. Which of the statements is true in a protected derivation of a derived class from a base class?
- Private members of the base class become protected members of the derived class
- Protected members of the base class become public members of the derived class
- Public members of the base class become protected members of the derived class
- Protected derivation does not affect private and protected members of the derived class.
Correct answer: (C)
Public members of the base class become protected members of the derived class
47. Which statement gets affected when i++ is changed to ++i?
- i = 20; i++;
- for (i = 0; i<20; i++) { }
- a = i++;
- while (i++ = 20) cout <<i;
Correct answer: (A)
i = 20; i++;
48. Within a switch statement
- Continue can be used but Break cannot be used
- Continue cannot be used but Break can be used
- Both Continue and Break can be used
- Neither Continue nor Break can be used
Correct answer: (B)
Continue cannot be used but Break can be used
49. You can read input that consists of multiple lines of text using
- the normal cout << combination.
- the cin.get( ) function with one argument.
- the cin.get( ) function with two arguments.
- the cin.get( ) function with three arguments.
Correct answer: (C)
the cin.get( ) function with two arguments.