Python Data Types Overview Quiz

Python
0 Passed
0% acceptance

A 35-question quiz introducing Python’s core data types, covering numbers, strings, booleans, sequences, mappings, mutability concepts, and how Python treats values at a high level.

35 Questions
~70 minutes
1

Question 1

What does the term 'data type' refer to in Python?

A
A classification that dictates how a value behaves
B
A file extension for Python scripts
C
A line of commented code
D
A physical hardware instruction
2

Question 2

Which statement about Python's typing system is correct?

A
Python uses dynamic typing
B
Python requires explicit type declarations
C
Python has only numeric types
D
Python cannot change a variable’s type
3

Question 3

Which category best describes numbers, strings, and booleans in Python?

A
Fundamental built-in types
B
External library types
C
Hardware drivers
D
Network-specific types
4

Question 4

What function is commonly used to check a value’s data type?

A
type()
B
dataTypeOf()
C
getType()
D
typeof()
5

Question 5

Which data type represents truth values?

A
bool
B
logic
C
bit
D
flag
6

Question 6

Which of the following is a floating-point value?

A
5.0
B
'5'
C
5
D
True
7

Question 7

What data type is produced by the expression True + 1?

A
int
B
bool
C
float
D
str
8

Question 8

Which of the following is a string literal?

A
'hello'
B
hello
C
5
D
True
9

Question 9

What type does input() return?

A
str
B
int
C
bool
D
NoneType
10

Question 10

Which operation is valid for two strings?

A
Concatenation with +
B
Subtraction with -
C
Multiplication with /
D
Bitwise shifting
11

Question 11

Which data type is ordered and mutable?

A
list
B
set
C
dict
D
bool
12

Question 12

Which data type is ordered and immutable?

A
tuple
B
list
C
set
D
dict
13

Question 13

Which type stores unique, unordered values?

A
set
B
list
C
tuple
D
str
14

Question 14

Which type represents key-value pairs?

A
dict
B
tuple
C
set
D
int
15

Question 15

Which of the following is a mutable type?

A
list
B
tuple
C
str
D
int
16

Question 16

Which type always has hashable keys?

A
dict
B
set
C
list
D
tuple
17

Question 17

What does an empty string evaluate to in a boolean context?

A
False
B
True
C
None
D
0 always
18

Question 18

Which values are considered False in Python?

A
0, empty sequences, False
B
Any positive number
C
All strings
D
All containers
19

Question 19

Which category describes types that cannot be changed after creation?

A
Immutable
B
Mutable
C
Expanding
D
Volatile
20

Question 20

What type results from combining two lists with +?

A
list
B
set
C
tuple
D
bool
21

Question 21

What is printed by this code?

python
x = "hello"
      print(type(x))
A
<class 'str'>
B
<class 'list'>
C
<class 'bool'>
D
<class 'dict'>
22

Question 22

What does this produce?

python
nums = [1, 2, 3]
      print(len(nums))
A
3
B
1
C
0
D
An error
23

Question 23

What is the output?

python
a = (1, 2, 3)
      print(a[1])
A
2
B
1
C
3
D
An index error always
24

Question 24

What does this code print?

python
s = set([1, 1, 2])
      print(s)
A
{1, 2}
B
{1, 1, 2}
C
[1, 2]
D
An error
25

Question 25

What is the type of None?

A
NoneType
B
str
C
bool
D
list
26

Question 26

Which data type is best suited for representing an unchanging sequence?

A
tuple
B
list
C
dict
D
set
27

Question 27

Which category describes lists, dictionaries, and sets?

A
Mutable types
B
Immutable types
C
Static types
D
Fixed-size types
28

Question 28

Which type can store mixed data, including numbers and text?

A
list
B
int
C
float
D
bool
29

Question 29

Which type preserves insertion order in modern Python versions?

A
dict
B
set
C
bool
D
int
30

Question 30

Which container type disallows duplicates?

A
set
B
list
C
tuple
D
str
31

Question 31

Which type typically uses integer indexes?

A
list
B
dict
C
set
D
bool
32

Question 32

What kind of type is a string?

A
Immutable sequence of characters
B
Mutable sequence of characters
C
A numeric container
D
A mapping type
33

Question 33

Which of the following is a valid dictionary key?

A
A tuple
B
A list
C
A set
D
A dictionary
34

Question 34

Which data type often underlies the structure of booleans?

A
int
B
str
C
float
D
set
35

Question 35

Which type is a good choice for representing unordered mathematical collections?

A
set
B
tuple
C
list
D
dict

QUIZZES IN Python