Python Data Types MCQs: 10 Solved Questions with Explanations

Test your Python fundamentals with 10 solved MCQs covering types, mutability, scope, string methods, conversions and precise code tracing.

KnowledgeGate Team

Exam prep & CS education

Updated 27 Nov 20267 min read
Python Data Types MCQs: 10 Solved Questions with Explanations

Python data-type MCQs combine simple labels with traps about mutability, one-item tuples, string methods, conversion functions, local scope and exact code output. Solve all 10 before reading the explanations. Write each predicted value, type and capitalisation first. That separates a concept gap from a hurried reading error.

Python data types: build the map before solving

Decision map for Python data-type traps with mutation, tuples, ord/chr, and branch tracing.

Classify what the stem is asking before inspecting the options. These four signals cover the decisions used in this set.

Question signal

Rule to apply

Quick check

change in place

Lists, sets and dictionaries are mutable; strings and tuples are not.

[2, 4].append(6)

one-item tuple

The comma creates the tuple, not the parentheses.

type(('x',)).__name__ == 'tuple'

character code

ord() maps a character to a code point; chr() reverses it.

ord('A') == 65

exact branch output

Reduce the condition, choose the suite, then preserve letter case.

20 >= 35 is False

Trace real values once. Start with items = [2, 4] and fixed = (2, 4). After items.append(6), items is [2, 4, 6]. Trying fixed[0] = 9 raises TypeError, so fixed remains (2, 4). Finally, single = (7,) has type tuple, while grouped = (7) has type int. For the wider family, conversion, identity and hashability model, read Python Variables and Data Types: Beginner Tutorial with Worked Examples. That earlier tutorial owns names, assignment, built-in families, conversions and aliases; this set concentrates on option-by-option decisions. Build the foundations in a structured order with Python Course: Concepts, MCQs & Coding.

Python Data Types MCQs 1-2: immutability and the one-item tuple trap

Question 1 (KVS 2023)

Which of the following is an immutable data type in Python?

  • A. Set

  • B. List

  • C. Tuple

  • D. Dictionary

Choose an option before revealing the answer.

Correct answer: C. Tuple.

Immutable means that the object cannot be changed after creation. With t = (10, 20), running t[0] = 99 raises TypeError, and t stays (10, 20). The distractors are mutable containers: [10, 20].append(30), {10, 20}.add(30) and {"a": 10}["b"] = 20 all change the container on which they operate. Open the solved page (module page; question page unavailable).

Question 2 (EMRS 2023)

For the following Python statement, what shall be the data type of Msg?

python
Msg = ('Good Day')
  • A. tuple

  • B. list

  • C. Error in statement

  • D. string

Choose an option before revealing the answer.

Correct answer: D. string.

Parentheses only group this expression. A comma is what creates a one-item tuple. Therefore, Msg = ('Good Day') is equivalent to Msg = 'Good Day', and type(Msg) is str. The one-character fix Msg = ('Good Day',) creates the tuple ('Good Day',). The original statement is valid and does not create a list. Open the solved page (module page; question page unavailable).

Python Data Types MCQs 3-4: built-in values and local scope

Question 3 (MPPSC 2025)

Basic data types of Python are

  • A. Numbers, Boolean, Float, Strings

  • B. Numbers, Boolean, Strings, None

  • C. Numbers, Boolean, Pointer, Strings

  • D. Numbers, Strings, Const, None

Choose an option before revealing the answer.

Correct answer: B. Numbers, Boolean, Strings, None.

B is the best match among the supplied choices. More precisely, type(12) is int, type(3.5) is float, type(True) is bool, type("12") is str and type(None) is type(None), whose displayed name is NoneType. Python has no C-style pointer data type or const keyword. “Numbers” is a family, while float is already one numeric type, making A redundant and incomplete. Open the solved page.

Question 4 (KVS 2026)

If a variable is defined inside a user-defined function, what is its “scope”, and where can it be accessed?

  • A. Global Scope; it can be accessed anywhere in the entire program.

  • B. Local Scope; it can only be accessed within that specific function.

  • C. Universal Scope; it is saved to the hard drive for future use.

  • D. Static Scope; it can only be accessed by the main operating system.

Choose an option before revealing the answer.

Correct answer: B. Local Scope; it can only be accessed within that specific function.

Consider def attempts_used(): attempts = 3; return attempts. Calling attempts_used() returns 3 because the name exists while that function runs. A later print(attempts) outside the function raises NameError. Returning the value transfers 3, not the local name itself. Global, universal and operating-system scope do not describe this variable. Open the solved page (module page; question page unavailable).

Python Data Types MCQs 5-6: string methods and character content

