Page 197 - Computer Science V2.0 Class 11
P. 197
b. num1, num2 = 2, 6
num1, num2 = num2, num1 + 2
print (num1, num2)
Output: 6,4
c. num1, num2 = 2, 3
num3, num2 = num1, num3 + 1
print (num1, num2, num3)
Output: NameError: name 'num3' is not defined.
6. Which data type will be used to represent the following data values and why?
a. Number of months in a year
b. Resident of Delhi or not
c. Mobile number
d. Pocket money
e. Volume of a sphere
f. Perimeter of a square
g. Name of the student
h. Address of the student
Ans.
DATA VALUES DATA REASON
Number of months in a year Integer Number of months contain only number values (integer).
Resident of Delhi or not Boolean It gives the answer in the form of true and false
Mobile number Integer Mobile number only contain integer number value
Pocket money Float Money can be count as 100rs 50 paisa (100.50)
Volume of a sphere Float The volume can be calculated in the decimal point
Perimeter of a Square Float The perimeter can be calculated in the decimal point
Name of the student String Name is a set of character, hence data type of name of student is string
Address of the student String Address is a set of character, hence data type of address of student is string
7. Give the output of the following when num1 = 4, num2 = 3, num3 = 2
a num1 += num2 + num3
print (num1)
b. num1 = num1 ** (num2 + num3)
print (num1)
c. num1 **= num2 + num3
d. num1 = '5' + '5'
print(num1)
e. print(4.00/(2.0+2.0))
f. num1 = 2+9*((3*12)-8)/10
print(num1)
g. num1 = 24 // 4 // 2
print(num1)
h. num1 = float(10)
print (num1)
i. num1 = int('3.14')
print (num1)
j. print('Bye' == 'BYE')
k. print(10 != 9 and 20 >= 20)
l. print(10 + 6 * 2 ** 2 != 9//4 -3 and 29>= 29/9)
m. print(5 % 10 + 10 < 50 and 29 <= 29)
n. print((0 < 6) or (not(10 == 6) and(10<0)))
Data Types and Operators 183

