Page 73 - Information_Practice_Fliipbook_Class11
P. 73
9. input is a valid token. __________
10. Print is a valid identifier. __________
C. Fill in the blanks.
1. The smallest unit of a program is known as a ____________.
2. ____________ are reserved words that have a specific meaning for the interpreter.
3. Invoking the function ____________ prompts the user to enter data.
4. ____________ are included in a program to make it readable, but they are ignored by the interpreter.
5. The user input received in response to invoking the function input() in a program is terminated by pressing the
____________ key.
6. If no value of sep is specified, the default value of the separator (between the values) used by the print() function is
____________.
7. The input() function returns the data entered by the user as a ____________.
D. Answer the following questions:
1. Which of the following cannot be used as identifiers in Python? Justify your answer.
True, 10on10, My Book, wrong_answer, first-name
Ans. True a keyword
10on10 begins with a digit
My Book contains space
First-name contains a hyphen(-)
2. In the expression, 5*10, identify the operator(s) and operand(s).
Ans. Operator: *
Operands: 5 and 10
3. Write the output that will be produced when the following instructions are executed using Python interpreter:
(i) >>> 12 + 30
Ans. 42
(ii) >>> "large" + "Box"
Ans. 'largeBox'
(iii) >>> "15" + "15"
Ans. '1515'
(iv) >>> "20" + 20
Ans. Error
(v) >>> 60.5 + 40.45
Ans. 100.95
4. Find the error in the code given below:
radius = 5
area = pi * radius * radius
print(area)
Ans. The name pi is not defined, so it cannot be used in the formula.
5. What will be the output produced on the execution of the following instructions by the Python interpreter?
>>> m1, m2, m3 = 10, 20, 30
>>> print(m1 + m2, m3 - m1, m2 * m3, sep = '***')
>>> print(m1 + m2, m3 - m1, m2 * m3, sep = '***')
Ans. 30***20***600
30***20***600
Basics of Python Programming 59

