Python Character Set, Tokens, Keywords, Identifiers and Literals MCQs: 11 Solved Questions
Solve 11 Python MCQs by applying a clear test for identifiers, keywords, literals, assignment, rebinding, tuple syntax and format rounding.
KnowledgeGate Team
Exam prep & CS education

Python identifier questions look like pure recall, but exam setters mix case-sensitive keywords, legal underscores, illegal starting digits, assignment commas and literal formatting. Token and identifier recognition leads into binding, assignment and formatted literals. Choose an option and justify it with one rule before reading each explanation.
The Python practice page provides further questions. Questions 3, 6 and 8 use that topic page because they do not have individual solved-page links.
The Python token rules to apply before the MCQs
Python source text combines letters, digits, whitespace and symbols such as _, +, = and quotation marks. The tokenizer groups that character stream into identifiers, keywords, literals, operators and delimiters. Context decides the role: an underscore may belong to a name, a plus sign is an operator, and quotation marks delimit a string literal.
Work through total_marks = 35 + 7. The letters and underscore form the identifier total_marks; = is the assignment delimiter or operator token; 35 and 7 are integer literals; and + is an operator. Since 35 + 7 = 42, the name is bound to 42. In course = "Python", course is an identifier and "Python" is a string literal. The quotation marks delimit the literal but are not stored.
Use this identifier test throughout: the first character may be a letter or _; later characters may also include digits. Spaces, % and - are not identifier characters. An exact keyword cannot be reused as a name. Python is case-sensitive, so for, True, False and None are keywords, while For, true and none are different spellings and can be identifiers.
Variables are names bound to objects. After score = 42, score refers to an integer. After score = "forty-two", it refers to a string. That is dynamic typing and rebinding, not mutation of the integer object 42.
Python Syntax Basics: Rules, Worked Examples and Exam-Style Traps owns the complete concept walkthrough and program trace; this set tests token classification under question wording. Python Data Types MCQs: 10 Solved Questions with Explanations owns type families, conversions and list mutation; here tuple commas and rebinding appear only as punctuation and name-binding traps.
MCQs 1-3: build and reject Python identifiers
Question 1
Source: EMRS Computer Science, 2026.
Which of the following options is a valid identifier in Python?
A. Total%marks
B. Total_Marks
C. Total Marks
D. Total-Marks
Correct answer: B. Total_Marks.
Apply the complete identifier-character test to every option. _ is permitted, so Total_Marks is valid. In A, % begins an operator; in C, the space separates tokens; in D, - is the subtraction operator. A name must survive the whole test, not merely contain some legal characters, so those choices cannot each form one identifier. Review the Question 1 solved page.
Question 2
Source: EMRS Computer Science, 2026.
Which of the following options is a valid identifier in Python?
A. 3D
B. _Marks
C. %Marks
D. True
Correct answer: B. _Marks.
_Marks starts with an allowed underscore. 3D starts with a digit, %Marks starts with an operator character, and True is an exact Python keyword. By contrast, Marks_3 would be valid because its digit comes after the first character. Continue on the Question 2 solved page.
Question 3
Source: EMRS Computer Science, 2023.
Which of the following cannot be used as a valid identifier in Python?
A. 1stName
B. Name1
C. Name_1
D. FirstName
Correct answer: A. 1stName.
The first character decides it. 1stName begins with 1, so it is invalid. The digit in Name1 and Name_1 appears after a valid letter-start, while FirstName contains letters only. A digit is therefore not banned everywhere, only at the start. For further practice on this item, use the Python practice page.
MCQs 4-7: keywords, case and names that only look reserved
Question 4
Source: KVS Computer Science, 2026.
Which of the following cannot be used as a variable name in Python?
A. elif
B. For
C. Value35
D. _Flag
Correct answer: A. elif.
elif is an exact lowercase keyword. For is not the keyword for, because case matters. Value35 has a legal trailing digit, and _Flag has a legal leading underscore. A lookalike such as For is legal but poor naming in real code. Check the Question 4 solved page.
Question 5
Source: KVS Computer Science, 2026.
Which of the following can be used as a variable name in Python?
A. while
B. My Number
C. 2ndValue
D. Data_1
Correct answer: D. Data_1.
The inverse wording asks for the one legal name. Data_1 starts with a letter and has only letters, an underscore and a trailing digit. while is a keyword, My Number has a space, and 2ndValue starts with a digit. Try the Question 5 solved page.
Question 6
Source: Cognizant, 2023.
All keywords in Python are in _________
A. Capitalized
B. lower case
C. UPPER CASE
D. None of the mentioned
Correct answer: D. None of the mentioned.
Many keywords are lowercase, such as if, for and while, but True, False and None are capitalised exactly as shown. The set is therefore not all capitalized, lowercase or uppercase. For more practice, use the Python practice page.
Question 7
Source: KVS Computer Science, 2023.
Which of the following is an invalid identifier in Python Programming Language?
A. none / none
B. False / False
C. true / true
D. For / For
Correct answer: B. False / False.
Judge the identifier on each side of the slash. False is an exact keyword and cannot be an identifier. Lowercase none, lowercase true and capitalised For do not match None, True and for, so they are legal. Such lookalikes still hurt readability. See the Question 7 solved page.
MCQs 8-9: dynamic typing, rebinding and mutable-value wording
item = 7 binds item to an integer, then item = "seven" rebinds it to a string. In contrast, items = [7]; items.append(8) mutates that list to [7, 8].
Question 8
Which of the following statements about Python variables is correct?
A. Variables must be declared before use
B. Variable type must be specified explicitly
C. Python supports dynamic typing
D. Variables cannot change type
Correct answer: C. Python supports dynamic typing.
No declaration or explicit type is needed. The name later refers to another type, which is dynamic typing. The integer does not turn into a string. For more practice, use the Python practice page.
Question 9
Source: DSSSB PGT, 2021.
Which statement(s) is/are NOT true about the variables in Python Language:
I. Values of every variable can be changed once a variable has been created and assigned value.
II. Assignment statement is used to create a new variable and assign value.
A. Only I
B. Only II
C. Both I and II
D. Neither I nor II
Correct answer: A. Only I.
Read the negative wording. Statement II is true: score = 42 binds a name and value. Statement I is too broad. Names can be rebound, but not every object is mutable. Integer 42 cannot change in place; list [7] can become [7, 8] through append. Thus only I is not true. Review the Question 9 solved page.
MCQ 10: commas, tuple construction and invalid adjacent literals
Question 10
Source: RSSB Computer Science, BCI-Paper2, 2022.
Which of the following assignments is syntactically incorrect in Python?
A. xyzp = 5,000,000
B. xyzp = 5000 6000 7000 8000
C. x, y, z, p = 5000, 6000, 7000, 8000
D. x_y_z_p = 5,000,000
Correct answer: B. xyzp = 5000 6000 7000 8000.
Parse the commas instead of reading them as thousands separators. The comma tokens define tuple structure. A binds xyzp to the tuple (5, 0, 0). C unpacks four integer literals, producing x = 5000, y = 6000, z = 7000 and p = 8000. D uses the valid identifier x_y_z_p and binds it to (5, 0, 0). B places four numeric literals beside one another with only spaces, no operators or commas, so it is syntactically invalid. In Python source, 5,000,000 is not the integer five million. Inspect the Question 10 solved page.
MCQ 11: trace a floating-point literal through format rounding
Question 11

