Method prototype for the method compute which accepts two integer arguments and returns true/false.

ICSE Class 10 Computer Applications PYQ · 2025 Specimen · Section A

1(xii)1 Mark · 2025 · Section A · 2025 Specimen

Method prototype for the method compute which accepts two integer arguments and returns true/false.

Show SolutionHide Solution↓

boolean compute (int a, int b)

Reason — Let's analyse the given options:

  1. void compute (int a, int b) — Incorrect because void means the method does not return any value, but the question requires the method to return true/false.

  2. boolean compute (int a, int b) — Correct because it returns a boolean value (true or false) and accepts two integer arguments.

  3. Boolean compute (int a, b) — Incorrect due to syntax error (int b is not fully declared). Also, Boolean is a wrapper class, not a primitive boolean.

  4. int compute (int a, int b) — Incorrect because the return type is int, not boolean.

← Previous questionNext question →

Browse the free Computer Applications sample bank