CBSE Class 11 Computer Science Chapter 9: Operators in Python NCERT Solutions
This chapter provides essential NCERT Solutions for Class 11 Computer Science, focusing on Chapter 9: Operators in Python. Students will explore various types of operators used in Python programming, including arithmetic operators (+, -, *, /, %, **, //), assignment operators (+=), comparison (relational) operators, and logical operators. The solutions offer clear explanations and code outputs for different operator applications, helping students understand how these operators manipulate data and control program flow. This resource is crucial for grasping fundamental Python concepts and preparing for exams by reinforcing the practical application of operators in coding scenarios.
Quick info
| Board | CBSE |
|---|---|
| Class | Class 11 |
| Subject | Computer Science |
| Session | 2026 |
| Language | English |
| Type | NCERT Solutions |
| Chapter | Chapter 9 |
Chapter summary
Chapter 9 of the Class 11 Computer Science NCERT syllabus covers the fundamental concept of Operators in Python. The solutions detail arithmetic, assignment, comparison (relational), and logical operators. They explain the purpose and output of various operators through code examples, including augmented assignment and floor division. This chapter is key to understanding how Python expressions are evaluated and how data is manipulated.
Learning outcomes
- Understand the different types of operators in Python.
- Identify and explain the use of arithmetic operators.
- Recognize and apply assignment operators, including augmented assignment.
- Differentiate between comparison (relational) and logical operators.
- Predict the output of Python code involving various operators.
Topics covered
Paper topics
- Arithmetic Operators
- Assignment Operators
- Augmented Assignment Operators
- Comparison (Relational) Operators
- Logical Operators
- Operator Precedence
- Expression Evaluation
- Python Code Output
Important topics
- Arithmetic Operators (+, -, *, /, %, **, //)
- Assignment Operators (=, +=)
- Comparison Operators
- Understanding Code Output
- Floor Division vs. True Division
PDF preview
Read page by page below. PDF is streamed from the official NCERT website — no download button on this page.
Questions and Solutions
Question 1
print (a)
The code initializes a variable `a` to 0. The line `a += 2` is an augmented assignment operation, which is shorthand for `a = a + 2`. Therefore, `a` becomes 0 + 2, which is 2. Finally, `print(a)` displays the current value of `a`.
Output: 2
Question 2
print (3 + 4)
print (3-4)
print (3 * 4)
print (3/4)
print (3 % 2)
print (3**4) #3 to the fourth power
print (3 // 4) #floor division
This code demonstrates various arithmetic operations in Python:
3 + 4performs addition, resulting in 7.3 - 4performs subtraction, resulting in -1.3 * 4performs multiplication, resulting in 12.3 / 4performs true division, resulting in the float 0.75.3 % 2calculates the remainder of the division of 3 by 2, which is 1.3 ** 4calculates 3 raised to the power of 4 (3 * 3 * 3 * 3), resulting in 81.3 // 4performs floor division, returning the integer part of the quotient, which is 0.
Output: 7 -1 12 0.75 1 81 0
Question 3
if :
print("if")
elif a >= 21:
print("elif")
else:
print("else")
The code evaluates a series of conditional statements. The variable `a` is initialized to 20.
- The first condition is
if a >= 22. Since 20 is not greater than or equal to 22, this condition is false. - The next condition is
elif a >= 21. Since 20 is not greater than or equal to 21, this condition is also false. - As both the `if` and `elif` conditions are false, the code proceeds to the
elseblock. - The
elseblock containsprint("else"), which will be executed.
Output:
else
Question 4
Comparison Operators are also known as Relational Operators. They are used to compare values and return a boolean result (True or False).
Question 5
The Assignment Operator is used for assigning a value into a variable. The most common assignment operator is the equals sign (=).
Question 6
Comparison Operators (also known as Relational Operators) are used for the comparison of values. Examples include == (equal to), != (not equal to), > (greater than), < (less than), >= (greater than or equal to), and <= (less than or equal to).
Question 7
The + operator in Python serves two main purposes: it performs addition when used with numbers, and it performs concatenation when used with strings or other sequence types.
Question 8
The subtraction operator (-) subtracts the right-hand operand from the left-hand operand. For example, in 10 - 3, 3 is subtracted from 10.
Question 9
The * operator in Python performs multiplication when used with numbers. It multiplies the values on either side of the operator. For example, 5 * 6 results in 30.
Question 10
The division operator (/) divides the left-hand operand by the right-hand operand and returns the result as a floating-point number. For example, 10 / 4 results in 2.5.
Common mistakes
- Confusing the output of division (/) with floor division (//).
- Incorrectly predicting the output of modulo (%) operator.
- Misunderstanding the behavior of augmented assignment operators.
- Confusing the purpose of comparison operators with logical operators.
Revision tips
- Practice predicting the output of code snippets involving each type of operator.
- Pay close attention to the difference between `/` and `//` operators.
- Rewrite the code examples from the solutions to experiment with different values.
- Create your own simple programs using various operators to solidify understanding.
Practice MCQs
Q1. What is the output of the Python code: a = 0; a += 2; print(a)?
Explanation: The `+=` operator is an augmented assignment operator that adds the right operand to the left operand and assigns the result back to the left operand. So, 0 + 2 is assigned to 'a', resulting in 2.
Q2. Which operator is also known as a Comparison Operator?
Explanation: Comparison operators, which are used to compare values, are also commonly referred to as Relational Operators.
Q3. What is the primary use of the Assignment Operator?
Explanation: The Assignment Operator, typically represented by '=', is used to store a value in a variable.
Q4. Which operator performs division and returns the quotient as a floating-point number?
Explanation: The `/` operator in Python performs true division, always returning a float result, even if the division is exact.
Q5. What does the `**` operator do in Python?
Explanation: The `**` operator is used for exponentiation, calculating the power of a number (e.g., 3**4 means 3 raised to the power of 4).
Frequently asked questions
What are the main types of operators covered in Chapter 9?
Chapter 9 covers Arithmetic Operators, Assignment Operators, Comparison (Relational) Operators, and Logical Operators.
What is the difference between `/` and `//` in Python?
The `/` operator performs true division and returns a float, while the `//` operator performs floor division and returns the integer part of the quotient.
How can these NCERT Solutions help with exam preparation?
These solutions provide clear explanations and correct outputs for various operator-related Python code snippets, helping students understand concepts and practice predicting code behavior for exams.
What does the `a += 2` syntax mean in Python?
It's an augmented assignment operator, equivalent to `a = a + 2`. It adds 2 to the current value of 'a' and updates 'a' with the result.
Are comparison operators the same as logical operators?
No, comparison operators (like >, <, ==) compare values and return True or False. Logical operators (like and, or, not) combine multiple boolean expressions.
Content reviewed by the NCERT Help team. Editorial Team and update policy
NCERT Solutions PDF PDF on NCERT Help. URL unchanged for search indexing.