Core9X
Log inSign up

MBOSE Class X Computer Science · Chapter 9

C++ Operators and Expressions

Live now

How C++ operators work, from arithmetic and logical to increment and conditional operators, and how precedence decides how an expression is calculated.

22 lessons · 110 practice questions

Start freeLog inSign up free: the first chapter of every subject is open.

What this chapter covers

  • Operators and operands
  • Unary, binary and ternary operators
  • Arithmetic, relational, logical, assignment and compound assignment, increment and decrement (prefix and postfix), conditional, comma and sizeof operators
  • = vs ==
  • Precedence and associativity
  • Evaluating expressions
  • Type conversion
  • Writing formulas in C++

Key terms

operator

Meaning: symbol for an operation

Example: +

operand

Meaning: value an operator works on

Example: a, 5

expression

Meaning: operands and operators giving a value

Example: a + b

unary operator

Meaning: one operand

Example: -a, !a

binary operator

Meaning: two operands

Example: a * b

ternary operator

Meaning: three operands

Example: ? :

modulus

Meaning: remainder after division

Example: 17 % 5 = 2

relational operator

Meaning: compares two values

Example: >=

logical operator

Meaning: combines conditions

Example: &&

compound assignment

Meaning: arithmetic + assignment

Example: +=

prefix

Meaning: change, then use

Example: ++a

postfix

Meaning: use, then change

Example: a++

Important questions with answers

10 of the 110 questions on this chapter, solved.

  1. Question 1 · Multiple choice · 1 mark

    It is used to combine two expressions containing relational operators.

    • (a) Arithmetic operator
    • (b) Logical operator
    • (c) Relational operator
    • (d) Assignment operator

    Answer: (b) Logical operator

    MBOSE SSLC 2026, Q18.

  2. Question 2 · Multiple choice · 1 mark

    The value of 17 % 5 is

    • (a) 5
    • (b) 3
    • (c) 3.4
    • (d) 2

    Answer: (d) 2

    The remainder.

  3. Question 3 · Multiple choice · 1 mark

    The difference between = and == is that

    • (a) = compares, == assigns
    • (b) = assigns a value, == compares two values
    • (c) both assign
    • (d) both compare

    Answer: (b) = assigns a value, == compares two values

    SSLC 2025, Q35; 2026, Q36.

  4. Question 4 · Multiple choice · 1 mark

    The operator with the lowest precedence is the

    • (a) modulus operator
    • (b) assignment operator
    • (c) logical OR
    • (d) comma operator

    Answer: (d) comma operator

    See Fig. 9.3.

  5. Question 5 · Assertion and reason · 1 mark

    Assertion (A): 17 / 5 gives 3 in C++ when both are integers.

    Reason (R): Integer division drops the remainder.

    • (a) Both A and R are true, and R is the correct explanation of A.
    • (b) Both A and R are true, but R is not the correct explanation of A.
    • (c) A is true, but R is false.
    • (d) A is false, but R is true.

    Answer: (a) Both A and R are true, and R is the correct explanation of A.

    17 ÷ 5 = 3 remainder 2; only 3 is kept.

  6. Question 6 · Short answer · 2 marks

    What is the difference between = and ==?

    Answer

    = assigns a value (a = 5;); == compares two values and gives 1 or 0 (a == 5).

  7. Question 7 · Short answer · 2 marks

    How can the order of evaluation be changed?

    Answer

    By using parentheses: (2 + 3) * 4 = 20, not 14.

  8. Question 8 · Short answer · 3 marks

    Write the order of precedence of arithmetic, relational, logical and assignment operators.

    Answer

    Arithmetic (* / % then + -), then relational, then logical (&& before ||), then assignment.

  9. Question 9 · Long answer · 5 marks

    Explain the three logical operators with their symbols, purposes and examples.

    Answer

    Logical operators combine relational expressions and give 1 or 0. AND &&: true only if both conditions are true; (m >= 33) && (m <= 100). OR ||: true if at least one is true; (ch == 'a') || (ch == 'e'). NOT !: reverses the result; !(a > b). With a = 7: (a > 5) && (a < 10) is 1.

  10. Question 10 · Long answer · 5 marks

    Write a C++ program to accept marks in three subjects and display the total and average.

    Answer

    #include <iostream>
    using namespace std;
    int main()
    {
        int m1, m2, m3, total;
        float avg;
        cout << "Enter marks in three subjects: ";
        cin >> m1 >> m2 >> m3;
        total = m1 + m2 + m3;
        avg = total / 3.0;
        cout << "Total = " << total << endl;
        cout << "Average = " << avg << endl;
        return 0;
    }
    

Study the whole chapter

22 step-by-step lessons, all 110 practice questions with hints, flashcards and mock tests for MBOSE Class X Computer Science.

Start freeLog inSign up free: the first chapter of every subject is open.