Question 5 (KVS 2023)

Which of the following functions cannot be used with the string (str) data type?

  • A. islower()

  • B. isupper()

  • C. isalpha()

  • D. isnum()

Choose an option before revealing the answer.

Correct answer: D. isnum().

str provides islower(), isupper() and isalpha(), but it has no isnum() method. For example, 'abc'.isalpha() is True, while hasattr('7', 'isnum') is False. Python instead provides the distinct checks isdigit() and isnumeric(). Open the solved page (module page; question page unavailable).

Question 6 (DSSSB 2024)

A string is a collection of one or more characters that can contain which of the following?
I. Letters
II. Numbers
III. Symbols

  • A. I, II and III

  • B. Only I

  • C. Only I and III

  • D. Only II

Choose an option before revealing the answer.

Correct answer: A. I, II and III.

The value token = "KG#2026" contains letters K and G, the symbol #, and digits 2, 0, 2, 6, yet its type is still str. Digits inside a string are characters, not numeric values. Thus, "2026" + "1" produces "20261", while 2026 + 1 produces 2027. Open the solved page (module page; question page unavailable).

Python Data Types MCQs 7-8: character conversion and string cleaning

Question 7 (DSSSB 2024)

Which of the following Python type-conversion functions converts a character into its integer Unicode code point?

  • A. tuple()

  • B. dict()

  • C. set()

  • D. ord()

Choose an option before revealing the answer.

Correct answer: D. ord().

The precise rule is that ord() returns the integer Unicode code point of a one-character string. Therefore, ord('A') = 65 and ord('a') = 97. The reverse operation is chr(97), which returns 'a'. The functions tuple(), dict() and set() create container objects. They do not perform character-to-code-point conversion. Open the solved page (module page; question page unavailable).

Question 8 (DSSSB 2024)

Which statement correctly describes Python's str.strip() method when it is called without arguments?

  • A. It returns a string after removing leading and trailing whitespace.

  • B. It returns a list by splitting the string at a specified delimiter.

  • C. It returns the result of raising one value to the power of another.

  • D. It returns a string with the first character uppercase and the remaining characters lowercase.

Choose an option before revealing the answer.

Correct answer: A. It returns a string after removing leading and trailing whitespace.

With raw = " Python MCQ ", raw.strip() returns "Python MCQ". It removes leading and trailing whitespace but keeps the internal space. By contrast, split() returns a list using a delimiter, pow() computes a power, and capitalize() uppercases the first character while lowercasing the rest. These are four separate operations. Open the solved page (module page; question page unavailable).

Python Data Types MCQs 9-10: list mutation and exact branch output

Two execution traces show list append mutation and the exact No branch output.

Question 9 (DSSSB 2024)

Which Python list method adds an element to the end of a list?

  • A. index()

  • B. sort()

  • C. pop()

  • D. append()

Choose an option before revealing the answer.

Correct answer: D. append().

Start with items = [2, 4]. After result = items.append(6), the same list is [2, 4, 6] and result is None. This shows that append() mutates the list rather than returning a new list. index() finds a position, sort() reorders items, and pop() removes and returns an item. Open the solved page (module page; question page unavailable).

Question 10 (DSSSB 2024)

Select the correct output for the following Python code:

python
a = 20
b = 35
if a >= b:
    print("yes")
else:
    print("No")
  • A. Syntax Error

  • B. No

  • C. Yes

  • D. Error

Choose an option before revealing the answer.

Correct answer: B. No.

Substitute the values into the condition: 20 >= 35 is False. Python skips print("yes") and runs the else suite. The exact output is No, with uppercase N and lowercase o, not Yes. The indentation is valid and both variables contain integers, so there is no syntax or type error. The solved page (module page; question page unavailable) confirms this branch trace. Python Output-Based Questions: 13 Solved Snippets owns the deeper aliasing, slicing, mutable-default and identity traces; this question tests branch selection and exact capitalisation.

Python data-type MCQs: the short version and next practice step

Use this five-line checklist:

  • Parentheses do not make a tuple; the comma does.

  • Tuple and str are immutable.

  • List, set and dict are mutable.

  • ord() returns a code point, while chr() reverses it.

  • Trace comparisons with the exact values and capitalisation shown.

Try one final mixed retrieval drill. For x = ('7'), y = ('7',) and z = [7], predict type(x).__name__, type(y).__name__, type(z).__name__ and the result after z.append(9). Check: str, tuple, list, and [7, 9].

Use Python Course: Concepts, MCQs & Coding for a structured foundation, or browse Coding & DSA Courses for Placements. Then solve another set without opening the explanations.