Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

PYTHON QUIZ3

Total questions: 10

Worksheet time: 10mins

Name
Class
Date
1.

1. Find the output of the following program:

nameList = ['Harsh', 'Pratik', 'Bob', 'Dhruv']

print nameList[1][-1]

a)

h

b)

k

c)

v

d)

b

2.

2. Find the output of the following program:

input = [1, 2, 3, 4]

input. append([5,6,7,8])

print(input)

a)

[1,2,3,4,5,6,7,8]

b)

[1,2,3,4]

c)

[1,2,3,4,[5,6,7,8]]

d)

[1,2,3,4][5,6,7,8]

3.

3. Find the output of the following program:

list1 = range(100, 110)

print (list1.index(105))

a)

105

b)

5

c)

106

d)

4

4.

4. Find the output of the following program

list1 = [1, 2, 3, 4, 5]

list2 = list1

list2[0] = 0;

print( list1)

a)

[1, 2, 3, 4, 5, 0]

b)

[0,1, 2, 3, 4, 5]

c)

[0, 2, 3, 4, 5]

d)

[1, 2, 3, 4, 0]

5.

5. Find the output of the following code

list1 = [1998, 2002]

list2 = [2014, 2016]

print ((list1 + list2)*2)

a)

[1998, 2002, 2014, 2016, 1998, 2002, 2014, 2016]

b)

[1998, 2002, 2014, 2016]

c)

[1998, 2002, 1998, 2002]

d)

[2014, 2016, 2014, 2016]

6.

6. A Program Runs And, During Running, Is Asked To Divide By Zero. The Program Crashes. This Is An Example Of ----------

a)

Runtime Error

b)

Logic Error

c)

Syntax Error

d)

semantic Error

7.

7. What will be output for the folllowing code?

try:

print(x)

except:

print("An exception occurred")

a)

x

b)

An exception occurred

c)

Error

d)

None of the above

8.

8. Which exception raised when a calculation exceeds maximum limit for a numeric type?

a)

Standard Error

b)

Arithmetic Error

c)

Overflow Error

d)

FloatingPoint Error

9.

9. What is the output of the following

x = 36 / 4 * (3 + 2) * 4 + 2

print(x)

a)

37

b)

182

c)

196

d)

error

10.

10. What is the output of the following code?

p, q, r = 10, 20 ,30

print(p, q, r)

a)

(10, 20, 30)

b)

Invalid syntax

c)

(30,30,30)

d)

(10,10,10)