a. 5
b. 4
c. 3
d. 1
The correct option is (a)
Explanation:
There are five sequences of statements. They are Preprocessor directives, Comments, Declarations, Function Declarations, Executable statements.
a. if-else
b. if
c. Conditional Operator
d. All of the above
Show Answer
The correct option is (d)
Explanation:
No Explanation for this Question.
3. What will be the output of the following C++ code?
#include < iostream >
using namespace std;
int main()
{
if (0)
{
cout << “Hello Good morning” ;
}
else
{
cout << “Hello Good Evening” ;
}
return 0;
}
a. Hello Good morning
b. Hello Good Evening
c. Hello Good morning Hello Good Evening
d. Compilation Error
Show Answer
The correct option is (b)
Explanation:
if(0) evaluates to false condition that is why else condition is executed. In C++ programming 0 is false 1 is true.
4. Can we use string inside switch statement ?
a. Yes
b. No
Show Answer
The correct option is (b)
Explanation:
No Explanation for this Question
5. Loops in C++ Programming are implemented using ?
a. Do while loop
b. While loop
c. For loop
d. All of the above
Show Answer
The correct option is (d)
Explanation:
No Explanation for this Question.
6. While loop is faster in C++ Language,do-while, for or while ?
a. while.
b. do-while.
c. For
d. All work with same speed
Show Answer
The correct option is (d)
Explanation:
No Explanation
7. The switch statement is also called as?
a. selective structure.
b. certain structure
c. bitwise structure
d. choosing structure
Show Answer
The correct option is (a)
Explanation:
The switch statement is used to choose the certain code to execute, So it is also called as selective structure.
8. What will be the output of the following C++ code?
#include < iostream >
using namespace std;
int main()
{
int n = 10;
for ( ; ; )
cout << n;
return 0;
}
a. 15.
b. 10
c. infinite times of printing n
d. none of the mentioned
Show Answer
The correct option is (c)
Explanation:
There is not a condition in the for loop, So it will loop continuously.
8. The if…else statement can be replaced by which operator?
a. Conditional operator
b. Multiplicative operator
c. Addition operator
d. Bitwise operator
Show Answer
The correct option is (a)
Explanation:
In the conditional operator, it will predicate the output using the given condition.