You are on page 1of 2

End semester examination

IDC101 (Introduction to computers)

Duration: 1 hrs Maximum marks: 20


Name: __________________________ Roll No: ____________
Instructions:
a. All questions are compulsory and each question carries 2 marks.
b. No computing devices should be used during the examination.
c. ‘Error’ could also be an answer. If your write error, explain the reason of ‘Error’.
d. Bold text in the python program is the output of the code. You need to write suitable
python statement to get the output.

A. Conversion of numbers
Q1. a. Convert (7065.10)8 to binary. (111000110101.001)2
b. Convert (1 1101 0110.01)2 into hexadecimal (1D6.4)16
Q2. a. Convert (29.125)10 into binary (11101.001)2
b. Convert (11010011.0101) into decimal (211.3125)10
B. Write the suitable Python statements/outputs
Q3. mlst=[‘a’,’integration’,2,4,[‘earthquake’,5],10]
p=mlst[1][3]
print(p, mlst[4][1]) (MUST include mlst)
Output: ‘e’,5

Q4. mtup=(‘idc101’,’class’,’batch2022’)
print(mtup[-1])
batch2022
mtup.append(‘finish’)
print(mtup)
Error, tuple cannot be modified
Q5. plst=[1,’idc101’,2,9,4,1,7,2,9,’idc101’,7]
pset=set(plst)
print(pset)
{1,2,4,7,9,’idc101’} (order of elements is irrelevant)
pset.add(9)
print(pset)
{1,2,4,7,9,’idc101’} (order of elements is irrelevant)
Q6. xdict=dict(a=10,b=[2,3,5,7],c=’idc101’)
print(xdict[‘c’],xdict[‘b’][2]
idc101 5
print(xdict.keys())
a,b,c
Q7. x=10; y=20; z=15
c= x > y and y > z
print(c) False
d = x > y or z > x
print (d) True

1
Q8. def test(x=5,y=2):
if x < 10:
return(x*y)
x=4
y=6
print(test(),test(x,y),test(12,2),test(y=5))
10,24, None, 25

Q9. out=dict()
for j in range(1,10):
if j%2 == 0:
Continue
out[j]=3*j
if j%7 == 0:
break
print(out.values())
dict_values(3,9,15,21)

Q10. def check(x):


pbool=False
for j in range(2,x):
if x%j == 0:
pbool=True
break
return(pbool)
k=2
n=0
xout=list()
while len(xout) < 7:
if not (check(k)):
n+=1
xout.append(k)
k+=1
print(xout[-1])
17

Write the purpose of function and program


Function: To find a number is prime or not.
th
Program: prints the 7 prime number

You might also like