Latest Updates :

Thursday, February 25, 2021

MCQ Control Statements in C++

1. How many loops are there in C++
(A) 2
(B) 3
(C) 4
(D) 1

Ans: B

2. What is correct syntax of for loop?
(A) for(initialization;condition;increment/decrement) {   }
(B) for(increment/decrement;initialization;condition) { }
(C) for(initialization,condition,increment/decrement {   }
(D) None of These

Ans: A

3. Can a for loop contain another for loop?
(A) No
(B) Yes
(C) CompilationError
(D) Runtime Error

Ans: B  (Explanation Nested for loop)

4. What is size of void data types in C++?
(A) 2Bytes
(B) 4Bytes
(C) Undefined
(D) 0

Ans: D

5. Which one is NOT a looping statement:
(A) For
(B) Do…While
(C) If
(D) While

Ans: C

6. A process of repeating the body statements is called ...
(A) Branching
(B) Looping
(C) Flowcharting
(D) Algorithm

Ans: B

7. How many times GGSSS Badshahpur is printed?

int main()
{
    int i=0;
    if(i< = 5)
    {
         cout<<" GGSSS Badshahpur ";
         i++;
    }
return 0;

}

(A) Error
(B) 5times
(C) 4times
(D) 6 times

Ans: Try Yourself

8. Loops in C++ Language are implemented using.?
A) While Block
B) For Block
C) Do While Block
D) All the above

Ans   D

9. Choose correct  C++  while loop syntax.
A) 
while(condition)
{
    //statements
}
B) 
{
    //statements
}while(condition)
C) 
while(condition);
{
    //statements
}
D) 
while()
{
    if(condition)
    {
        //statements
    }
}

Answer   A

10.  What is the output of C++ Program segment.? If condition is true
    while(condition)    
    {
        cout<<"JAI HIND";
        break;
    }
    
A) JAI HIND
B) JAI HIND is printed unlimited number of times.
C) No output
D) Compiler error.
Ans  A

0 comments:

Post a Comment