logo

AQA A-Level Computer Science practice

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

Try the question first, then check the answer and practise the same topic again.

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

Answer and explanation

Concise answer

IF x > y THEN OUTPUT x ELSE OUTPUT y

Why this is correct

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

Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions