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