TK Study

Multiple choice › Algorithms (random numbers)

Algorithms (random numbers)

1. Algorithms (random numbers)

The function rand(low, high) produces a random integer from low to high inclusive. What is the full range of possible values produced by the statement: rand(20, 30) – rand(5, 10)?

  1. 10 to 25
  2. 15 to 20
  3. 25 to 40
  4. 30 to 35
Answer

A

NESA answer key: A. Minimum 20-10 = 10, maximum 30-5 = 25. Old syllabus (SDD): useful as overlap practice only.