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.    Ampersand symbol (&Wink

b.    Two Slashes (//)

c.    Number Sign (#)

d.    Less than symbol (<Wink

 
Question 3

The file iostream includes

a.    The declarations of the basic standard input-output library.

b.    The streams of includes and outputs of program effect.

c.    Both of these

d.    None of these

 
Question 4

There is a unique function in C++ program by where all C++ programs start their execution

a.    Start()

b.    Begin()

c.    Main()

d.    Output()

 
Question 5

Every function in C++ are followed by

a.    Parameters

b.    Parenthesis

c.    Curly braces

d.    None of these

 
Question 6

Which of the following is false?

a.    Cout represents the standard output stream in c++.

b.    Cout is declared in the iostream standard file

c.    Cout is declared within the std namespace

d.    None of above

 
Question 7

Every statement in C++ program should end with

a.    A full stop (.)

b.    A Comma (,)

c.    A Semicolon (Wink

d.    A colon (Smile

 
Question 8

Which of the following statement is true about preprocessor directives?

a.    These are lines read and processed by the preprocessor

b.    They do not produce any code by themselves

c.    These must be written on their own line

d.    They end with a semicolon

 
Question 9

A block comment can be written by

a.    Starting every line with double slashes (//)

b.    Starting  with /* and ending with */

c.    Starting with //* and ending with *//

d.    Starting with <!- and ending with -!>

 
Question 10

When writing comments you can

a.    Use code and  /* comment on the same line

b.    Use code and // comments on the same line

c.    Use code and //* comments on the same line

d.    Use code and <!- comments on the same line

Answers

Basics of C++ – Objective Questions (MCQs) Set – 2
Multiple Choice Questions (MCQs) – C++ Programming Language
E-mail Print PDF

Following are the multiple choice questions from C++. Please scroll down to check the answers.
Set 2
Questions

 

 

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.    Ampersand symbol (&Wink

b.    Two Slashes (//)

c.    Number Sign (#)

d.    Less than symbol (<Wink

 
Question 3

The file iostream includes

a.    The declarations of the basic standard input-output library.

b.    The streams of includes and outputs of program effect.

c.    Both of these

d.    None of these

 
Question 4

There is a unique function in C++ program by where all C++ programs start their execution

a.    Start()

b.    Begin()

c.    Main()

d.    Output()

 
Question 5

Every function in C++ are followed by

a.    Parameters

b.    Parenthesis

c.    Curly braces

d.    None of these

 
Question 6

Which of the following is false?

a.    Cout represents the standard output stream in c++.

b.    Cout is declared in the iostream standard file

c.    Cout is declared within the std namespace

d.    None of above

 
Question 7

Every statement in C++ program should end with

a.    A full stop (.)

b.    A Comma (,)

c.    A Semicolon (Wink

d.    A colon (Smile

 
Question 8

Which of the following statement is true about preprocessor directives?

a.    These are lines read and processed by the preprocessor

b.    They do not produce any code by themselves

c.    These must be written on their own line

d.    They end with a semicolon

 
Question 9

A block comment can be written by

a.    Starting every line with double slashes (//)

b.    Starting  with /* and ending with */

c.    Starting with //* and ending with *//

d.    Starting with <!- and ending with -!>

 
Question 10

When writing comments you can

a.    Use code and  /* comment on the same line

b.    Use code and // comments on the same line

c.    Use code and //* comments on the same line

d.    Use code and <!- comments on the same line

 
 
Answers

 

1.    b.  All lines beginning with two slash signs are considered comments.

2.    c. Number Sign (#)

3.    a. The declarations of the basic standard input-output library.

4.    c. Main()

5.    b. Parenthesis

6.    d. None of above

7.    c. A semicolon

8.    d. They end with a semicolon

9.    b. Starting  with /* and ending with */

10.    b. Use code and // comments on the same line

Similar Posts

  • C++ MCQ-14

    Q.61  An array element is accessed using (A)  a FIFO approach  (B)  an index number (C)  the operator  (D)  a member name     Ans:B   Q.62   If there is a pointer p to object of a base class and it contains the address of an object of a derived class and both classes contain…

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

    Question 1 In an assignment statement a=b; Which of the following statement is true? a.    The variable a and the variable b are equal. b.    The value of b is assigned to variable a but the later changes on variable b will not effect the value of variable a c.    The value of b is…

  • C++ MCQ -9

    Question 1: A function can not be overloaded only by its return type. a. True b. False   Question 2: A function can be overloaded with a different return type if it has all the parameters same. a. True b. False   Question 3: Inline functions involves some additional overhead in running time. a. True…

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

    Q.16   If we create a file by ΓÇÿifstreamΓÇÖ, then the default mode of the file is _________    (A)  ios :: out  (B)  ios :: in (C)  ios :: app  (D)  ios :: binary     Ans: B   Q.17   A variable defined within a block is visible        (A) from the point of…

Leave a Reply

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