Loading...
QUIZ

Certification Test

 
Que No. 1 ) How do you check if a value is present in a Python list?

A.) exists(value, my_list)
B.) value in my_list
C.) contains(my_list, value)
D.) check(my_list, value)


Que No. 2 ) What is the output of the following code snippet: bool(0)?

A.) True
B.) False
C.) 0
D.) 1


Que No. 3 ) Which keyword is used to create a loop in Python?

A.) for
B.) loop
C.) while
D.) do


Que No. 4 ) How do you check the length of a Python list?

A.) list_length(my_list)
B.) length(my_list)
C.) count(my_list)
D.) len(my_list)


Que No. 5 ) What is the purpose of the "append()" method in Python lists?

A.) To remove an element from a list
B.) To add an element to the beginning of a list
C.) To add an element to the end of a list
D.) To sort the list


Que No. 6 ) How do you remove an item from a Python list by its value?

A.) remove(value)
B.) delete(value)
C.) pop(value)
D.) discard(value)


Que No. 7 ) What is the result of the expression True and False in Python?

A.) True
B.) False
C.) None
D.) Error


Que No. 8 ) What is the purpose of the "else" clause in a Python "if" statement?

A.) To define a function
B.) To specify an alternative condition
C.) To execute code when the condition is true
D.) To execute code when the condition is false


Que No. 9 ) How do you create an empty Python dictionary?

A.) empty_dict()
B.) {}
C.) dict()
D.) new_dict()


Que No. 10 ) Which of the following is a valid way to open a file in Python?

A.) open_file("file.txt")
B.) file.open("file.txt")
C.) with open("file.txt") as f:
D.) read("file.txt")