Online Quiz
  Home   / Quiz   /   CPP (or) C++ Quiz
CPP (or) C++ Quiz

Correct Answer : Option (C) :   0

  Show Answer

Correct Answer : Option (A) :   main()

  Show Answer

Correct Answer : Option (B) :   { }

  Show Answer

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

  Show Answer

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

  Show Answer

Correct Answer : Option (C) :   real

  Show Answer

Correct Answer : Option (B) :   ==

  Show Answer

Correct Answer : Option (B) :   _


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

  Show Answer
 Q .
What is the output of the following program?

#include<iostream>

using namespace std;
main() { 
   int a[] = {1, 2}, *p = a;
   
   cout<<p[1]; 
}​

Correct Answer : Option (B) :   2


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

  Show Answer
 Q .
What is the output of the following program in C++?

#include

using namespace std;
main() {
   short unsigned int i = 0; 
   
   cout<<i--;
}​

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

  Show Answer