2210/23/O/N/23 question 7: worked solution (October/November 2023, paper 23)

Show as plain text

Cambridge O Level Computer Science 2210 · 8.1 Programming concepts Worked solution from the Programming Paper 2 Algorithms, Programming and Logic booklet, Part 1 of 3. Q27 2210/23/O/N/23 original Q7 Structured · 4 marks Worked solution Describe two differences, each with a point about local and the matching point about global: Difference 1: local variables have a scope of only the block of code or subroutine (procedure or function) they are declared in [1] ...whereas global variables have a scope of the whole program [1] Difference 2: the value of a local variable cannot be changed elsewhere in the program [1] ...whereas the value of a global variable can be changed anywhere in the program [1] KEY IDEA Local variables only work inside their subroutine; global variables work in the whole program. TOTAL 4 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by O/Alevel CS by Wasiq. Tap the picture to open it on YouTube.