MCQ Single Best Answer Easy

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

ID: #24265 ICSE Computer Application - Class X - 2025 SPECIMEN QUESTION PAPER 52 views
Question Info
#24265Q ID
EasyDifficulty
ICSE Computer Application - Class X - 2025 SPECIMEN QUESTION PAPERTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A void compute (int a, int b)
  • B boolean compute (int a, int b)
  • C Boolean compute (int a,b)
  • D int compute (int a, int b)
Correct Answer: Option C

Explanation

Requirement:

  • Method name: compute

  • Accepts two integer arguments(int a, int b)

  • Returns true/false → the return type should be boolean


Step 1: Check options

(a) void compute(int a, int b) → ❌ void means no return value

(b) boolean compute(int a, int b) → ✅ Correct, returns a primitive boolean

(c) Boolean compute(int a, int b) → ✅ Technically correct too, returns wrapper class Boolean, but usually we use boolean for primitives

(d) int compute(int a, int b) → ❌ Returns integer, not true/false


Best Answer: (b) boolean compute(int a, int b)

Note: Option (c) is technically valid but primitive boolean is standard for such cases.

Share This Question

Challenge a friend or share with your study group.