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.

Host this setFree Play

The 20 questions

  1. What is the key feature of a constant compared to a variable?

    • Fixed value
    • Local scope
    • Dynamic value
    • Global scope
  2. What is the primary maintenance benefit of using a named constant?

    • Single update point
    • Lower memory usage
    • Faster execution speed
    • Automatic type inference
  3. What term describes a named value that cannot be changed during runtime?

    • Array
    • Constant
    • Variable
    • Pointer
  4. Which operation stores a computed value inside a variable?

    • Initialisation
    • Assignment
    • Iteration
    • Declaration
  5. 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
  6. Given a constant TAX_RATE and variable price, which value can be reassigned at runtime?

    • Both identifiers
    • Neither identifier
    • price
    • TAX_RATE
  7. What is the term for assigning a starting value to a variable?

    • Declaration
    • Assignment
    • Instantiation
    • Initialisation
  8. CONST MAX = 10 is declared, and the code later uses MAX * 2. What is the value?

    • 20
    • 10
    • 5
    • 12
  9. x := 5, then x := x + 3. What is the final value of x?

    • 8
    • 15
    • 3
    • 5
  10. 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
  11. What type of error is raised when attempting to alter a constant value?

    • Overflow error
    • Compilation error
    • Logic error
    • Runtime error
  12. 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
  13. 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
  14. Which identifier is most meaningful for storing the number of students enrolled on a course?

    • numberOfStudents
    • x
    • students123
    • num
  15. 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
  16. 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
  17. 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
  18. Which programming construct prevents hardcoding the same literal value in multiple places?

    • Named constant
    • Local variable
    • Global variable
    • Subroutine parameter
  19. 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
  20. 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

All AQA Computer Science quizzes