Lesson 4.1.1.6
4.1.1.6 Constants and variables Quiz: AQA Computer Science, Unit 1
20 questions
In partnership with Revision Ninja
Lesson 4.1.1.6, Constants and variables: 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 key feature of a constant compared to a variable?
- Fixed value
- Local scope
- Dynamic value
- Global scope
-
What is the primary maintenance benefit of using a named constant?
- Single update point
- Lower memory usage
- Faster execution speed
- Automatic type inference
-
What term describes a named value that cannot be changed during runtime?
- Array
- Constant
- Variable
- Pointer
-
Which operation stores a computed value inside a variable?
- Initialisation
- Assignment
- Iteration
- Declaration
-
Which name follows common convention for a named constant that holds the number of days in a week?
- daysInWeekCount
- 7 days in a week
- DaysInWeekTotalValue
- DAYS_IN_WEEK
-
Given a constant TAX_RATE and variable price, which value can be reassigned at runtime?
- Both identifiers
- Neither identifier
- price
- TAX_RATE
-
What is the term for assigning a starting value to a variable?
- Declaration
- Assignment
- Instantiation
- Initialisation
-
CONST MAX = 10 is declared, and the code later uses MAX * 2. What is the value?
- 20
- 10
- 5
- 12
-
x := 5, then x := x + 3. What is the final value of x?
- 8
- 15
- 3
- 5
-
A constant GST_RATE = 0.2 is applied to a price of 50 to find the tax. What is the tax?
- 15
- 250
- 5
- 10
-
What type of error is raised when attempting to alter a constant value?
- Overflow error
- Compilation error
- Logic error
- Runtime error
-
To swap the values of variables a and b, which sequence of statements works correctly?
- a := b; b := a; temp := a
- temp := a; a := b; b := temp
- temp := b; a := a; b := temp
- a := a + b; b := a; temp := b
-
A variable count is set to 0 and incremented once inside a loop that runs 4 times. What is count at the end?
- 3
- 5
- 0
- 4
-
Which identifier is most meaningful for storing the number of students enrolled on a course?
- numberOfStudents
- x
- students123
- num
-
What is a key advantage of using a named constant instead of a hardcoded value?
- Reduced memory usage
- Faster execution speed
- Automatic type conversion
- Single location update
-
A total variable is initialised to 0. Then 5 is added three times and 2 is subtracted once. What is the final total?
- 3
- 10
- 15
- 13
-
A constant RATE = 0.05 is applied as compound interest to a balance of 100 for 2 years. What is the balance at the end, to 2 decimal places?
- 110.00
- 105.00
- 110.25
- 115.50
-
Which programming construct prevents hardcoding the same literal value in multiple places?
- Named constant
- Local variable
- Global variable
- Subroutine parameter
-
What happens if a running total variable is not initialised to zero before a calculation?
- Syntax error
- Type mismatch error
- Infinite loop
- Incorrect cumulative total
-
Why use a named constant like PI instead of repeating the literal value 3.14159?
- Increases execution speed
- Improves code readability
- Saves RAM allocation
- Prevents compilation errors
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
- String-handling operations Quiz · 4.1.1.7 · 20 questions
- Random numbers and exception handling Quiz · 4.1.1.8 · 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