Hands-on Computer Science
My learning DE

Quiz15 min

Quiz: input, processing, output

Thirteen questions on the IPO box: its three parts, the test it brings along, what a sensor really delivers, chains and levels of boxes, and the two questions every box raises. Every answer comes with its reason.

Topics:Solving problemsProcessing information

Part of the lesson Solving problems with computers

According to the IPO model, what are the three parts of every piece of a problem that a computer can solve?

  • Planning, implementation, documentation
  • Hardware, software, data
  • Input, processing, output
  • Sender, channel, receiver

Why does a box with a clear input and a clear expected output bring its own test along?

  • Because the computer reports at every call whether the output it delivered matches the input.
  • Because you can feed in a known input and compare the result with the expected output.
  • Because in a cleanly cut box you can see at once, just by reading the code, which line produces which part of the output.
  • Because the processing inside the box is then so manageable that it can hardly be wrong any more.

A red lamp shines in front of a colour sensor with four measuring channels. What is the actual input a receiver program works with?

  • The colour red, just as a person standing next to the sensor sees it.
  • The word "red", which the sensor reports to the program as the colour it recognised.
  • Four numbers: the shares of red, green and blue and the overall brightness.
  • A small image of the lamp, from which the program reads off the colour at the brightest spot.

A link sends text with light as a chain of boxes. Which statements are true? (Several answers may be correct.)

"hi" → encode() → colours → light → sensor → decode() → "hi"
  • The output of encode() is the input of the next box.
  • Sender and receiver must agree beforehand which colour stands for which letter.
  • decode() can work independently of what encode() does.
  • The chain shows the order in which the data flow through the system.
  • The boxes can be put in any order, as long as every one of them is there.

Look at this function as an IPO box. What are its input and its output?

def encode(text):
    colours = []
    for letter in text:
        colours.append(colour_for(letter))
    return colours
  • The input is a text, the output is a list of colours.
  • The input is a list of colours, the output is a text.
  • The input is light, the output is four sensor readings.
  • The input is a single letter, the output is a single colour.

You want to check a box classify() that decides on a colour from four sensor readings. Which test fits the IPO model?

  • Run classify() for an hour on live readings and see whether it holds up without crashing.
  • Call classify() with random numbers and check that no error message appears.
  • Feed in stored readings that were certainly taken with a red lamp and check that "red" comes out.
  • Read the source code of classify() line by line and trace every condition in your head with example values.

The IPO box raises two questions: how does the box do its work, and how are input and output represented for the machine? Which of them does a program answer?

  • Both: a program also defines how colours and characters are represented.
  • The question of processing: a program describes how the box does its work.
  • The question of representation: a program defines what data look like.
  • Neither: programs are a separate, third topic.

The same IPO model appears on several levels. Which statements are true? (Several answers may be correct.)

system:     message → sender   → light
function:   text    → encode() → colours
logic gate: 1, 1    → AND      → 1
  • Seen from outside, the whole sender is a single box: message in, light out.
  • Opening the box turns its processing into a chain of smaller boxes with inputs and outputs of their own.
  • A single logic gate is too small for the IPO model, because it does not process anything but merely lets current pass or blocks it.
  • Which level is the right one depends on the question you are investigating.

A text transmission over a light link delivers the wrong text at the end. According to the box model, what is the most sensible next step?

  • Repeat the whole transmission until the text comes out right.
  • Open the big box and check an inner box, say encode(), on its own with a known input.
  • Put the source code of sender and receiver side by side and look for the spot where the agreement does not match.
  • Change the distance between sender and receiver and send again.

Why does the computer not "see" a colour, only numbers?

  • Because the colour sensor is too cheap; a better one would deliver colours directly.
  • Because a machine can only work with things that exist in a representation it can process, usually numbers.
  • Because the detour via numbers is a quirk of the programming language; a language with a built-in colour type would see the colour directly.
  • Because the lamp never emits pure red.
  • Because it does recognise the colour but stores it as numbers inside and can therefore only pass it on that way.

An AI assistant is an IPO box as well: your words go in, code comes out, and you cannot look inside. What follows from that?

  • The box is finished and no longer needs checking.
  • The input hardly matters: the assistant delivers similarly good code for any question, however you phrase it.
  • You know the input and check the output, since the processing is closed to you.
  • The box works fastest, so as much work as possible should go there.

Which of the following calls is a test with a built-in expectation?

def to_signal(brightness):
    if brightness > 100:
        return "on"
    return "off"
  • Call to_signal(150) and check that "on" comes out.
  • Call to_signal(150) and look at the result.
  • Call to_signal() with many different values to keep the function busy.
  • Check that the call produces no error message.

Which of these belongs to the input of the box classify(), which decides on a colour from a sensor's readings?

  • The recognised colour, for example "red".
  • The four readings of the sensor.
  • The source code of classify().
  • The colour as a person sees it.

Download with answers: CSV Anki

Back
More on this
Details
Level
Beginner
Modules
Digitization and Programming
Code
6025
Updated
4 November 2026
Status
published

    A four-digit code takes you straight to the item.