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