Lesson 4.12.3.1

4.12.3.1 List processing Quiz: AQA Computer Science, Unit 12

20 questions

In partnership with Revision Ninja

Lesson 4.12.3.1, List processing: 20 multiple choice questions for the AQA Computer Science (7517), Unit 12: Fundamentals of functional 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. In Haskell, what is the head of the list [4,3,5]?

    • 3
    • 5
    • 4
    • [3,5]
  2. In Haskell, what is the tail of the list [4,3,5]?

    • 5
    • [4,3]
    • [4]
    • [3,5]
  3. Which expression writes the list [4,3,5] in head and tail form?

    • 4 : [3,5]
    • [4] : [3,5]
    • [4,3] : 5
    • 5 : [4,3]
  4. What is the empty list in Haskell?

    • NULL
    • [[]]
    • []
    • [0]
  5. Which list operation returns the total number of elements contained in a list?

    • tail
    • cons
    • length
    • head
  6. Which list operation adds a new element to the front of an existing list?

    • Append
    • Head
    • Prepend
    • Tail
  7. Which list operation attaches a new element or list to the end of a list?

    • Head
    • Append
    • Prepend
    • Cons
  8. What does the test for an empty list return when it is applied to []?

    • The empty list []
    • False
    • True
    • The number 0
  9. What is the result of 1 : [2,3]?

    • [1,2,3]
    • [2,3,1]
    • [3,2,1]
    • [1,[2,3]]
  10. What is the length of the list [5,6,7,8]?

    • 8
    • 3
    • 5
    • 4
  11. What occurs when attempting to return the head of an empty list?

    • Runtime error
    • Null value
    • Zero
    • Empty list
  12. What is the tail of the single-element Haskell list [7]?

    • []
    • 7
    • null
    • [7]
  13. Which expression correctly prepends the number 9 to the list xs?

    • xs : 9
    • xs ++ 9
    • 9 ++ xs
    • 9 : xs
  14. A function sumList is defined with sumList [] = 0 and sumList (x:xs) = x + sumList xs. What does sumList [1,2,3] return?

    • 3
    • 0
    • 6
    • 5
  15. A function countList is defined with countList [] = 0 and countList (_:xs) = 1 + countList xs. What does countList [4,4,4] return?

    • 4
    • 0
    • 3
    • 12
  16. What is the result of [1,2] ++ [3,4]?

    • [4,3,2,1]
    • [1,2,[3,4]]
    • [3,4,1,2]
    • [1,2,3,4]
  17. Why is prepending an item to a linked list faster than appending?

    • Automatic indexing
    • Fixed array size
    • Garbage collection
    • Direct head access
  18. In functional programming, what type of construct is the tail of a list?

    • A list
    • A single element
    • A primitive integer
    • A pointer address
  19. What technique is used in functional programming to drop the last element of a list?

    • In-place deletion
    • Global iteration
    • Recursion
    • Direct index lookup
  20. What time complexity describes finding the last element of a linked list of length n?

    • O(1)
    • O(n)
    • O(n^2)
    • O(log n)

All AQA Computer Science quizzes