PT0-002 Exam QuestionsBrowse all questions from this exam

PT0-002 Exam - Question 272


Given the following script:

Which of the following describes True?

Show Answer
Correct Answer: C

True in Python is a Boolean operator. It represents a Boolean value that can either be True or False. In the given script, the condition for the while loop is set to True, which is a boolean value, causing the loop to execute indefinitely. Therefore, True is not a conditional by itself, it is the value used in the condition of the while loop. It is also not an arithmetic operator, which involves mathematical operations like addition, subtraction, etc.

Discussion

9 comments
Sign in to comment
DRVisionOption: C
Nov 16, 2023

describe true, not the loop

PhillyCheese
Jun 7, 2024

while True means loop forever. The while statement takes an expression and executes the loop body while the expression evaluates to (boolean) "true". True always evaluates to boolean "true" and thus executes the loop body indefinitely.

[Removed]Option: C
Nov 30, 2023

True and False are boolean operators. A condition would be the entire line "While True:".

Big_DreOption: A
Feb 28, 2024

The keyword True is used as the condition for the while loop.

PeteyPeteOption: B
Apr 23, 2024

B is the right answer and I’ve confirmed it with an expert!

AlizadeOption: A
Oct 31, 2023

The answer is A. A while loop.

Nelsito
Nov 2, 2023

Isn't the "True" keyword itself a boolean operator?

ElDirec
Jan 7, 2024

same as you could describe "while true" as a conditional. True is what we are describing, being a boolean, nothing else. Answer C

LiveLaughToasterBathOption: A
Jan 29, 2024

The condition in a while loop can be any boolean-valued expression. From hws.edu

LiveLaughToasterBath
Jan 29, 2024

free code camp: If the condition evaluates to True..... It's a conditional, I change my answer to B.

Cyber_SoterOption: B
Apr 25, 2024

While true is a loop, however True is a conditional of that loop. so I think it's B

Etc_Shadow28000Option: C
Jul 5, 2024

C. A Boolean operator: True is a Boolean value in Python, which is used in the context of the while loop’s condition. Since True always evaluates to True, this creates an infinite loop. A. A while loop: The while keyword indicates the beginning of a while loop, but it does not describe what True is. B. A conditional: While the while loop contains a conditional statement, True itself is not the conditional but rather the value used in the conditional expression. D. An arithmetic operator: Arithmetic operators include symbols like +, -, *, and /, which are used for mathematical operations. True is not an arithmetic operator.

FasterN8Option: B
Jul 14, 2024

'True' is a boolean value, can't be a Boolean Operator, those are well defined as (AND, OR, XOR, etc.). In this case, "True" is also the entirety of the conditional expression that is expected by the while loop. As it so happens, this expression always returns the same value (True).