Page 140 - Computer Science Class 11 Without Functions
P. 140
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: TypeError
(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 execution of the following instructions by the Python interpreter?
>>> m1, m2, m3 = 10, 20, 30
>>> print(m1 + m2, m3 - m1, m2 * m3, sep = '***')
Ans: 30***20***600
6. What will be the output produced on execution of the following instructions by the Python interpreter?
>>> #Play with the argument: end
>>> m1, m2, m3 = 10, 20, 30
>>> print(m1 + m2, m3 - m1, m2 * m3, end = '***')
Ans: 30 20 600***
7. Write a statement in Python to assign the value 16 to the variable age and to assign the value 'Kolkata' to the variable city.
Ans: age = 16
city = 'Kolkata'
8. What will be the output produced on the execution of the following code segment in Python?
num1 = num2 = 50
Num2 = 100
print(num1, num2)
Ans: 50 50
9. What will be the output produced on the execution of the following code segment in Python?
num1 = num2 = 50
num2 = 100
print(num1, num2)
Ans: 50 100
138 Touchpad Computer Science-XI

