Question
Easy

In context of C++, consider following loop-statement: while(5) {cout <<"Hello";} Hello will be displayed _______ time(s) by the above loop.

1
Only one
2
Five
3
Zero
4
Infinite
Question Details
Time to Solve: 12
Exam: HTET
Level/Paper: Level 3
Chapter: Object-Oriented Programming (C++)
Topic: Programming in C++ Basics
Correct Answer
Option D
Explanation

The correct option is (4): The concept at the heart of this question is truthiness in C++. A while loop executes as long as its conditional expression evaluates to a non-zero value. In C and C++, any non-zero integer is implicitly treated as true, while the integer 0 is treated as false. In the given statement, while(5), the number 5 is a constant, non-zero value. Since this condition is permanently…Read More

In context of c - HTET Level 3 | Clear Cutoff