Q. Who created C++?

  • (A) Rasmus Lerdorf
  • (B) Bjarne Stroustrup
  • (C) James Gosling
  • (D) Ken Thompson
πŸ’¬ Discuss
βœ… Correct Answer: (B) Bjarne Stroustrup

Q. What is the output of the following C++ program?

Code:
#include <iostream>
using namespace std;
int main()
{
  int n1 = 10;
  float n2 = 10;
  cout << sizeof(n1 + n2);
 return 0;
}
  • (A) 2
  • (B) 4
  • (C) 6
  • (D) 8
πŸ’¬ Discuss
βœ… Correct Answer: (B) 4

Q. Which of the following escape sequences represents a tab?

  • (A) \a
  • (B) \r
  • (C) \t \r
  • (D) \t
πŸ’¬ Discuss
βœ… Correct Answer: (D) \t

Q. Members of the class can be declared with auto, extern or register storage classes.

  • (A) True
  • (B) False
  • (C) Either A or B
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (B) False

Q. C structure differs from CPP class in regards that by default all the members of the structure are __________ in nature.

  • (A) private
  • (B) protected
  • (C) public
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (C) public

Q. Which of the following best defines the syntax for template function ?

  • (A) Template
  • (B) Template return_type Function_Name(Parameters)
  • (C) Both a and b
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (C) Both a and b

Q. Generic pointers can be declared with__________ .

  • (A) auto
  • (B) void
  • (C) asm
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (B) void

Q. Which of the followings are true about constructors?

1. A class can have more than one constructor.
2. They can be inherited.
3. Their address can be referred.
4. Constructors cannot be declared in protected section of the class.
5. Constructors cannot return values.

  • (A) Only 1,2,4
  • (B) 1,2,4,5
  • (C) 1,3,5
  • (D) 1,4,5
πŸ’¬ Discuss
βœ… Correct Answer: (D) 1,4,5

Q. Which of the following escape sequence represents the carriage return?

  • (A) \r
  • (B) \n
  • (C) \n \r
  • (D) \t
πŸ’¬ Discuss
βœ… Correct Answer: (A) \r

Q. Which of the following used to write a comment in C++?

  • (A) * comment */
  • (B) Both are comments // comment 1 or /* comment 2 */
  • (C) // comment
  • (D) // comment */
πŸ’¬ Discuss
βœ… Correct Answer: (B) Both are comments // comment 1 or /* comment 2 */