C++ MCQs with answers Page - 15

Here, you will find a collection of MCQ questions on C++. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833.24K Points
Coach

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

  • (A) a
  • (B)
  • (C)
  • (D)

A

Admin • 833.24K Points
Coach

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

A

Admin • 833.24K Points
Coach

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

A

Admin • 833.24K Points
Coach

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

A

Admin • 833.24K Points
Coach

Q. Generic pointers can be declared with__________ .

  • (A) auto
  • (B) void
  • (C) asm
  • (D) None of these

A

Admin • 833.24K Points
Coach

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

A

Admin • 833.24K Points
Coach

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

  • (A)
  • (B)
  • (C)
  • (D)

A

Admin • 833.24K Points
Coach

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 */

A

Admin • 833.24K Points
Coach

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

Code:
#include <iostream>
using namespace std;
int main()
{
  cout << sizeof(char);
  cout << sizeof(int);
  cout << sizeof(float);
  return 0;
}
  • (A) 1 8 8
  • (B) 1 4 8
  • (C) 1 4 4
  • (D) None of the above

A

Admin • 833.24K Points
Coach

Q. Which function is used to read a single character in the console in C++?

  • (A) scanf(c)
  • (B) read(c)
  • (C) getline(c)
  • (D) cin.get(c)