Skip to content

Course home

Structured programming and subroutines (procedures and functions)

Structured programming and subroutines (procedures and functions)

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
Question 15

Write a subroutine TO_UPPER, using either pseudo-code or a flowchart, that takes a single lowercase character as a parameter and returns the corresponding uppercase character.

For example, if the subroutine TO_UPPER is passed the character 'e' as a parameter, the subroutine should return the character 'E'.

You should make use of the built-in subroutines INT_TO_CHAR and CHAR_TO_INT in your answer:

  • CHAR_TO_INT(character) returns the integer ASCII/Unicode code for a character (e.g., CHAR_TO_INT('a') returns 97).
  • INT_TO_CHAR(integer) returns the character corresponding to that ASCII/Unicode code (e.g., INT_TO_CHAR(65) returns 'A').

You can assume that the parameter passed to the subroutine will always be a lowercase letter between 'a' and 'z'.

[5]
Markscheme

Structured programming and subroutines (procedures and functions) Questions

  1. GCSE
  2. /Computer Science
  3. /Structured programming and subroutines (procedures and functions)

131 exam-style questions on AQA GCSE Computer Science Structured programming and subroutines (procedures and functions). Each one has a worked solution and a mark scheme showing where the marks go.

Question bank