Font size
Worksheets2R C-Skill Lab Test Autumn 2024-25
Total questions: 14
Worksheet time: 14mins
Complete the code to add "Python" to the list. my_list = ["C", "Java"] my_list.__________("Python") print(my_list)
append
insert
add
extend
Complete the code to print the second item in the list. my_list = [10, 20, 30, 40] print(_________)
my_list[0]
my_list[1]
my_list[2]
my_list[-1]
Complete the code to create a dictionary with the key "name" and the value "John". my_dict = {"name": ________}
name
"name"
"John"
John
Complete the code to access the substring "Python" from the string. my_string = "Learn Python Programming" print(_________)
my_string[6:12]
my_string[:6]
my_string[12:]
my_string[6:18]
Complete the code to find the length of the tuple. my_tuple = (1, 2, 3, 4) print(_________)
len(my_tuple)
count(my_tuple)
length(my_tuple)
size(my_tuple)
Complete the code to convert the given kilometers into meters. km = 5 meters = km _________
* 1000
+ 1000
/ 1000
- 1000
Complete the code to create an empty set in Python. my_set = ________
set
set()
{}
None
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)
pop
remove
discard
delete
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")
exit()
return
break
stop
Complete the code to join two lists into one. list1 = [1, 2, 3] list2 = [4, 5, 6] result = list1 _________ list2 print(result)
append
+
extend
join
Python is a ____ programming language.
(a) Functional
(b) Object-oriented
(c) Procedural
(d) All of the above
Which method is used to add an element at the end of a list?
(a) insert()
(b) extend()
(c) append()
(d) add()
List1=[1,2,11.5,"apple",25,"king"]
for i in (a) :
print(i)
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)
