wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Py-ngo Workshop Quiz_GDSC

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

      Find the output upon running this code

a)

mango

b)

cherry

c)

litchi

d)

banana

2.

thislist = ["apple", "banana", "cherry", "orange", "kiwi”]

    thislist[1:3] = ["blackcurrant", "watermelon"]

    print(thislist)

   Output for the following code is :


a)

[‘blackcurrant’, ‘watermelon’, ‘cherry’, ‘orange’, ‘kiwi’]

b)

["apple", "blackcurrant", "watermelon", "orange", "kiwi”]

c)

["blackcurrant", "banana", "watermelon", "orange", "kiwi”]

d)

["apple", "banana", "cherry", "orange", "kiwi”]

3.

Statement1 : Lists are faster for accessing individual elements than arrays

     Statement2: Array is faster when it comes to removing or adding elements than list

a)
  1. Both statements are true

b)
  1. 1 is true, 2 is false

c)

Both are false

d)
  1. 2 is true, 1 is false

4.

Which statement is used to break out of a loop?

a)

return

b)

break

c)

end

d)

pass

5.

str= “ I am 18 years old .\n I can vote.”

       What is “\n” (backslash n) command used for ?


a)
  1. Create space in between words

b)
  1. Shift the text to next line

c)
  1. Remove the text 

d)
  1. Delete the space in between two words

6.

Fill in the blanks with the name of the appropriate module to get the output "6"

a)

maths

b)

math

c)

mathematics

d)

numpy

7.

Find the output of the code

a)

[50, 100, 150, 200, 1, 50, 5]

b)

[50, 100, 150, 200, 1, 50, 5, 1, 50, 5]


c)

[50, 100, 150, 200]

d)

AttributeError

8.

Find the output of the code

a)

10

b)

30

c)

50

d)

70

9.

Find the output of the code

a)

7

b)

8

c)

9

d)

10

10.

Find the output of the code

a)

[90, 65, 76, 50, 42, 40, 79]

b)

[90, 65, 76, 50, 42, [40, 79]]

c)

[90, 65, 76, 50, 42, [40], [79]]

d)

AttributeError

11.

Find the output of the code

a)

I found my watch at the tuck shop

b)

I found my w!tch !t the tuck shop

c)

I found my w!tch at the tuck shop

d)

I found my w!tch 1t the tuck shop

12.

Evaluate the expression in Python

a)

0

b)

51

c)

0.0

d)

51.0

13.

Find the output of the code

a)

5

b)

6

c)

7

d)

8

14.

Find the output of the code

a)

{'A': 10, 'B': 14, 'C': 19}



b)

{'A': 10, 'B': 15, 'C': 19}



c)

{'A': 10, 'B':21 , 'C': 19}



d)

AttributeError

15.

Fill in the blank to get the output "ppalepaln"

a)

concatenate

b)

mix

c)

join

d)

There is no function that can lead to the desired output