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
Similar Questions from HTET Exam - Level 3 - Year 2019
Question 1
Easy
Source :
HTET 2019
In HTML the _______ element is used to contain characters that should be sub-script.
Chapter :
Web Designing using HTML
Topic :
HTML Basics
Question 2
Easy
Source :
HTET 2019
Which of the following is empty or void element in HTML?
Chapter :
Web Designing using HTML
Topic :
HTML Elements
Question 3
Easy
Source :
HTET 2019
The keywords private, protected and public may appear _______ in the declaration of a class in C++.
Chapter :
Object-Oriented Programming (C++)
Topic :
Class & Object in C++
Question 4
Easy
Source :
HTET 2019
In HTML Version 5 the ....... element is appropriate for marking up the titles of works of art, music, movies, books etc.
Chapter :
Web Designing using HTML
Topic :
HTML Basics