Loading...

C++ Multiple Choice Questions

Our C++ questions and answers focuses on all areas of C++ programming language covering 100+ topics in C++

C++ Decision making & Loops MCQ | Set 1

C++ Decision making & Loops | Set 1


1. How many sequences of statements present in C++?

a) 4
b) 3
c) 5
d) 6



2. Decision Control statements in C++ can be implemented using

a) if
b) if-else
c) Conditional Operator
d) All of the above



3. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main() {

    if (0) {
        cout << "Hello" ;
    }
    else 
    {
        cout << "Good Bye" ;
    }
    return 0;
}

a) Hello
b) Good Bye
c) HelloGood bye
d) Compilation Error



4. if you have to make decision based on multiple choices, which of the following is best suited?

a) if
b) if-else
c) if-else-if
d) All of the above



5. Can we use string inside switch statement?

a) Yes
b) No



6. In situations where we need to execute body of the loop before testing the condition, we should use_____.

a) For loop
b) while loop
c) do-while loop
d) nested for loop



7. Loops in C++ Language are implemented using?

a) While loop
b) For loop
c) Do while loop
d) All of the above



8. While loop is faster in C++ Language, for, while or do-while?

a) For
b) while
c) do-while
d) All work ate same speed



9. What is the way to suddenly come out of or quit any loop in C++?

a) continue; statement
b) break; statement
c) leave; statement
d) quit; statement



10. Which of the following can replace a simple if -wlsw construct?

a) Ternary operator
b) while loop
c) do-while loop
d) fop loop



- Related Topics