C++ MCQ Questions and Answers

Practice Mode
Showing 10 of 93 questions
Q61
The size of following variable is not 4 bytes in 32 bit systems
  • A int
  • B long int
  • C short int
  • D float
Answer: Option C
Q62
Identify the correct statement regarding scope of variables
  • A Global variables are declared in a separate file and accessible from any program.
  • B Local variables are declared inside a function and accessible within the function only.
  • C Global variables are declared inside a function and accessible from anywhere in program.
  • D Local variables are declared in the main body of the program and accessible only from functions.
Answer: Option B
Q63
Find out the error in following block of code. If (x = 100)     Cout << "x is 100";
  • A 100 should be enclosed in quotations
  • B There is no semicolon at the end of first line
  • C Equals to operator mistake
  • D Variable x should not be inside quotation
Answer: Option C
Q64
Looping in a program means
  • A Jumping to the specified branch of program
  • B Repeat the specified lines of code
  • C Both of above
  • D None of above
Answer: Option B
Q65
The difference between while structure and do structure for looping is
  • A In while statement the condition is tested at the end of first iteration
  • B In do structure the condition is tested at the beginning of first iteration
  • C The do structure decides whether to start the loop code or not whereas while statement decides whether to repeat the code or not
  • D In while structure condition is tested before executing statements inside loop whereas in do structure condition is tested before repeating the statements inside loop
Answer: Option D
Q66
Which of the following is not a looping statement in C?
  • A while
  • B until
  • C do
  • D for
Answer: Option B
Q67
Which of the following is not a jump statement in C++?
  • A break
  • B goto
  • C exit
  • D switch
Answer: Option D
Q68
Which of the following is selection statement in C++?
  • A break
  • B goto
  • C exit
  • D switch
Answer: Option D
Q69
The continue statement
  • A resumes the program if it is hanged
  • B resumes the program if it was break was applied
  • C skips the rest of the loop in current iteration
  • D all of above
Answer: Option C
Q70
Consider the following two pieces of codes and choose the best answer Code 1: switch (x) { case  1: cout <<"x is 1"; break; case 2:                 cout <<"x is 2";                 break; default:                 cout <<"value of x unknown"; }   Code 2 If (x==1){                 Cout <<"x is 1";                 } Else if (x==2){                 Cout << "x is 2";                 } Else{                 Cout <<"value of x unknown"; }            
  • A Both of the above code fragments have the same behaviour
  • B Both of the above code fragments produce different effects
  • C The first code produces more results than second
  • D The second code produces more results than first.
Answer: Option A
Questions and Answers for Competitive Exams Various Entrance Test