In catalog << Learn C++ << Learn C++ << (5) Conditional Statement << Quiz on conditionals << 5th question.
Operators are used wrong for printing in C++ in lines 10 and 14. According to the question, the answer should be a compilation error but there is no such option in the options. Instead of a compilation error, it’s showing " a is greater. a is positive. Program ends" which is not possible because of the use of a single less than symbol for cout function.
All options are not wrong.
The correct answer is a is greater. a is positive . Program ends
They have used the wrong operator, the operator should be “cout<<” but instead they have used “cout<”. that means it can’t be run successful.
Its a printing mistake in the question
The second option is correct.
It is nested if concept.
In above code, both if conditions are satisfying the given condition, so both are correct .
As both are satisfying then there is no need to check for else part. Hence 2 option is correct.
