wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Quiz 2.2

Total questions: 26

Worksheet time: 25mins

Name
Class
Date
1.

if 5 == 10 (a)   4 == 4:

print("At least one of the statements is true")
output is : At least one of the statements is true

2.

fruits = ["apple", "banana", "cherry"]

Use the method to add "orange" to the end of fruits list.

(a)  

3.

fruits = ["apple", "banana", "cherry"]

Use the method to add "lemon" as the second item in the fruits list.




(a)  

4.

fruits = ["apple", "banana", "cherry"]

Use indexing to print the last item in the list.

(a)  

5.

fruits = {"apple", "banana", "cherry"}

more_fruits = ["orange", "mango", "grapes"]

Use the correct method to add multiple items (more_fruits) to the fruits set.

(a)  

6.

fruits = {"apple", "banana", "cherry"}

Use the method to add "orange" to the fruits set.

(a)  

7.

print(bool("abc"))


(a)  

8.

fruits = {"apple", "banana", "cherry"}

Use the method to remove "banana" from the fruits set.




(a)  

9.

if 5 > 2: print("Five is greater than two!")

Use the correct short hand syntax to put the following statement on one line:

(a)  

10.

t=list((12,7,9))

for i in t: print(i)

if(i==7):

break




(a)  

11.

x=[[1,2,3],[4,5,6]]

print(x[0][2])

what is the output of this code?




(a)  

12.

x=[[1,2,3],[4,5,6]]

print(x[0])

what is the output of this code?

(a)  

13.

x=[[1,2,3],[4,5,6]]

print(x[3])

what is the output of this code?

(a)  

14.

x=55;

print(x%2 != 0)

what is the output of this code?

(a)  

15.

x=12.4151151

print(int(x))

what is the output of this code?

(a)  

16.

car = {

"brand": "Ford",

"model": "Mustang",

"year": 1964

}

Use the method to print the value of the "model" key of the car dictionary.

(a)  

17.

which of the following is not oop concopet?

a)

Encapsulation

b)

inherentiance

c)

polymorphism

d)

exception

18.

car = {

"brand": "Ford",

"model": "Mustang",

"year": 1964

}

Change the "year" value from 1964 to 2020.





(a)  

19.

car = {

"brand": "Ford",

"model": "Mustang",

"year": 1964

}

Use the method to remove "model" from the car dictionary.

(a)  

20.


car = {

"brand": "Ford",

"model": "Mustang",

"year": 1964

}

Use the method to empty the car dictionary.


(a)  

21.

def h1(x, y): print(x / y)
h1(x, y)

a)

X/Y

b)

"X/Y"

c)

Error

22.

can we pass to a function an argument ?

a)

True

b)

False

23.

x = lambda a : a + 10 print(x(5))




(a)  

24.

sum(1,2,3)

def sum (x,y,z):

print(x+y+z)

What is the output of this code?




(a)  

25.

def sum(x:2,z:"5",y:8):

print(x + y + z)

sum(2,8,5)

What is the output of this code?

(a)  

26.

def div (x,y):

print(x/y)

div(12,3)

(a)