Skip to content

Course home

Sign up

Computational thinking

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
Question 45

An algorithm is designed to display a list of active sensor locations in a smart home system.

1      # ----- Global variables -----
2      sensorLocations = ["Kitchen", "Hallway", "Garage", "Garden"]

3
4      # ----- Subprograms -----
5      def showRecords (recordList):
6          for index in range (0, len (recordList)):
7              print (index + 1, "-", recordList[index])
8
9      # ----- Main Program -----
10     viewChoice = input ("Display sensor locations? (Y/N) ")
11     if viewChoice.upper() == "Y":
12         showRecords (sensorLocations)
13     else:
14         print ("Goodbye")

State the name of the computational thinking technique that is used by defining the subprogram showRecords() to hide the inner details of how the list is formatted and output, allowing the main program to focus only on calling the function.

[1]
Markscheme

Computational thinking Questions

  1. GCSE
  2. /Computer Science
  3. /Computational thinking

Question bank