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.
The 20 questions
-
In Haskell, what is the head of the list [4,3,5]?
- 3
- 5
- 4
- [3,5]
-
In Haskell, what is the tail of the list [4,3,5]?
- 5
- [4,3]
- [4]
- [3,5]
-
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]
-
What is the empty list in Haskell?
- NULL
- [[]]
- []
- [0]
-
Which list operation returns the total number of elements contained in a list?
- tail
- cons
- length
- head
-
Which list operation adds a new element to the front of an existing list?
- Append
- Head
- Prepend
- Tail
-
Which list operation attaches a new element or list to the end of a list?
- Head
- Append
- Prepend
- Cons
-
What does the test for an empty list return when it is applied to []?
- The empty list []
- False
- True
- The number 0
-
What is the result of 1 : [2,3]?
- [1,2,3]
- [2,3,1]
- [3,2,1]
- [1,[2,3]]
-
What is the length of the list [5,6,7,8]?
- 8
- 3
- 5
- 4
-
What occurs when attempting to return the head of an empty list?
- Runtime error
- Null value
- Zero
- Empty list
-
What is the tail of the single-element Haskell list [7]?
- []
- 7
- null
- [7]
-
Which expression correctly prepends the number 9 to the list xs?
- xs : 9
- xs ++ 9
- 9 ++ xs
- 9 : xs
-
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
-
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
-
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]
-
Why is prepending an item to a linked list faster than appending?
- Automatic indexing
- Fixed array size
- Garbage collection
- Direct head access
-
In functional programming, what type of construct is the tail of a list?
- A list
- A single element
- A primitive integer
- A pointer address
-
What technique is used in functional programming to drop the last element of a list?
- In-place deletion
- Global iteration
- Recursion
- Direct index lookup
-
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)
Related quizzes
- Function types and first-class objects Quiz · 4.12.1.1 · 20 questions
- Partial function application and composition of functions Quiz · 4.12.1.4 · 20 questions
- Writing functional programs Quiz · 4.12.2.1 · 20 questions
- Data types Quiz · 4.1.1.1 · 20 questions
- Entity relationship modelling Quiz · 4.10.1.1 · 20 questions
- Big Data Quiz · 4.11.1.1 · 20 questions
- Analysis Quiz · 4.13.1.1 · 20 questions
- Data structures and abstract data types Quiz · 4.2.1.1 · 20 questions
- Breadth-first and depth-first search Quiz · 4.3.1.1 · 20 questions
- Problem-solving and algorithms Quiz · 4.4.1.1 · 20 questions