Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

1. Let Word=’Hello’. What will be the output of the following expressions?

i. word[:-2] ii. word[-0]


a) Hel, H b) Hel, Error c) Hel, o d) Error, Error

2. def proc(x):
x=2*x*x

def main():
x=10
proc(x)
print x

a) 200 b) 10 c) 0 d) Error

3. Let student = {‘John’:50,’Tom’:60} be a dictionary. What will be the output obtained


after executing the following statements:
newstudent = student
newstudent[‘Tom’] = 45
print student
print newstudent

a) {‘John’:50,’Tom’:60}, {‘John’:50,’Tom’:45}
b) b) {‘John’:50,’Tom’:45}, {‘John’:50,’Tom’:45}
c) {‘John’:50,’Tom’:60}, {‘John’:50,’Tom’:60}
d) Error, Error

4. What will be the output obtained after executing the following statements:
i=5
def f(arg=i):
print(arg)
i=6
f()

a) 6 b) 0 c) 5 d) Error

You might also like