CLASS XI-IP
Answer Key - UT-1 exam - 2020-21
NOTE – Theory answers can be searched in book.
Q. Convert 2.5GB into bytes
(2.5 x 1024 x 1024 x 1024) Bytes
GB -> MB -> KB -> Byte
Q. Write output of following
i. print(“kv\nnepa”)
kv
nepa
ii. x, x=12,15
y, y=x+10,x+20
print(x, y)
x = 15, y = 35
iii. print(4/2)
2.0
Q. write name of function to find datatype of a variable x.
type()
Q. write a program to input a number form user and find its square.
num = int(input(“Enter a Number”))
sqr = num*num
print(“Square of “, num, ” is “, sqr)
Q. Q. Convert into python expression
Q - A
(B+P)8
Q – A/((B+P)**8)
or
Q - A/math.pow((B+P),8)
Q. Write a program to obtain x, y, z from user and calculate 4x2 + 3y3 + 9z + 18
import math
x = int(input(“Enter value of x”))
y = int(input(“Enter value of y”))
z = int(input(“Enter value of z”))
res = 4*(x**2) + 3*(y**3) + 9*z + 18*math.pi
print(res)
Q. Given a list iterate it and display numbers which are divisible by 5 and if you find number greater than 150 stop the loop iteration
list1 = [12, 15, 32, 42, 55, 75, 122, 132, 150, 180, 200]
Expected output:
15
55
75
150
list1 = [12, 15, 32, 42, 55, 75, 122, 132, 150, 180, 200]
for i in list1:
if(i>150):
break
if(i%5 == 0):
print(i)
Q. Q. Write a program to Reverse the following list using for loop
list1 = [10, 20, 30, 40, 50]
Expected output:
50
40
30
20
10
list1 = [10, 20, 30, 40, 50]
for i in range(len(list1)-1, -1 , -1):
print(list1[i])
Q. Q. Write a program to Accept number from user and calculate the sum of all number between 1 and given number
For example user given 10 so the output should be 55
num = int(input(“Enter a NUmber”))
sum = 0
for i in range(1,num+1):
sum = sum + i
print(sum)