Skip to content
Question

Q.What will be the output of the following query ? SELECT POWER(2,MOD(17,3)); (A) 8 (B) 1 (C) 0 (D) 4

CBSECBSE Class XII Board 2024MCQ· 1mImportance★★★★★
🔒 Locked · start free trial →

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 →

The query calculates 2 raised to the power of the remainder when 17 is divided by 3, giving 4. This is a common CBSE Class 12 Informatics Practices SQL math-function question.

In SQL, mathematical functions let you perform calculations directly inside a query. The query SELECT POWER(2,MOD(17,3)); nests two of them — MOD() and POWER() — so we evaluate it from the innermost function outward.

First the MOD() function:

  • MOD(dividend, divisor) returns the remainder when dividend is divided by divisor (the modulo operation).

Here the innermost call is MOD(17,3). Dividing 17 by 3 gives a quotient of 5 and a remainder of 2, because 17 = 3 × 5 + 2. So MOD(17,3) evaluates to 2.

Note

MOD() is handy for checking even or odd numbers (MOD(n, 2) = 0 means even), cyclic operations, and distributing items into groups.

Next, the result of MOD() (which is 2) becomes the second argument of POWER(), so the query effectively becomes SELECT POWER(2, 2);.

Now the POWER() function: …

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.