## 1. What is the data type of the following Python variable: x = 5?

a) String
b) Integer
c) Float
d) Character

b) Integer

### Explanation:

In Python, the variable 'x' assigned with a whole number (without a decimal point) is of integer type.

## 2. Which data type in Python is used to store a sequence of characters?

a) Char
b) String
c) Text
d) Word

b) String

### Explanation:

Python uses the string data type to store sequences of characters.

## 3. What data type would be used for a variable that holds the value 3.14 in Python?

a) Integer
b) Decimal
c) Double
d) Float

d) Float

### Explanation:

The float data type in Python represents floating-point numbers, which are numbers with a decimal point.

## 4. How is a list defined in Python?

a) Using curly braces {}
b) Using parentheses ()
c) Using square brackets []
d) Using angle brackets <>

c) Using square brackets []

### Explanation:

Lists in Python are defined using square brackets and can contain elements of different data types.

## 5. What type of data does a Python tuple store?

a) Only integers
b) Only strings
c) A sequence of immutable Python objects
d) Key-value pairs

c) A sequence of immutable Python objects

### Explanation:

A tuple in Python is a collection of Python objects that are immutable (cannot be changed after creation).

## 6. What is the data type of the following Python variable: x = True?

a) Integer
b) String
c) Boolean
d) Character

c) Boolean

### Explanation:

The variable 'x' in Python with the value True is of Boolean type, representing the logical values True or False.

## 7. What is a dictionary in Python?

a) A collection of words and their meanings
b) A list of numbers
c) A collection of key-value pairs
d) An immutable sequence of characters

c) A collection of key-value pairs

### Explanation:

In Python, a dictionary is a collection of key-value pairs where each key is unique and used to retrieve its corresponding value.

## 8. Which of the following is a mutable data type in Python?

a) Strings
b) Tuples
c) Lists
d) Integers

c) Lists

### Explanation:

Lists in Python are mutable, meaning their elements can be changed after their creation.

## 9. How do you define a set in Python?

a) With parentheses ()
b) With square brackets []
c) With curly braces {}
d) With angle brackets <>

c) With curly braces {}

### Explanation:

A set in Python is defined using curly braces and is an unordered collection of unique elements.

## 10. What is the output of the following Python code: type(8)?

a) <class 'int'>
b) <class 'number'>
c) <class 'integer'>
d) <class 'digit'>

a) <class 'int'>

### Explanation:

The type() function in Python shows that the value 8 is of integer class, denoted as <class 'int'>.

## 11. Which of the following data types does not allow duplicate values in Python?

a) Lists
b) Dictionaries
c) Tuples
d) Sets

d) Sets

### Explanation:

Sets in Python are collections of unique elements, meaning they do not allow duplicate values.

## 12. What is the correct syntax to create an empty list in Python?

a) list = ()
b) list = []
c) list = {}
d) list = set()

b) list = []

### Explanation:

An empty list in Python can be created using square brackets without any elements inside.

## 13. Which Python data type is used for ordered collections of items?

a) Sets
b) Tuples
c) Lists
d) Dictionaries

c) Lists

### Explanation:

Lists in Python are used for storing ordered collections of items and are one of the most versatile data types available.

## 14. What is the data type of the following Python variable: x = {"name": "John", "age": 30}?

a) List
b) Tuple
c) Set
d) Dictionary

d) Dictionary

### Explanation:

The variable 'x' is a dictionary in Python, as it is defined with curly braces containing key-value pairs.

## 15. In Python, what data type is best suited for storing a binary number like 0b1101?

a) Binary
b) String
c) Integer
d) Boolean

c) Integer

### Explanation:

Python stores binary numbers (e.g., 0b1101) as integers. The '0b' prefix indicates a binary literal.

## 16. What is the data type of the following Python variable: x = 3.14j?

a) Integer
b) Complex number
c) Float
d) Double

b) Complex number

### Explanation:

The 'j' suffix in Python denotes a complex number, making x a complex number with an imaginary part.

## 17. Which of the following Python data types is immutable?

a) Lists
b) Dictionaries
c) Tuples
d) Sets

c) Tuples

### Explanation:

Tuples in Python are immutable, meaning that their elements cannot be modified after they have been created.

## 18. What is the data type of the following Python variable: x = b"Hello"?

a) String
b) Byte
c) Binary
d) Bytearray

b) Byte

### Explanation:

The variable 'x' is a byte type in Python, indicated by the 'b' prefix before the string literal.

## 19. How do you define an integer variable 'a' in Python with the value 1000?

a) int a = 1000
b) a := 1000
c) a = 1000
d) integer a = 1000

c) a = 1000

### Explanation:

In Python, a variable is assigned a value using the '=' operator without specifying the data type.

a) 0x1A
b) 1Ah
c) hex(1A)
d) #1A