Google News
logo
CPP - Quiz(MCQ)
A)
-1
B)
1
C)
0
D)
Programs do not return a value.

Correct Answer : Option (C) :   0

A)
main()
B)
start()
C)
system()
D)
program()

Correct Answer : Option (A) :   main()

A)
( and )
B)
{ }
C)
->
D)
BEGIN and END

Correct Answer : Option (B) :   { }

A)
' (single quote)
B)
" (double quote)
C)
: (colon)
D)
; (semi-colon)

Correct Answer : Option (D) :   ; (semi-colon)

A)
{ Comment }
B)
** Comment **
C)
*/ Comments */
D)
/* Comment */

Correct Answer : Option (D) :   /* Comment */

A)
int
B)
double
C)
real
D)
float

Correct Answer : Option (C) :   real

A)
=
B)
==
C)
:=
D)
equal

Correct Answer : Option (B) :   ==

A)
!
B)
_
C)
@
D)
$

Correct Answer : Option (B) :   _


Explanation : The only permitted special symbol is under score (_) in the identifier.

9 .
What is the output of the following program?

#include<iostream>

using namespace std;
main() { 
   int a[] = {1, 2}, *p = a;
   
   cout<<p[1]; 
}​
A)
1
B)
2
C)
Runtime error
D)
Compile error

Correct Answer : Option (B) :   2


Explaination : as ‘p’ holds the base address then we can access array using ‘p’ just like with ‘a’

10 .
What is the output of the following program in C++?

#include

using namespace std;
main() {
   short unsigned int i = 0; 
   
   cout<<i--;
}​
A)
Zero (0)
B)
32767
C)
65535
D)
Compile error

Correct Answer : Option (A) :   Zero (0)


Explaination : 0, with post decrement operator value of the variable will be considered as the expression’s value and later gets decremented