logo

Question detail

Which pseudocode uses selection to output the larger of two values, x and y?

Try the question, check the answer, then read the explanation to understand the curriculum point.

At a glance

MCQ

Type

practice

Style

Topic

Abstraction and automation

Exam-style question

Try this first

Which pseudocode uses selection to output the larger of two values, x and y?.

  1. A.OUTPUT x + y
  2. B.IF x > y THEN OUTPUT x ELSE OUTPUT y
  3. C.FOR count <- 1 TO x OUTPUT y NEXT count
  4. D.larger <- x + y

Model answer

What a good answer should say

  • IF x > y THEN OUTPUT x ELSE OUTPUT y

Explanation

Why this works

Selection chooses between alternative paths. This algorithm tests a condition and outputs either x or y.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions

No questions are published for this page yet.