Page 195 - Computer Science V2.0 Class 11
P. 195
3. Assertion(A): A tuple is an immutable data type.
Reasoning(R): Once created, the values in a tuple cannot be changed using an assignment operator.
4. Assertion(A): = is an assignment operator.
Reasoning(R): An assignment operator assigns the value of the expression on the right-hand side of the operator to the
operand on the left-hand side of the operator.
5. Assertion(A): Implicit type conversion is also known as coercion.
Reasoning(R): When a data value is converted from one data type to another by the Python interpreter, it is called type
conversion.
Case-based Questions
1. Purvi has started using expressions in her program. She has entered the values of a, b, c, and d as 2, -1, 5, and 3
respectively. Can you tell her what output should she expect on execution of the following code snippet?
value = (a+c)<b or d**a>50
print(value)
2. Rishi wants to accept a two-digit number as input and then print the reversed number. He knows that on dividing the
number by 10, he will get the number at the unit's place as the remainder and the number at ten's place as the quotient.
Help him write a program to complete his task.
3. Raghu has understood the working of all arithmetic operators. His teacher has given him a task to accept as input time in
seconds and then display it in minutes and seconds. For example, if he enters a numeric value 350 (denoting seconds), the
output should be 5 minutes 50 seconds.
4. Sumedha wants to create a program that takes height in feet and inches as inputs and outputs the height in centimetres.
Help her write the program and to view the output.
NCERT Exercise Solutions
1. Which of the following identifier names are invalid and why?
i Serial_no. v Total_Marks
ii 1st_Room vi total-Marks
iii Hundred$ vii _Percentage
iv Total Marks viii True
Ans. i. Serial_no. = invalid as we can’t use '.' in variable names
ii. 1st_Room = invalid as we can’t begin variable names with digits
vi. total-Marks = invalid as '-' is not allowed in variable names
iv. Total Marks = invalid as there are two separate words in the variable name
viii. True = invalid as it is a keyword
2. Write the corresponding Python assignment statements:
a. Assign 10 to variable length and 20 to variable breadth.
b. Assign the average of values of variables length and breadth to a variable sum.
c. Assign a list containing strings 'Paper', 'Gel Pen', and 'Eraser' to a variable stationery.
d. Assign the strings 'Mohandas', 'Karamchand', and 'Gandhi' to variables first, middle and last.
e. Assign the concatenated value of string variables first, middle and last to variable fullname. Make sure to incorporate blank
spaces appropriately between different parts of names.
Ans. a. Assign 10 to variable length and 20 to variable breadth.
length = 10
breadth = 20
b. Assign the average of values of variables length and breadth to a variable sum.
sum = (length + breadth)/2
Data Types and Operators 181

