How can you combine multiple conditions using the logical OR operator?
A:
||
B:
or
C:
&&
D:
and
Answer:B
The or keyword is used as the logical OR operator to combine multiple conditions in an if statement. At least one of the conditions must be true for the combined condition to be true.
Discuss About this Question.
What does the continue statement do in a loop?
A:
Exits the loop
B:
Skips the remaining code in the loop and moves to the next iteration
C:
Repeats the loop indefinitely
D:
Skips the remaining code and exits the loop
Answer:B
The continue statement is used to skip the remaining code in the current iteration of a loop and move on to the next iteration.
Discuss About this Question.
Which of the following statements is used for handling exceptions?
A:
try-case
B:
for-in
C:
while-break
D:
try-except
Answer:D
The try-except statement is used for exception handling in Python. Code within the try block is executed, and if an exception occurs, it can be caught and handled in the except block.
try:
# code that might raise an exception
except SomeException:
# code to handle the exception
Discuss About this Question.
What does the in keyword check in Python conditional statements?
A:
Object identity
B:
Membership in a sequence or collection
C:
Inequality
D:
Division
Answer:B
The in keyword is used to test if a value is a member of a sequence or collection, such as a list or a string.
Discuss About this Question.
Which comparison operator is used to check for equality?
A:
=
B:
==
C:
===
D:
equals
Answer:B
The double equals (==) operator is used to check if two values are equal in Python.
Discuss About this Question.
Ad Slot (Above Pagination)
Install ExamAdept
Fast access — add this app to your device.
To install on iPhone/iPad: tap Share → Add to Home Screen.
Discuss About this Question.