Question
Easy

How many times 'save trees' will be displayed by C++ loop? do { cout << "save trees"; } while(0);

1
One
2
Two
3
Zero
4
Infinite
Question Details
Time to Solve: 12
Exam: HTET
Level/Paper: Level 3
Chapter: Python Programming Fundamentals
Topic: Control Structures
Correct Answer
Option A
Explanation

The correct option is (1): The C++ code provided uses a do-while loop, a control flow statement characterized by its 'post-test' structure. This means the block of code inside the 'do' section is guaranteed to execute at least one time before the loop's condition, specified in the 'while' parenthesis, is ever evaluated. In this specific code, the statement cout << "save trees"; runs first, immediately displaying the message 'save trees'…Read More