Python MCQ’s | Data types 2

In python we do not specify types, it is directly interpreted by the compiler, so consider the following operation to be performed.

>>>x = 13 ? 2
objective is to make sure x has a integer value, select all that apply (python 3.xx)

a) x = 13 // 2
b) x = int(13 / 2)
c) x = 13 % 2
d) All of the mentioned

What error occurs when you execute the following Python code snippet?

apple = mango
a) SyntaxError
b) NameError
c) ValueError
d) TypeError

What will be the output of the following Python code snippet?

def example(a):
a = a + ‘2’
a = a*2
return a

a) indentation Error
b) cannot perform mathematical operation on strings
c) hello2
d) hello2hello2

What data type is the object below?

L = [1, 23, ‘hello’, 1]
a) list
b) dictionary
c) array
d) tuple

In order to store values in terms of key and value we use what core data type.

a) list
b) tuple
c) class
d) dictionary

Visitor Counter