Lesson 4.4.1.10

4.4.1.10 Composition Quiz: AQA Computer Science, Unit 4

20 questions

In partnership with Revision Ninja

Lesson 4.4.1.10, Composition: 20 multiple choice questions for the AQA Computer Science (7517), Unit 4: Theory of computation, 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 a composition abstraction?

    • Building a compound procedure by combining simpler procedures
    • Deleting unused code from a program
    • Hiding the method used by a procedure so that only its outcome is visible to callers
    • Dividing a list into equal parts
  2. Which of these is an example of composing procedures?

    • Printing a single line of text
    • Declaring an unused constant
    • Storing a number in a variable so that it can be printed on the screen later
    • Passing the output of one function as the input to another
  3. What does the expression f(g(x)) represent?

    • Applying f to x and then applying g to the result
    • Multiplying f and g together
    • Comparing f with g
    • Applying g to x and then applying f to the result
  4. Which example illustrates a data abstraction built by composition?

    • A tree of nodes that hold values and references to their child nodes
    • A constant with a fixed value
    • A sentence written in English
    • A single integer variable that holds one value at a time for the whole program
  5. A record for a student contains a name (string), a date of birth (date) and a list of grades. What is this?

    • A single integer variable holding only the student age and nothing else
    • Compound data formed by combining simpler data objects
    • A recursive function
    • Information hiding
  6. Which statement about composition is correct?

    • Composition combines simpler parts to form a larger whole
    • Composition removes parts from a system so that it is smaller and faster to run
    • Composition only applies to hardware
    • Composition requires the parts to be identical
  7. A program calculates a total price by first calling a function to find the tax and then a function to add it. Which principle is shown?

    • Bubble sort
    • Representational abstraction
    • Binary search
    • Composition of procedures
  8. Which pair shows a compound object built from simpler objects?

    • A boolean value that is either true or false and nothing more about it
    • A constant named PI
    • A comment in code
    • A list whose items are themselves lists
  9. A stack is built from an array and a pointer. Which principle is shown?

    • A single constant with a fixed value that never changes during execution
    • Problem reduction
    • Automation
    • Composition of data objects
  10. What is the result of composing two procedures that each take a number and return a number, where the first doubles and the second adds 3?

    • For input 5 the result is 13
    • For input 5 the result is 8
    • For input 5 the result is 15
    • For input 5 the result is 5
  11. Two procedures are composed so that the first returns a list and the second sums it. What is the result for the list [1, 2, 3]?

    • 123
    • [1, 2, 3]
    • 6
    • 3
  12. Which property is the key benefit of composition in software?

    • Data is always duplicated
    • Each program must rewrite its parts from scratch, so reuse is not possible at all
    • Programs can run without any parts
    • Reusable parts can be combined in new ways without rewriting them
  13. Which statement distinguishes composition from decomposition?

    • Decomposition divides a problem into parts, whereas composition builds a whole from parts
    • Composition only applies to graphics
    • They are the same process
    • Decomposition builds a whole from parts, whereas composition divides a problem
  14. A procedure is built from a sequence of smaller procedures, each used once. Which abstraction is this?

    • Representational abstraction
    • Information hiding
    • Sorting
    • Composition of procedures
  15. What does a binary tree gain from being built by composition?

    • Automatic sorting of its values
    • The ability to represent hierarchical data with nodes linked to child nodes
    • Reduced memory needs of exactly one byte
    • Immunity from errors
  16. A function returns a pair of values, and another function uses both values. Which principle is shown?

    • Problem reduction to a graph
    • Bubble sort
    • Procedural abstraction only
    • Composition, combining data and procedures
  17. Which statement about composed procedures is correct?

    • The whole behaves as a single procedure built from its parts
    • They cannot return any output
    • Each part must be deleted once the whole is built
    • They cannot accept any input
  18. A library offers a function that combines a parser and a validator into one check. What principle does this illustrate?

    • Hashing
    • Composition of procedures into a compound procedure
    • Linear search
    • Dijkstra's algorithm
  19. Given square(x) = x * x and add1(x) = x + 1, what is square(add1(2))?

    • 5
    • 4
    • 6
    • 9
  20. Which example combines two simpler data items into one compound object?

    • A pair holding a name together with an age as one object
    • A constant with a fixed value
    • A single number
    • A comment line ignored by the compiler when the program is run

All AQA Computer Science quizzes