Multiple Choice Identify the
choice that best completes the statement or answers the question.
|
|
1.
|
What is the output of the following code?
while 4 = =
4: print(‘4’)
a. | 4 is printed infinitely until the program closes | c. | 4 is printed
once | b. | 4 is printed four times | d. | Syntax error |
|
|
2.
|
Which of the following statements is true?
a. | the break statement terminates the loop containing it | c. | All of the
above. | b. | the continue statement is used to skip the rest of the code inside the
loop | d. | the break and continue
statements are almost always used with the if, if...else, and if...elif...else
statements. |
|
|
3.
|
What is used to define a body of a loop?
a. | curly braces | c. | quotation | b. | indentation | d. | parenthesis |
|
|
4.
|
What will be printed with the following print statement?
print(“2 +
2”)
|
|
5.
|
What is used to take input from the user in Python?
a. | < > | c. | input( ) | b. | scan( ) | d. | print( ) |
|
|
6.
|
What is used to concatenate two strings in Python?
a. | + operator | c. | # operator | b. | ^ operator | d. | , operator |
|
|
7.
|
Which of the following is correct?
a. | Reserved words such as break can be used as a variable name | c. | A variable name can
have symbols like: @, # | b. | A variable name must start with a
letter | d. | A variable name can
start with a digit |
|
|
8.
|
In the following code, the variable num is a ____?
num =
“5”
a. | string | c. | boolean | b. | float | d. | integer |
|
|
9.
|
The if..elif..else executes only one block of code among several
blocks.
a. | It depends on expression used. | c. | True | b. | There is no elif
statement in Python | d. | False |
|
|
10.
|
Comments are ignored by the Python interpreter. What symbol is needed at the
beginning of the comment?
|