C++ MCQs with answers Page - 67

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. What is the output of following c++ program?

Code:
{
int a = 5;
int b = 10;
cout << (a>b?a:b);
}
  • (A) 5
  • (B) 10
  • (C) Syntax error
  • (D) None of these

A

Admin • 833.24K Points
Coach

Q. How to declare a wide character in the string literal?

  • (A) l prefix
  • (B) W prefix
  • (C) L prefix
  • (D) All of above

A

Admin • 833.24K Points
Coach

Q. The difference between P and ‘P’ is

  • (A) The first one is a character constant P and the second one is the string literal P
  • (B) The first one refers to a variable whose identifier is P and the second one refers to the character constant P
  • (C) Both are same
  • (D) None of these

A

Admin • 833.24K Points
Coach

Q. Regarding the following statement which of the statements is true?

Code:
const int num = 20;
  • (A) Constructs an integer type variable with an as identifier and 20 as the value
  • (B) Declares a variable num with 20 as its initial value
  • (C) Declares a construction num with 20 as its initial value
  • (D) Declares a constant num whose value will be 20

A

Admin • 833.24K Points
Coach

Q. Which of the following statement is not true about preprocessor directives?

  • (A) These must be written on their own line
  • (B) They end with a semicolon
  • (C) These are lines read and processed by the preprocessor
  • (D) They do not produce any code by themselves

A

Admin • 833.24K Points
Coach

Q. What is the output of this program?

Code:
#include 
    using namespace std;
    #define PI 3.14159
    int main ()
    {
        float radious = 10;
        float Circle;
        Circle = 2 * PI * radious;
        cout << Circle;
        return 0;
    }
  • (A) 10
  • (B) 2
  • (C) Compilation Error
  • (D) 62.8318

A

Admin • 833.24K Points
Coach

Q. What is the output of this program?

Code:
#include 
    using namespace std;
    int main()
    {
        int  const  num = 10;
        cout << ++num;
        return 0;
    }
  • (A) 10
  • (B) Garbage value
  • (C) Compilation Error
  • (D) Runtime Error

A

Admin • 833.24K Points
Coach

Q. The constants are also called as

  • (A) const
  • (B) literals
  • (C) preprocessor
  • (D) All of above

A

Admin • 833.24K Points
Coach

Q. Who invented C++?

  • (A) Dennis Ritchie
  • (B) Ken Thompson
  • (C) Brian Kernighan
  • (D) Bjarne Stroustrup

A

Admin • 833.24K Points
Coach

Q. What is C++?

  • (A) C++ is a procedural programming language
  • (B) C++ is an object oriented programming language
  • (C) C++ is a functional programming language
  • (D) C++ supports both procedural and object oriented programming language

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