Infosys C++ MCQs

Infosys C++ MCQs

Our experts have gathered these XInfosys C++ MCQs through research, and we hope that you will be able to see how much knowledge base you have for the subject of Infosys C++ by answering these multiple-choice questions.
Get started now by scrolling down!

1: Every statement in C++ program should end with

A.   A full stop (.)

B.   A Comma (,)

C.   A Semicolon (;)

D.   A colon (:)

2: Which of the following is output statement in C++?

A.   Print

B.   Write

C.   Cout

D.   Cin

3: Which of the following is input statement in C++?

A.   Cin

B.   Input

C.   Get

D.   None of above

4: By default, the standard input device for C++ program is

A.   Keyboard

B.   Mouse

C.   Scanner

D.   None of these

5: The built-in library function ceil(x) requires the header file

A.  

B.  

C.  

D.  

6: What punctuation ends most lines of C++ code?

A.   (dot)

B.   (semi-colon)

C.   (colon)

D.   (single quote

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

A.   Start()

B.   Begin()

C.   Main()

D.   Output()

8: What punctuation must use to end the code C/C++ expression statement?

A.   .(dot)

B.   ;(semi-colon)

C.   :(colon)

D.   '(single quote)

9: Which one of the following is not a correct variable type in C++ programs?

A.   Float

B.   Real

C.   Int

D.   Double

10: Which of the following comments about the "++" operator are correct?

A.   It is a unary operator

B.   It cannot be applied to an expression.

C.   It associates from the right.

D.   All of the above

11:

What is the output of the following code snippet?


class test {

public:

static int n;

test () { n++; };

~test () { n--; };

};


int test::n=0;

int main () {

test a;

test b[5];

test * c = new test;

cout << a.n << endl;

delete c;

cout << test::n << endl;

return 0;

}


A.  

7 6 

B.  

6 7 

C.  

5 6

D.  

6 5  

12: In a group of nested loops, which loop is executed the most number of times?

A.   The outermost loop

B.   The innermost loop

C.   All loops are executed the same number of times

D.   Cannot be determined without knowing the size of the loops

13: How do we define a constructor?

A.   X~() {}

B.   X() {}~

C.   X() ~{}

D.   X() {}

14: Which of the following correctly describes C++ language?

A.   Statically typed language

B.   Dynamically typed language

C.   Both Statically and dynamically typed language

D.   Type-less language

15: Which of the following correctly describes the meaning of 'namespace' feature in C++?

A.   Namespaces refer to the memory space allocated for names used in a program

B.   Namespaces refer to space between teh names in a program

C.   Namespaces refer to space between the names in a program

D.   Namespaces provide facilities for organizing the names in a program to avoid name clashes