wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python - Data Types

Total questions: 11

Worksheet time: 6mins

Name
Class
Date
1.

Which of the following are immutable

a)

Number

b)

String

c)

Tuple

d)

All of the above

2.

What is true about complex numbers?

a)

The real and imaginary component can be float

b)

The real part should be an integer

c)

Scientific notation cannot be used in complex number

d)

All of above

3.

The int() function can be useful to convert

a)

string to integer

b)

hexadecimal to integer

c)

float to int

d)

complex number to int

4.

Which of the following is not a valid integer in Python?

a)

0o123

b)

123

c)

0123

d)

0x123

5.

Which of the following are valid complex number objects?

a)

4+5j

b)

5j+4

c)

0j

d)

5+4

6.

An Expression 'str' in 'string' will return

a)

True

b)

False

c)

ValueError

d)

TypeError

7.

Which of these is not a core data type?

a)

List

b)

Tuple

c)

Dictionary

d)

Class

8.

Which one of the following is False regarding data types in Python?

a)

In python, explicit data type conversion is possible

b)

Mutable data types are those that can be changed.

c)

Immutable data types are those that cannot be changed.

d)

None of the above

9.

Which of the following function is used to know the data type of a variable in Python?

a)

datatype()

b)

typeof()

c)

type()

d)

vartype()

10.

How to get the type of the following Variable?

Val = 12

a)

type(Val)

b)

exec(Val)

c)

print(Val)

d)

help(Val)

11.

What is the output of the following code?

x = 25

type(x)

a)

integer

b)

int

c)

<class 'int'>

d)

<class 'number'>