Lesson 4.12.1.1

4.12.1.1 Function types and first-class objects Quiz: AQA Computer Science, Unit 12

20 questions

In partnership with Revision Ninja

Lesson 4.12.1.1, Function types and first-class objects: 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 the function type signature f: A -> B, what term is given to set A?

    • Co-domain
    • Domain
    • Range
    • Cartesian product
  2. In the function type signature f: A -> B, what term is given to set B?

    • Argument type
    • Range
    • Domain
    • Co-domain
  3. In functional programming, what does the expression f: A -> B declare?

    • Function type
    • Function application
    • Lambda expression
    • Function composition
  4. What term describes the set from which all potential output values of a function are chosen?

    • Range
    • Co-domain
    • Domain
    • Cartesian product
  5. For a function f: {a..z} -> {0..25}, what is the domain of f?

    • Empty set
    • Set {0..25}
    • Set of integers
    • Set {a..z}
  6. A function has the type signature Integer x Integer -> Integer. What is its argument type?

    • Single Integer
    • Cartesian product
    • Integer array
    • Boolean tuple
  7. What term refers to the process of passing an argument to a function to calculate its result?

    • Type inference
    • Partial evaluation
    • Function composition
    • Function application
  8. What is the type of the function f(x) = x + 2 on the integers?

    • integer -> integer
    • string -> integer
    • integer x integer -> integer
    • real -> boolean
  9. Which construct in functional programming can be passed as an argument and returned from functions?

    • First-class object
    • Control structure
    • Syntax keyword
    • Compiler directive
  10. Why is a function considered a first-class object in functional programming?

    • Has global scope
    • Passable as argument
    • Modifies shared memory
    • Runs in parallel
  11. Which basic data type is treated as a first-class object in almost all programming languages?

    • Import statement
    • Class declaration
    • Integer
    • While loop
  12. For the function f: Integer -> Boolean defined by f(x) = x > 0, what is the co-domain?

    • Boolean
    • Integer
    • String
    • Real
  13. A function g maps days of the week to the integers 1 to 7. What is the domain?

    • Boolean values
    • Real numbers
    • Integers 1 to 7
    • Days of week
  14. What term describes the set of co-domain values actually produced by applying a function?

    • Type signature
    • Cartesian product
    • Range
    • Domain
  15. For a function with type string -> integer, what is the output data type?

    • String
    • Boolean
    • Integer
    • Float
  16. How many outputs in set B does a function f: A -> B assign to each element in set A?

    • Two or more
    • At least one
    • Exactly one
    • Zero or more
  17. A function f: {1,2,3} -> {0,...,6} is defined by f(x) = 2x. Which set is the set of outputs actually produced?

    • {2, 4, 6, 8}
    • {1, 2, 3}
    • {0, 1, 2, 3, 4, 5, 6}
    • {2, 4, 6}
  18. A function reads a character and returns its position in the alphabet. What is its type?

    • char -> integer
    • char x char -> integer
    • string -> string
    • integer -> char
  19. In the function type definition f: A -> B, what set is represented by B?

    • Input set
    • Co-domain
    • Domain
    • Argument type
  20. What term describes a function that can be passed as an argument or returned from another function?

    • Partial function
    • Curried procedure
    • Higher-order statement
    • First-class object

All AQA Computer Science quizzes