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.
The 20 questions
-
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
-
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
-
What is an exception in programming?
- Hardware component failure
- Logical algorithm flaw
- Unexpected runtime error
- Syntax compilation error
-
What keyword is used in Python to define a block of code for exception handling?
- catch
- except
- error
- try
-
Which language construct is used to catch and handle runtime exceptions?
- While loop
- If-else statement
- Try-catch block
- For loop
-
Which component typically handles an unhandled exception crashing a program?
- Interpreter
- Programmer
- Operating System
- Compiler
-
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
-
What outcome suggests a pseudo-random generator is unseeded or misused?
- Out-of-bounds error
- Increasing numeric sequence
- Fractional values only
- Repeated identical outputs
-
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
-
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
-
Which data type is returned by a random generator producing decimal values between 0 and 1?
- Integer
- String
- Real
- Boolean
-
What type of error does exception handling primarily protect against during execution?
- Logical error
- Compile error
- Syntax error
- Runtime error
-
How does exception handling improve user experience during invalid data entry?
- Exits the software
- Auto-corrects spelling
- Hides the keyboard
- Allows input retry
-
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
-
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
-
What primary structural benefit does exception handling provide in software design?
- Eliminates all bugs
- Speeds up compilation
- Separates error logic
- Reduces file size
-
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
-
What term describes computer-generated numbers that simulate true randomness?
- Truly random numbers
- Sequential numbers
- Binary digits
- Pseudo-random numbers
-
Which programming techniques drive unpredictable flow and protect against errors?
- Recursive and sorted
- Static and global
- Linear and iterative
- Random and exception
-
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
Related quizzes
- Data types Quiz · 4.1.1.1 · 20 questions
- Programming concepts: sequence, selection and iteration Quiz · 4.1.1.2 · 20 questions
- Arithmetic operations Quiz · 4.1.1.3 · 20 questions
- Relational and Boolean operations Quiz · 4.1.1.4 · 20 questions
- Constants and variables Quiz · 4.1.1.6 · 20 questions
- String-handling operations Quiz · 4.1.1.7 · 20 questions
- Subroutines Quiz · 4.1.1.10 · 20 questions
- Parameters and returning values Quiz · 4.1.1.11 · 20 questions
- Local and global variables Quiz · 4.1.1.13 · 20 questions
- Stack frames in subroutine calls Quiz · 4.1.1.15 · 20 questions