Filters
Question type

Study Flashcards

The not operator expects a single operand and returns its logical negation, True, if it's false, and False if it's true.

A) True
B) False

Correct Answer

verifed

verified

What statement regarding precedence of operators is accurate?


A) The assignment operator (=) is higher in precedence than exponentiation (**) .
B) The logical conjunction (and) is higher in precedence than the logical negation (not) .
C) The comparison operators (==, !=, , =) are higher in precedence than the assignment operator (=) .
D) The addition and subtraction operators (+, -) are lower in precedence than the logical conjunction operator (and) .

E) All of the above
F) B) and D)

Correct Answer

verifed

verified

4 != 4 evaluates to True.

A) True
B) False

Correct Answer

verifed

verified

What part of the loop comprises the statements to be executed?


A) The loop header.
B) The loop body.
C) The loop end.
D) The loop tail.

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

The Boolean data type is named for the twentieth-century British mathematician George Boole.

A) True
B) False

Correct Answer

verifed

verified

The assignment symbol can be combined with the arithmetic and concatenation operators to provide augmented assignment operations.

A) True
B) False

Correct Answer

verifed

verified

Some computer scientists argue that a while True loop with a delayed exit violates the spirit of the while loop.

A) True
B) False

Correct Answer

verifed

verified

Although the while loop can be complicated to write correctly, it is possible to simplify its structure and thus improve its readability.

A) True
B) False

Correct Answer

verifed

verified

What comparison operator is used to test whether an expression does NOT equal another expression?


A) -=
B) !=
C) /=
D) _=

E) B) and D)
F) B) and C)

Correct Answer

verifed

verified

Given the following statement: "%4d" % var1, which of the following is accurate?


A) The variable var1 must be an integer value.
B) The variable var1 must be a string value.
C) The variable var1 will be in octal format.
D) The variable var1 will be formatted regardless of type.

E) A) and B)
F) C) and D)

Correct Answer

verifed

verified

Conditional iteration requires that a condition be tested within the loop to determine whether the loop should continue.

A) True
B) False

Correct Answer

verifed

verified

The not operator has a lower precedence than the and and or operators.

A) True
B) False

Correct Answer

verifed

verified

What is NOT a Boolean or logical operator used in the Python language?


A) and
B) or
C) not
D) xor

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

The comparison operators are applied after addition but before assignment.

A) True
B) False

Correct Answer

verifed

verified

What function call will generate a random number in the range of 1 through 6 using the random module?


A) random.randnum(1, 6)
B) random.randint(range(1-6) )
C) random.randint(1, 6)
D) random.random(1, 6)

E) A) and C)
F) A) and D)

Correct Answer

verifed

verified

When the step argument is a negative number, the range function generates a sequence of numbers from the first argument down to the second argument plus 1.

A) True
B) False

Correct Answer

verifed

verified

What scenario would it make logical sense to use a multi-way selection statement for?


A) You need to convert numeric grades to letter grades.
B) You need to test if the value of A is larger than B.
C) You need to determine if a number is positive or negative.
D) You need to test if a variable is True or False.

E) B) and D)
F) All of the above

Correct Answer

verifed

verified

The simplest form of selection is the if-else statement.

A) True
B) False

Correct Answer

verifed

verified

What statement should you use to print the value of total with a precision of 5 digits?


A) print("The total is %5." % total)
B) print("The total is %0.5d" % total)
C) print("The total is %f" % float(total, 5) )
D) print("The total is %0.5f" % total)

E) None of the above
F) C) and D)

Correct Answer

verifed

verified

You are running a Python script and suspect that the script has entered an infinite loop. What key combination can you use to halt the loop?


A) CTRL + Esc
B) CTRL + c
C) Alt + b
D) CTRL + Break

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

Showing 21 - 40 of 50

Related Exams

Show Answer