CBSE Class 11 Computer Science: Operators in Python NCERT Solutions

NCERT Solutions PDF Class 11 PDF

This chapter provides NCERT Solutions for Class 11 Computer Science, focusing on Operators in Python. It covers various types of operators, including arithmetic operators (+, -, *, /, %, **, //), comparison (relational) operators, and assignment operators. The solutions explain the output of Python code snippets involving these operators and clarify their specific uses. Understanding operators is fundamental to writing effective Python programs, enabling data manipulation and control flow. These solutions offer clear explanations and step-by-step derivations for code outputs, aiding students in grasping the concepts and preparing for their examinations by reinforcing practical application of Python's operator functionalities.

Quick info

BoardCBSE
ClassClass 11
SubjectComputer Science
Session2026
LanguageEnglish
TypeNCERT Solutions
Chapter9. Operators in Python

Chapter summary

Chapter 9, Operators in Python, details the essential building blocks for performing operations in Python programming. This NCERT Solutions set covers arithmetic, comparison, and assignment operators. It includes explanations of operator precedence and how they are used in code, with examples demonstrating their output. The solutions are designed to help students understand the functionality of each operator type and how to interpret Python code involving them.

Learning outcomes

  • Understand the concept and types of operators in Python.
  • Identify and explain the use of arithmetic operators.
  • Determine the output of Python code involving arithmetic operations.
  • Recognize and differentiate between comparison and assignment operators.
  • Interpret the results of conditional statements based on operator comparisons.

Topics covered

Paper topics

  • Arithmetic Operators
  • Addition Operator (+)
  • Subtraction Operator (-)
  • Multiplication Operator (*)
  • Division Operator (/)
  • Modulo Operator (%)
  • Exponentiation Operator (**)
  • Floor Division Operator (//)
  • Assignment Operators
  • Comparison Operators
  • Relational Operators

Important topics

  • Arithmetic Operators and their outputs
  • Floor Division vs. Standard Division
  • Exponentiation Operator
  • Assignment Operators
  • Comparison (Relational) Operators

PDF preview

Read page by page below. PDF is streamed from the official NCERT website — no download button on this page.

Loading document …
Page of
Loading page …

Questions and Solutions

Question 1

Write the output of the given Python code:

a = 0

a += 2

print(a)

Solution:

The code initializes a variable a to 0. The line a += 2 is an augmented assignment operation, equivalent to a = a + 2. Therefore, the value of a becomes 0 + 2, which is 2. Finally, print(a) displays the current value of a.

Output: 2

Question 2

Write the output of the given Python code:

(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

Solution:

This code demonstrates various arithmetic operations in Python:

  • 3 + 4 results in addition: 7
  • 3 - 4 results in subtraction: -1
  • 3 * 4 results in multiplication: 12
  • 3 / 4 results in float division: 0.75
  • 3 % 2 is the modulo operator, giving the remainder of the division: 1
  • 3 ** 4 is the exponentiation operator, calculating 3 raised to the power of 4: 81
  • 3 // 4 is the floor division operator, dividing and rounding down to the nearest whole number: 0

Output: 7 -1 12 0.75 1 81 0

Question 3

Write the output of the given Python code:

a = 20

if a >= 22:

print("if")

elif a >= 21:

print("elif")

else:

print("else")

Solution:

The code evaluates a conditional statement. The variable a is initialized to 20. The first condition if a >= 22 is false because 20 is not greater than or equal to 22. The next condition elif a >= 21 is also false because 20 is not greater than or equal to 21. Since both the if and elif conditions are false, the code proceeds to the else block, which is then executed.

Output:

else

Question 4

What is the another name of Comparison Operators?
Solution:

Comparison Operators are also known as Relational Operators. They are used to compare values and return a boolean result (True or False).

Question 5

Which Operator is used for assigning a value into a variable?
Solution:

The Assignment Operator is used for assigning a value into a variable. The most common assignment operator is the equals sign (=).

Question 6

Which Operator is used for comparison of values?
Solution:

The operators used for comparison of values are Comparison Operators, also known as Relational Operators. Examples include == (equal to), != (not equal to), > (greater than), < (less than), >= (greater than or equal to), and <= (less than or equal to).

Question 7

What is the use of "+" operator?
Solution:

The + operator in Python serves two main purposes: it performs addition when used with numeric types (integers and floats), and it performs concatenation when used with sequence types like strings or lists.

Question 8

What is the use of operator?
Solution:

The - operator is the subtraction operator. It subtracts the right-hand operand from the left-hand operand when used with numeric types.

Question 9

What is the use of "*" operator?
Solution:

The * operator in Python performs multiplication when used with numeric types (integers and floats). It can also be used for sequence repetition, for example, multiplying a string by an integer repeats the string.

Question 10

What is the use of operator?
Solution:

The / operator is the division operator. It performs float division, dividing the left-hand operand by the right-hand operand and returning the result as a floating-point number.

Common mistakes

  • Confusing the output of integer division (//) with float division (/).
  • Incorrectly predicting the output of exponentiation (**).
  • Misinterpreting the behavior of comparison operators in conditional statements.
  • Confusing the purpose of logical operators with comparison operators.

Revision tips

  • Practice writing and executing Python code snippets with different operators to observe their outputs.
  • Create a cheat sheet summarizing the different operator types and their symbols.
  • Focus on understanding the difference between floor division (//) and standard division (/).
  • Review the conditional statements (if-elif-else) and how comparison operators affect their execution.

Practice MCQs

Q1. What will be the output of the Python code: a = 5; a += 2; print(a)?

Q2. Which operator is used for exponentiation in Python?

Q3. What is the output of print(3 // 4)?

Q4. Which of the following is another name for Comparison Operators?

Q5. What does the assignment operator '=' do?

Frequently asked questions

What are the main types of operators covered in Chapter 9?

Chapter 9 covers Arithmetic Operators (like +, -, *, /, %, **, //), Comparison Operators (also known as Relational Operators), and Assignment Operators.

What is the difference between '/' and '//' operators in Python?

The '/' operator performs standard division and returns a float. The '//' operator performs floor division, which divides and rounds down to the nearest whole number.

What is the purpose of the '+=' operator?

The '+=' operator is an augmented assignment operator. It adds the value on the right to the variable on the left and updates the variable with the result.

Are Comparison Operators the same as Logical Operators?

No, Comparison Operators (or Relational Operators) are used to compare values (e.g., >, <, ==). Logical Operators (like 'and', 'or', 'not') are used to combine conditional statements.

How do these NCERT Solutions help with exam preparation?

These solutions provide clear explanations and step-by-step outputs for Python code involving operators, helping students understand their functionality and predict results accurately for exams.

Content reviewed by the NCERT Help team. Editorial Team and update policy

NCERT Solutions PDF PDF on NCERT Help. URL unchanged for search indexing.