|
Que No. 1 ) Which of the following is a valid way to declare a Python dictionary?
A.) {1: "One", 2: "Two", 3: "Three"}
B.) (1: "One", 2: "Two", 3: "Three")
C.) [1: "One", 2: "Two", 3: "Three"]
D.) <1: "One", 2: "Two", 3: "Three">
|
Que No. 2 ) What is the result of the expression 5 / 2 in Python?
A.) 2.5
B.) 2
C.) 2.0
D.) 2.25
|
Que No. 3 ) Which keyword is used to define a function in Python?
A.) func
B.) def
C.) function
D.) define
|
Que No. 4 ) How do you access the last element of a Python list?
A.) my_list.last()
B.) my_list[len(my_list) - 1]
C.) my_list[-1]
D.) my_list.last
|
Que No. 5 ) What is the purpose of the "elif" keyword in Python?
A.) To define a function
B.) To handle exceptions
C.) To specify an alternative condition in an "if" statement
D.) To concatenate strings
|
Que No. 6 ) What is the output of the following code snippet: len("Python")?
A.) 7
B.) 6
C.) 5
D.) 4
|
Que No. 7 ) Which of the following operators is used for exponentiation in Python?
A.) ^
B.) **
C.) %
D.) /
|
Que No. 8 ) How do you convert a string to lowercase in Python?
A.) toLowerCase()
B.) lower()
C.) lowercase()
D.) strLower()
|
Que No. 9 ) What is the purpose of the "return" statement in a Python function?
A.) To display text on the console
B.) To exit the function prematurely
C.) To return a value from the function
D.) To print a message to the console
|
Que No. 10 ) Which Python data type is used to represent a sequence of characters?
A.) Integer
B.) Float
C.) String
D.) List
|