WorksheetsPYTHON QUIZ3
Total questions: 10
Worksheet time: 10mins
1. Find the output of the following program:
nameList = ['Harsh', 'Pratik', 'Bob', 'Dhruv']
print nameList[1][-1]
h
k
v
b
2. Find the output of the following program:
input = [1, 2, 3, 4]
input. append([5,6,7,8])
print(input)
[1,2,3,4,5,6,7,8]
[1,2,3,4]
[1,2,3,4,[5,6,7,8]]
[1,2,3,4][5,6,7,8]
3. Find the output of the following program:
list1 = range(100, 110)
print (list1.index(105))
105
5
106
4
4. Find the output of the following program
list1 = [1, 2, 3, 4, 5]
list2 = list1
list2[0] = 0;
print( list1)
[1, 2, 3, 4, 5, 0]
[0,1, 2, 3, 4, 5]
[0, 2, 3, 4, 5]
[1, 2, 3, 4, 0]
5. Find the output of the following code
list1 = [1998, 2002]
list2 = [2014, 2016]
print ((list1 + list2)*2)
[1998, 2002, 2014, 2016, 1998, 2002, 2014, 2016]
[1998, 2002, 2014, 2016]
[1998, 2002, 1998, 2002]
[2014, 2016, 2014, 2016]
6. A Program Runs And, During Running, Is Asked To Divide By Zero. The Program Crashes. This Is An Example Of ----------
Runtime Error
Logic Error
Syntax Error
semantic Error
7. What will be output for the folllowing code?
try:
print(x)
except:
print("An exception occurred")
x
An exception occurred
Error
None of the above
8. Which exception raised when a calculation exceeds maximum limit for a numeric type?
Standard Error
Arithmetic Error
Overflow Error
FloatingPoint Error
9. What is the output of the following
x = 36 / 4 * (3 + 2) * 4 + 2
print(x)
37
182
196
error
10. What is the output of the following code?
p, q, r = 10, 20 ,30
print(p, q, r)
(10, 20, 30)
Invalid syntax
(30,30,30)
(10,10,10)
