wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

2R C-Skill Lab Test Autumn 2024-25

Total questions: 14

Worksheet time: 14mins

Name
Class
Date
1.

Complete the code to add "Python" to the list. my_list = ["C", "Java"] my_list.__________("Python") print(my_list)

a)

append

b)

insert

c)

add

d)

extend

2.

Complete the code to print the second item in the list. my_list = [10, 20, 30, 40] print(_________)

a)

my_list[0]

b)

my_list[1]

c)

my_list[2]

d)

my_list[-1]

3.

Complete the code to create a dictionary with the key "name" and the value "John". my_dict = {"name": ________}

a)

name

b)

"name"

c)

"John"

d)

John

4.

Complete the code to access the substring "Python" from the string. my_string = "Learn Python Programming" print(_________)

a)

my_string[6:12]

b)

my_string[:6]

c)

my_string[12:]

d)

my_string[6:18]

5.

Complete the code to find the length of the tuple. my_tuple = (1, 2, 3, 4) print(_________)

a)

len(my_tuple)

b)

count(my_tuple)

c)

length(my_tuple)

d)

size(my_tuple)

6.

Complete the code to convert the given kilometers into meters. km = 5 meters = km _________

a)

* 1000

b)

+ 1000

c)

/ 1000

d)

- 1000

7.

Complete the code to create an empty set in Python. my_set = ________

a)

set

b)

set()

c)

{}

d)

None

8.

Complete the code to remove an element from the list using its value. my_list = [1, 2, 3, 4] my_list._________(3) print(my_list)

a)

pop

b)

remove

c)

discard

d)

delete

9.

Complete the code to check if num is a prime number. if num > 1: for i in range(2, int(num ** 0.5) + 1): if num % i == 0: print("Not prime") _________ print("Prime")

a)

exit()

b)

return

c)

break

d)

stop

10.

Complete the code to join two lists into one. list1 = [1, 2, 3] list2 = [4, 5, 6] result = list1 _________ list2 print(result)

a)

append

b)

+

c)

extend

d)

join

11.

Python is a ____ programming language.

a)
  • (a) Functional

b)
  • (b) Object-oriented

c)
  • (c) Procedural

d)
  • (d) All of the above

12.

Which method is used to add an element at the end of a list?

a)
  • (a) insert()

b)
  • (b) extend()

c)
  • (c) append()

d)
  • (d) add()

13.

List1=[1,2,11.5,"apple",25,"king"]

for i in (a)   :

print(i)

14.

num 1 = int(_____("Enter the value of num 1=" ))

num 2= ___(input("Enter the value of num = "))

num 3= int(input ("Enter the value of num3 = "))

if (num1> = num 2)___(num1 >= num 3):

print(f'{num 1} is a largest number')

____(num 2 >= num 1) and (num2>= num 3):

print(f'(num 2) is a largest number')

____:

print (F'{num 3} is the largest number)

(a)