Skip to content

Course home

Subprograms

Subprograms

EasyMedium
123456789101112131415161718192021222324252627282930
Question 1

A programmer writes the following Python program to calculate the square of a number:

def calculate_square(num):
    squared_val = num * num
    return squared_val

calculate_square(4)
print(squared_val)

The programmer notices that the last line of this program does not work as expected and causes an error.

State why the line print(squared_val) does not work as expected.

[1]
Markscheme

Subprograms Questions

  1. IGCSE
  2. /Computer Science
  3. /Subprograms

33 exam-style questions on Edexcel IGCSE Computer Science Subprograms. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank