Q.Which of the following is not a valid variable name in Python? Justify reason for it not being a valid name.
🔒You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
🔒 Start your 14-day free trial to unlock the full solution →Concept understanding — Python Data Types, Tokens and Identifiers
Python programs are built from tokens, the smallest meaningful units, which include keywords, identifiers, literals, operators and comments. Keywords such as if, for and while are reserved words that cannot be used as names, while identifiers are the programmer-chosen names for variables, functions and classes and must follow naming rules like starting with a letter or underscore. Values in Python belong to data types such as int, float, str, bool …
The key idea is Python variable naming rules: a variable name must start with a letter (a–z, A–Z) or an underscore (_), followed by letters, digits, or underscores. It cannot begin with a digit.
- (i)
5Radius— starts with a digit, which violates the rule. - (ii)
Radius_— starts with a letter, followed by a letter and underscore; valid. …
Python variable names must start with a letter or underscore, not a digit. 5Radius starts with a digit, so it is invalid. The valid names are Radius_, _Radius, and Radius.
The core rule here is simple: Python follows the same naming convention as most programming languages — a variable name must begin with either a letter (a–z, A–Z) or an underscore (_). It cannot start with a digit. After the first character, you can use letters, digits, or underscores freely.
Why this rule? It prevents ambiguity. If 5Radius were allowed, the interpreter wouldn't know whether 5 is part of a number or a variable name. For example, 5Radius + 3 could be read as 5 (a number) plus Radius (a variable) plus 3, or as a single variable 5Radius plus 3. To avoid this confusion, the language simply forbids names starting with a digit.
Let's check each option:
-
5Radius— Starts with the digit5. This violates the rule. Python will raise aSyntaxErrorif you try to use it.Watch outA common mistake is thinking that digits anywhere in a name are fine — they are, but not at the start.
Radius5is perfectly valid;5Radiusis not. -
Radius_— Starts with a letter (R), followed by letters and an underscore. Allowed. Perfectly valid. …
- CBSE 2026Set 91/41 markQ.State True or False : In Python, data type of 74 is same as the data type of 74.0.
›Reveal solutionSolution
The integer
74and the float74.0have different data types in Python —intvsfloat— so the statement is False.Why this matters
In Python, every value has a specific type that determines what operations you can do with it and how it's stored in memory. The presence or absence of a decimal point is not just cosmetic — it fundamentally changes the type. This is a common source of confusion for beginners who think
74and74.0are "the same number" and therefore must have the same type.Step-by-step reasoning
-
Check the type of
74In Python, a literal written without a decimal point is an integer (
int). You can verify this using thetype()function:type(74) # <class 'int'> -
Check the type of
74.0A literal that includes a decimal point (even if the fractional part is zero) is a floating-point number (
float):type(74.0) # <class 'float'> -
Compare the two types
intandfloatare distinct classes in Python. They are not the same data type, even though74and74.0represent the same numeric value. -
Why Python distinguishes them …
-
- CBSE 2025Set 91/41 markMCQQ.Which of the following is the correct identifier? (A) global (B) Break (C) def (D) with
›Reveal solutionSolution
The question asks which of the given options is a valid identifier in Python. An identifier is a name used for variables, functions, etc. The correct answer is (B) Break, because it is not a reserved keyword (Python is case-sensitive, so
Breakdiffers from the keywordbreak), while the others are all reserved keywords.The Concept: What Makes a Valid Identifier in Python?
In Python, an identifier is simply a name you give to a variable, function, class, or other object. The rules are strict:
- It must start with a letter (a–z, A–Z) or an underscore (
_). - The rest can be letters, digits (0–9), or underscores.
- It cannot be a reserved keyword (like
if,for,def,global, etc.). - Python is case-sensitive, so
Breakandbreakare different names.
The trick here is that the options mix keywords and non-keywords, and case-sensitivity is the deciding factor. Let's check each one.
Step-by-Step Reasoning
-
Option (A):
globalglobalis a Python keyword used to declare a variable as global inside a function. Since it's a reserved word, it cannot be used as an identifier. So this is invalid. -
Option (B):
BreakPython has a keyword
break(all lowercase) used to exit loops. ButBreakwith a capital B is a different string. Python is case-sensitive, soBreakis not a keyword — it's a perfectly valid identifier. You could name a variableBreakif you wanted (though it's not recommended for readability). This is the correct choice. -
Option (C):
def…
- It must start with a letter (a–z, A–Z) or an underscore (
- CBSE 2023Set 91/11 markQ.State True or False. "Identifiers are names used to identify a variable, function in a program".
›Reveal solutionSolution
The statement is True. Identifiers are indeed the names given to program elements like variables and functions to uniquely identify them in code.
The Concept: What Are Identifiers?
In programming, an identifier is a name you create to label something in your code — a variable, a function, a class, a constant, or any other user-defined element. Think of it like a nametag: without identifiers, you'd have no way to refer to a specific piece of data or a block of code. The computer uses these names to know exactly which memory location or instruction you mean.
The statement says: "Identifiers are names used to identify a variable, function in a program." This is the textbook definition. Every programming language (C, Python, Java, etc.) uses identifiers for exactly this purpose.
Step-by-Step Reasoning
-
What the statement claims
It says identifiers are names that identify a variable or a function. That's the core job of an identifier — to give a unique label to a program element so you can refer to it later.
-
What identifiers actually are
In any programming language, when you write
int age = 25;, the wordageis an identifier for a variable. When you writedef calculate():, the wordcalculateis an identifier for a function. Identifiers can also name classes, structures, constants, and more — but variables and functions are the most common examples. -
Checking the definition against standard sources
Every standard textbook and exam syllabus (CBSE, ICSE, ISC, etc.) defines identifiers exactly this way. For instance, in C: "Identifiers are names given to various program elements such as variables, functions, arrays, structures, etc." The given statement is a subset of that definition — it mentions only variables and functions, but that's still correct as far as it goes.
-
Is there any hidden trick? …
-
- CBSE 2023Set 91/11 markMCQQ.Which of the following is a valid keyword in Python?(a) false(b) return(c) non_local(d) none
›Reveal solutionSolution
The only valid Python keyword among the options is
return, asfalse,non_local, andnoneare either incorrectly cased or misspelled versions of actual keywords.Python keywords are special reserved words that have specific meanings and purposes in the language. They cannot be used as identifiers (like variable names, function names, or class names) because they are integral to Python's syntax and structure. Understanding keywords is fundamental to writing correct and readable Python code.
The core idea here is to identify which of the given strings is an exact match for one of Python's reserved keywords, paying close attention to spelling and case sensitivity. Python is a case-sensitive language, meaning
Falseis different fromfalse, andNoneis different fromnone.-
Understanding Python Keywords:
Python has a fixed set of keywords. These words are reserved by the language and cannot be used for any other purpose, such as naming variables or functions. They are essential for defining the structure and logic of Python programs. For example,
if,else,for,while,def,class,import,return,True,False,Noneare all keywords. -
Analyzing Option (a)
false:The string
falseis not a valid keyword in Python. Python usesFalse(with a capital 'F') as a keyword to represent the boolean value for falsity. Because Python is case-sensitive,false(lowercase 'f') is treated as a regular identifier, not a keyword.Watch outPython keywords are case-sensitive.
falseis not the same asFalse. Similarly,trueis not the same asTrue, andnoneis not the same asNone. -
Analyzing Option (b)
return:The string
returnis a valid keyword in Python. It is used within functions to send a value back to the caller and to exit the function's execution.def function_name(parameters):# function bodyreturn value -
Analyzing Option (c)
non_local: …
-
- CBSE 2023Set 91/41 markQ.State True or False. "Comments are not executed by interpreter."
›Reveal solutionSolution
Comments are ignored during execution — they exist only for human readers. True.
Why comments exist in the first place
When you write code, you're communicating with two audiences: the machine (which executes instructions) and other humans (including your future self) who need to understand why you made certain choices. Comments are annotations written in plain language that the interpreter or compiler deliberately skips over. They have zero effect on program behavior.
Think of comments as margin notes in a textbook — helpful for the reader, but the printing press doesn't "execute" them when producing the book.
How interpreters handle comments
Every programming language defines a syntax for comments (e.g.,
#in Python,//in C++,/* ... */in Java). During the parsing phase, the interpreter or compiler recognizes these markers and strips out everything marked as a comment before generating executable instructions.-
Lexical analysis: The interpreter scans the source code character by character. When it encounters a comment delimiter, it skips all subsequent characters until the comment ends (end of line for single-line comments, closing delimiter for multi-line).
-
No bytecode generation: Comments never make it into the intermediate representation (bytecode in Python, for instance) or machine code. They're discarded before execution begins.
-
Runtime: By the time your program runs, comments have vanished entirely from the interpreter's view. Only executable statements remain. …
-
- CBSE 2023Set 91/41 markMCQQ.Which of the following is not a sequential datatype in Python ?(a) Dictionary(b) String(c) List(d) Tuple
›Reveal solutionSolution
Sequence types are ordered and support positional (integer-index) access and slicing — String, List and Tuple all do. A Dictionary is a mapping (key → value), not a sequence. Correct option: (a) Dictionary.
Concept — what makes a type "sequential"
A sequence in Python stores items in positions numbered 0, 1, 2, … and therefore supports:
- indexing by position:
obj[0] - slicing:
obj[1:3] - ordered iteration by position
str,listandtupleare Python's classic sequence types. Adictstores key–value pairs: you look items up by key, not by position —d[0]means "the value whose key is0", not "the first item" — and slicing a dict raises an error. (Dicts do preserve insertion order since Python 3.7, but order alone does not make a sequence; positional indexing does.) A dictionary is classified as a mapping type.Checking each option
Option Type obj[0]Slicing Verdict (a) Dictionary mapping key lookup (KeyError if no key 0)TypeError not a sequence (b) String sequence 1st character works sequence (c) List sequence 1st element works sequence (d) Tuple sequence 1st element works sequence Demonstration:
s = "abc" L = [10, 20, 30] t = (1, 2, 3) d = {"x": 1, "y": 2} print(s[0], L[0], t[0]) # positional indexing on sequences print(s[0:2], L[0:2], t[0:2]) # slicing on sequences … - indexing by position:
- CBSE 2020Set 91/D1 markQ.Which of the following is not a valid variable name in Python? Justify reason for it not being a valid name.(i) 5Radius(ii) Radius_(iii) _Radius(iv) Radius
›Reveal solutionSolution
Python variable names must start with a letter or underscore, not a digit.
5Radiusstarts with a digit, so it is invalid. The valid names areRadius_,_Radius, andRadius.The core rule here is simple: Python follows the same naming convention as most programming languages — a variable name must begin with either a letter (a–z, A–Z) or an underscore (
_). It cannot start with a digit. After the first character, you can use letters, digits, or underscores freely.Why this rule? It prevents ambiguity. If
5Radiuswere allowed, the interpreter wouldn't know whether5is part of a number or a variable name. For example,5Radius + 3could be read as5(a number) plusRadius(a variable) plus3, or as a single variable5Radiusplus3. To avoid this confusion, the language simply forbids names starting with a digit.Let's check each option:
-
5Radius— Starts with the digit5. This violates the rule. Python will raise aSyntaxErrorif you try to use it.Watch outA common mistake is thinking that digits anywhere in a name are fine — they are, but not at the start.
Radius5is perfectly valid;5Radiusis not. -
Radius_— Starts with a letter (R), followed by letters and an underscore. Allowed. Perfectly valid. …
-
- CBSE 2020Set 91/D1 markQ.Which of the following are keywords in Python?(i) break(ii) check(iii) range(iv) while
›Reveal solutionSolution
Keywords are reserved words in Python with special meanings that cannot be used as identifiers;
breakandwhileare keywords, whilecheckandrangeare not. The correct keywords are (i) and (iv).Understanding Keywords in Python
In any programming language, certain words are reserved for special purposes. These are called keywords. Think of them as the fundamental building blocks or commands that the language itself understands directly. They have predefined meanings and functionalities, and you cannot use them for anything else, such as naming your variables, functions, or classes.
The reason for this reservation is to maintain clarity and avoid ambiguity. If you could name a variable
while, for instance, the Python interpreter wouldn't know if you meant to start a loop or refer to your variable. By reservingwhilefor loops, the language remains consistent and predictable.Python's set of keywords is relatively small and stable, making it easier to learn. Knowing which words are keywords is crucial because attempting to use a keyword as an identifier will result in a
SyntaxError.Identifying the Keywords
Let's examine each option to determine if it is a keyword in Python. A simple way to verify this in a Python environment is to use the
keywordmodule, specificallykeyword.iskeyword(), or to print the list of all keywords usingkeyword.kwlist.-
(i) breakbreakis a keyword in Python.- It is used to terminate the current loop (either
fororwhile) prematurely. Whenbreakis encountered, the loop is immediately exited, and execution continues with the statement following the loop.
# Example usage of 'break' for i in range(5): if i == 3: break print(i) # Output: # 0 # 1 # 2 -
(ii) checkcheckis not a keyword in Python.- It is a regular identifier that you can use to name variables, functions, or anything else you define. For example, you could have a variable named
check = Trueor a functiondef check_status():.
-
(iii) rangerangeis not a keyword in Python.- It is a built-in function that generates an immutable sequence of numbers. While
range()is fundamental and frequently used, it is a function that you call, not a reserved word with special syntax.
-
- CBSE 2020Set 91/D1 markQ.Which of the options out of(i) to(iv) is the correct data type for the variable Vowels as defined in the following Python statement? Vowels = ('A', 'E', 'I', 'O', 'U')(i) List(ii) Dictionary(iii) Tuple(iv) Array
›Reveal solutionSolution
The variable
Vowelsis assigned a sequence of characters enclosed in round parentheses( ), which in Python creates a tuple. The correct data type is therefore (iii) Tuple.The key here is to recognise how Python interprets different kinds of brackets. Many students confuse parentheses with square brackets or curly braces, but each has a distinct meaning.
Concept and intuition:
In Python, the way you wrap a collection of values tells the interpreter what data type to create.
- Square brackets
[ ]→ list - Curly braces
{ }→ dictionary (if key:value pairs) or set (if just values) - Round parentheses
( )→ tuple
A tuple is an immutable sequence — once created, you cannot change its elements. This is different from a list, which is mutable. The problem statement gives
Vowels = ('A', 'E', 'I', 'O', 'U'), so the outer parentheses are round, not square or curly.Let’s walk through each option:
-
Option (i) List — A list would be written as
['A', 'E', 'I', 'O', 'U']using square brackets. Since the code uses round parentheses, this is not a list. -
Option (ii) Dictionary — A dictionary stores key-value pairs, like
{'a': 1, 'b': 2}. The given data has no colons separating keys from values, so it cannot be a dictionary. -
Option (iii) Tuple — This is exactly what round parentheses create. Even though the parentheses are sometimes optional for tuples (e.g.,
'A', 'E', 'I', 'O', 'U'also makes a tuple), the explicit use of( )confirms it. So this is correct. …
- Square brackets
🎓Unlock everything free for 14 days
- ✓Full step-by-step solutions
- ✓Concept-first explanations
- ✓Methods, shortcuts & mistakes
- ✓PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.