Source: KVS Computer Science, 2023.
Identify the correct output of the following Python program segment:
Pi = 3.141592
print('%.4f' % Pi)
A. 3.14
B. 3.1415
C. 3.1416
D. 3.0000
Correct answer: C. 3.1416.
3.141592 is the floating-point literal bound to Pi. The format specifier %.4f requests four digits after the decimal point. Those first four digits are 1415; the next digit is 9. That fifth digit controls whether the last displayed digit stays or rises. Round the fourth decimal digit from 5 to 6, producing 3.1416. The stored value is not first truncated by the display code. Truncation would give option B, but formatting rounds. Confirm it on the Question 11 solved page.
Trap matrix and the targeted next practice step
Trap | Correct check |
|---|---|
Starts with a digit | Invalid identifier |
Exact keyword in exact case | Invalid name |
Comma-separated expression | Tuple construction or unpacking, not thousands notation |
| Four decimal places with rounding |
Rebinding versus mutation | A name may point elsewhere; only a mutable object changes in place |
Treat the total as less important than the error class. Misses on Questions 1-5 or 7 call for the identifier and keyword test. A miss on Question 6 calls for exact-case recall. Questions 8-9 call for a rebinding-versus-mutation trace, while Questions 10-11 call for punctuation and literal-format tracing. Write the rule beside each wrong option before retesting.
The short version is: classify the token, then test its first character, remaining characters, exact keyword spelling and surrounding punctuation. Use Python Course - Concepts, MCQs & Coding for sequenced concept and MCQ study. Choose DSA Using Python when you are ready to apply the syntax in problem-solving practice.
Keep learning
C++ Tokens Explained: Keywords, Identifiers, Literals and Worked Examples
Learn how C++ source code becomes tokens, then practise exact token counts, identifier rules, operator boundaries, precedence and output prediction.
Tokens in C++ MCQs: 11 Solved Questions on Identifiers, Operators and Whitespace
Solve 11 real exam and placement-test C++ token questions, then learn the small rules that settle identifier, whitespace, operator, scope and output traps.
Python Tokens, Variables, Data Types and I/O: Worked Examples from Input to Output
Trace one Python program from keyboard text through name binding, numeric conversion, a Boolean decision and formatted output, then test the common traps.
Python SQL MCQs: 11 Solved Python-MySQL Questions with Explanations
Trace Python-MySQL connections, cursors, result retrieval, transactions and CRUD through one SCHOOL database example and clear question explanations.





