🐍 Computational Thinking & Programming Quiz 2 — Python Basics (Class 11 CS)
Practice 15 CBSE Class 11 Computer Science (Code 083) MCQs on the basics of Python programming — introduction to Python, features of Python, execution modes, the Python character set, tokens (keywords, identifiers, literals, operators, punctuators), variables, l-value & r-value, and comments.
Tap any question to reveal the answer with a clear explanation — great for quick revision before a class test or the board exam.
🐍 Python Basics
Python is a:
- Compiler
- Interpreter
- High-level programming language
- Low-level programming language
Show Answer & Explanation
✅ Answer: (c) High-level programming language
Python is classified as a high-level programming language — its syntax reads close to English and it abstracts away hardware-level details. (Its code does get run through an interpreter, but “interpreter” describes how it’s executed, not what kind of language it is.)
🐍 Python Basics
Which of the following is a feature of Python?
- Strongly typed
- Compiled language
- Static typing
- Dynamically typed
Show Answer & Explanation
✅ Answer: (d) Dynamically typed
Python is dynamically typed — you don’t need to declare a variable’s data type; it’s decided automatically at runtime based on the value assigned. (Python is also strongly typed, but “dynamically typed” is the feature most commonly highlighted in the CBSE syllabus as distinguishing Python from languages like C++ or Java.)
▶️ Execution
How do you execute a “Hello World” program in Python?
- Save the program as a .txt file
- Use the print() function to display “Hello World”
- Use the input() function to get user input
- Use the main() function to run the program
Show Answer & Explanation
✅ Answer: (b) Use the print() function to display “Hello World”
The classic first Python program is simply print(“Hello World”) — the print() function outputs text to the console. Python doesn’t require a main() function like C/Java do.
▶️ Execution
What are the two execution modes in Python?
- Compile mode and run mode
- Debug mode and execute mode
- Interactive mode and script mode
- Static mode and dynamic mode
Show Answer & Explanation
✅ Answer: (c) Interactive mode and script mode
Python code can be run in interactive mode (typing statements one at a time at the >>> prompt and seeing immediate results) or script mode (writing a complete .py file and running it all at once).
🔤 Character Set
The Python character set is based on:
- ASCII
- Unicode
- UTF-8
- UTF-32
Show Answer & Explanation
✅ Answer: (b) Unicode
Python’s character set is based on Unicode — a much larger standard than ASCII that lets Python source code and strings represent virtually any character from any language in the world.
🧩 Tokens
Which of the following is a Python keyword?
- variable
- if
- function
- class
Show Answer & Explanation
✅ Answer: (b) if
if is a reserved Python keyword. Note: this question is slightly ambiguous in its original form — class is technically also a Python keyword (used to define a class), so both (b) and (d) are valid keywords. variable and function, however, are not keywords at all — Python uses def to define functions, and “variable” isn’t a reserved word.
🧩 Tokens
What is an identifier in Python?
- A value assigned to a variable
- A special character used in Python syntax
- A name used to identify a variable, function, or class
- A reserved word in the Python language
Show Answer & Explanation
✅ Answer: (c) A name used to identify a variable, function, or class
An identifier is simply the name you give to a variable, function, class, or other object — like marks or calculate_total. It’s how you refer to things in your code.
🧩 Tokens
Which of the following is a Python literal?
- + (plus)
- 3.14
- for
- print()
Show Answer & Explanation
✅ Answer: (b) 3.14
3.14 is a literal — a fixed value written directly into the code (here, a floating-point number). + is an operator, for is a keyword, and print() is a function call, not a literal value.
🧩 Tokens
What is the purpose of an operator in Python?
- To assign a value to a variable
- To declare a function
- To perform operations on data
- To display output on the console
Show Answer & Explanation
✅ Answer: (c) To perform operations on data
An operator (like +, -, ==, and) is a symbol used to perform operations on data — arithmetic, comparison, logical, and so on.
🧩 Tokens
What is a punctuator in Python?
- A symbol used for arithmetic operations
- A special character used in Python syntax
- A reserved word in the Python language
- A data type in Python
Show Answer & Explanation
✅ Answer: (b) A special character used in Python syntax
A punctuator is a special character that plays a structural role in Python’s syntax — symbols like :, ,, (, ), [, and ].
📦 Variables
What is the concept of l-value and r-value in Python?
- Left value and right value
- Local value and remote value
- Low value and high value
- Logical value and relational value
Show Answer & Explanation
✅ Answer: (a) Left value and right value
l-value stands for “left value” (the variable on the left side of an assignment, where a value is stored) and r-value stands for “right value” (the value or expression on the right side being assigned).
💬 Comments
How do you define a comment in Python?
- Using the // symbol
- Using the # symbol
- Using the /* */ symbols
- Using the <!– –> symbols
Show Answer & Explanation
✅ Answer: (b) Using the # symbol
Python uses the # symbol to mark a single-line comment — everything after it on that line is ignored by the interpreter. (// and /* */ are comment styles from C-family languages, not Python.)
📦 Variables
What is the purpose of variables in Python?
- To store and manipulate data
- To define functions
- To write comments
- To import modules
Show Answer & Explanation
✅ Answer: (a) To store and manipulate data
Variables exist to store and manipulate data while a program runs — holding values that can be read, changed, and used in calculations or logic.
📦 Variables
What is the use of an l-value in Python?
- To store the result of an expression
- To represent the left-hand side of an assignment
- To calculate mathematical operations
- To compare values in conditional statements
Show Answer & Explanation
✅ Answer: (b) To represent the left-hand side of an assignment
An l-value represents the left-hand side of an assignment — the variable that will receive and store the value produced by the right-hand side (the r-value).
💬 Comments
Which of the following is true about Python comments?
- They are executed as part of the program
- They provide explanations and improve code readability
- They are used for debugging purposes
- They are required to run a Python program
Show Answer & Explanation
✅ Answer: (b) They provide explanations and improve code readability
Comments exist purely to provide explanations and improve code readability for humans reading the code. They are never executed by the interpreter and are completely optional — a program runs perfectly fine without any comments at all.
