Written Questions

The following questions are provided in PDF here: with answer lines | without answer lines
An Electronic Answer Document (EAD) is provided for all questions/tasks. Save this file to an accessible location before you start.

These questions refer to the preliminary material and require you to load the skeleton program, but do not require any additional programming.
  1. State the name of an identifier for:
    1. A local variable in the function RollDie [1]
    2. A function that returns multiple variables [1]
    3. Four built-in functions used in the function TakeItemFromOtherCharacter [4]
    4. A class that has exactly four attributes [1]
    5. A constructor [1]
    6. A variable used as a constant [1]
    7. Two user-defined functions with four parameters [2]
    8. A user-defined function, other than Main, that takes no arguments [1]
  1. Explain the purpose of the following line in the GetInstruction subroutine: [2]
  1. Explain the role of the variable Moved in the function Go. [3]
  1. Explain the purpose of the command break used in the function GetResultForCommand. [2]
  1. Using any example from the skeleton program, describe what it meant by the term string concatenation. [2]
  1. Describe in detail the role of the procedure DisplayInventory. [5]
  1. Describe the role of the variable TempCharacter in the function LoadGame. [3]
  1. Explain why LowerLimitValue in the function RollDie is initialised to zero. [3]
  1. Explain the purpose of each of the two while loops in the function ExtractCommand. [5]
  1. Describe the purpose of the first for loop in the function CheckIfDiceGamePossible. [4]
  1. Describe the changes that would need to be made so that the game would output the text 'You are carrying nothing' if the player attempts to examine an empty inventory. [4]
  1. Describe the changes that would need to be made to the function GetInstruction to ensure that a string of two or more characters has been entered before GetInstruction returns that string. [3]
  1. Describe the effect of a file not being found during the function LoadGame. [2]