Lesson 4.1.1.8

4.1.1.8 Random numbers and exception handling Quiz: AQA Computer Science, Unit 1

20 questions

In partnership with Revision Ninja

Lesson 4.1.1.8, Random numbers and exception handling: 20 multiple choice questions for the AQA Computer Science (7517), Unit 1: Fundamentals of programming, written with Revision Ninja.

Host it live on the board and students join with a game code on their own devices, or revise alone with Free Play. The answers are revealed in the game.

Host this setFree Play

The 20 questions

  1. What is the defining characteristic of values generated by a random number function?

    • Sequentially increasing values
    • Unpredictable within range
    • Fixed constant values
    • Deterministic repeating sequence
  2. Which data generation method is best suited to simulate rolling a standard six-sided die?

    • String to integer
    • Random float 0-1
    • Random integer 1-6
    • Sequential integer counter
  3. What is an exception in programming?

    • Hardware component failure
    • Logical algorithm flaw
    • Unexpected runtime error
    • Syntax compilation error
  4. What keyword is used in Python to define a block of code for exception handling?

    • catch
    • except
    • error
    • try
  5. Which language construct is used to catch and handle runtime exceptions?

    • While loop
    • If-else statement
    • Try-catch block
    • For loop
  6. Which component typically handles an unhandled exception crashing a program?

    • Interpreter
    • Programmer
    • Operating System
    • Compiler
  7. What values can a random integer generator set to range 10-20 inclusive return?

    • Only integers 11-19
    • Only 10 or 20
    • Any integer 10-20
    • Any number 10-20
  8. What outcome suggests a pseudo-random generator is unseeded or misused?

    • Out-of-bounds error
    • Increasing numeric sequence
    • Fractional values only
    • Repeated identical outputs
  9. Why is exception handling needed when converting user string input to an integer?

    • Input non-numeric
    • Input already integer
    • Input too large
    • Memory limit reached
  10. A random integer from 1 to 4 is generated, and one is added to it. What range of values is possible?

    • 1 to 4
    • 2 to 5
    • 0 to 4
    • 1 to 5
  11. Which data type is returned by a random generator producing decimal values between 0 and 1?

    • Integer
    • String
    • Real
    • Boolean
  12. What type of error does exception handling primarily protect against during execution?

    • Logical error
    • Compile error
    • Syntax error
    • Runtime error
  13. How does exception handling improve user experience during invalid data entry?

    • Exits the software
    • Auto-corrects spelling
    • Hides the keyboard
    • Allows input retry
  14. If a pseudo-random number generator outputs 3, what is guaranteed on the next call?

    • It outputs 3 again
    • It outputs 2
    • Nothing is guaranteed
    • It outputs 4
  15. Which integer range selects a random item from a zero-indexed array of 5 elements?

    • 1 to 5
    • 0 to 4
    • 0 to 5
    • 1 to 4
  16. What primary structural benefit does exception handling provide in software design?

    • Eliminates all bugs
    • Speeds up compilation
    • Separates error logic
    • Reduces file size
  17. Which random generation setting best simulates a fair two-sided coin flip?

    • Integer from 1 to 3
    • Real from 0 to 1
    • Integer from 0 to 1
    • Real from 0 to 2
  18. What term describes computer-generated numbers that simulate true randomness?

    • Truly random numbers
    • Sequential numbers
    • Binary digits
    • Pseudo-random numbers
  19. Which programming techniques drive unpredictable flow and protect against errors?

    • Recursive and sorted
    • Static and global
    • Linear and iterative
    • Random and exception
  20. What is the chance of a fair six-sided die giving a 6 on one roll?

    • 1 in 36
    • 1 in 2
    • 6 in 1
    • 1 in 6

All AQA Computer Science quizzes