ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 277 - PT0-002 discussion

Report
Export

Given the following script:

while True:

print ("Hello World")

Which of the following describes True?

A.
A while loop
Answers
A.
A while loop
B.
A conditional
Answers
B.
A conditional
C.
A Boolean operator
Answers
C.
A Boolean operator
D.
An arithmetic operator
Answers
D.
An arithmetic operator
Suggested answer: C

Explanation:

True is a Boolean operator in Python, which is an operator that returns either True or False values based on logical conditions. Boolean operators can be used in expressions or statements that evaluate to True or False values, such as comparisons, assignments, or loops. In the code, True is used as the condition for a while loop, which is a loop that repeats a block of code as long as the condition is True. The code will print "Hello World" indefinitely because True will always be True and the loop will never end. The other options are not valid descriptions of True.

asked 02/10/2024
Mk Cheng
43 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first