Exercise: Data Types

Questions for: Data Types

Which of the following data types is used to represent a collection of elements in a specific order with duplicates allowed?
A:
List
B:
Tuple
C:
Set
D:
Dictionary
Answer: A
Lists are used to represent a collection of elements in a specific order, and duplicates are allowed.
Which of the following data types is used to represent a complex number?
A:
int
B:
float
C:
complex
D:
str
Answer: C
The complex data type in Python is used to represent complex numbers, which are numbers with a real and imaginary component.
Which of the following data types is used to represent a sequence of immutable elements?
A:
List
B:
Tuple
C:
Set
D:
Dictionary
Answer: B
Tuples are used to represent a sequence of immutable elements, similar to lists, but tuples cannot be modified.
Which of the following data types is used to represent a binary data?
A:
int
B:
float
C:
bytes
D:
str
Answer: C
The bytes data type in Python is used to represent binary data, such as an image or audio file.
Which of the following data types is used to represent a date and time?
A:
date
B:
time
C:
datetime
D:
timezone
Answer: C
The datetime data type in Python is used to represent a date and time. It is part of the datetime module in Python's standard library.
Ad Slot (Above Pagination)
Quiz