Basics of C++ - Objective Questions (MCQs) Set - 2

Print

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