Loading...
QUIZ

Certification Test

 
Que No. 1 ) What is the output of the following code snippet: list(range(1, 4))?

A.) [1, 2, 3]
B.) [1, 2, 3, 4]
C.) [2, 3]
D.) [1, 4]


Que No. 2 ) How do you convert a string to an integer in Python?

A.) int(my_string)
B.) my_string.toInt()
C.) parse(my_string)
D.) str_to_int(my_string)


Que No. 3 ) Which of the following is a valid way to create a Python set?

A.) {1, 2, 3}
B.) [1, 2, 3]
C.) (1, 2, 3)
D.) {"1", "2", "3"}


Que No. 4 ) What is the output of the following code snippet: not True?

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


Que No. 5 ) How do you check if a Python list is empty?

A.) empty(my_list)
B.) is_empty(my_list)
C.) len(my_list) == 0
D.) size(my_list) == 0


Que No. 6 ) Which Python data type is used to represent a collection of key-value pairs?

A.) Set
B.) List
C.) Dictionary
D.) Tuple


Que No. 7 ) What is the result of the expression 2 * 3 + 4 in Python?

A.) 10
B.) 14
C.) 20
D.) 8


Que No. 8 ) How do you declare a tuple in Python?

A.) tuple my_tuple = (1, 2, 3)
B.) my_tuple = {1, 2, 3}
C.) my_tuple = [1, 2, 3]
D.) my_tuple = (1, 2, 3)


Que No. 9 ) What is the purpose of the "in" keyword in Python?

A.) To define a function
B.) To check if a value is present in a sequence
C.) To exit a loop prematurely
D.) To concatenate strings


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

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