Skip to main content
A-LevelComputer ScienceSoftware development9618/22 · May/June 2025 · Q512 Marks

An automated digital camera system is used to take a sequence of pictures of animals in a garden. During the design of the system, a state-transition diagram is produced. The table details the states in the automated digital camera system along with the events which cause the states to change. The system starts in standby mode. The sequence of pictures is taken when in active mode. Current state Event Next state standby mode turn on detect mode detect mode turn off standby mode detect mode movement detected active mode active mode 20 seconds elapsed sequence complete active mode turn off standby mode sequence complete time saved detect mode

  1. (a)Complete the state-transition diagram for the automated digital camera system. start standby mode[4]
  2. (b)At the end of each sequence of pictures, the time is saved as a string in the format <HH><MM><SS> where: • HH represents the hours using two digits • MM represents the minutes using two digits • SS represents the seconds using two digits. For example: • "081230" is stored to represent the time 8:12:30, in the morning "152235" is stored to represent the time 15:22:35, in the afternoon. Each string is stored on a new line in the text file TimeTaken.txt An algorithm is required to process the content of the text file TimeTaken.txt once it has been transferred to the computer. For each hour when pictures are taken, output a suitable message showing the hour and the total number of sequences of pictures taken within that hour. Example outputs: Hour : 15 Total : 32 Hour : 18 Total : 1 Write pseudocode for this algorithm. Assume the text file TimeTaken.txt contains at least one line.[8]

This question uses a diagram from the original paper, which isn't shown here. Open the full paper from the past papers archive to see it.

Mark scheme

Marking points from the official mark scheme (May/June 2025). The mark or mark type is shown in brackets.

  1. [4] Mark as follows: 1 Mark: The three new states drawn and labelled. 1 Mark: Two of the events drawn with labels connecting correct states and correct line direction 1 Mark: Four of the events drawn with labels connecting correct states and correct line direction. 1 Mark: All and only six events drawn with labels connecting correct states and correct line direction.
  2. [8] Conditional Solution Example Solution DECLARE Count : INTEGER DECLARE Line : STRING DECLARE NextHour, Hour : STRING OPENFILE "TimeTaken.txt" FOR READ Count←←← 1 READFILE "TimeTaken.txt", Line Hour ← LEFT(Line, 2) WHILE NOT EOF("TimeTaken.txt") READFILE "TimeTaken.txt", Line NextHour ← LEFT(Line, 2) IF NextHour = Hour THEN Count Count + 1 ELSE "OUTPUT "Hour : ", Hour, Total : ", Count Hour NextHour Count←←←← 1 ENDIF ENDWHILE "OUTPUT "Hour : ", Hour, Total : ", Count CLOSEFILE "TimeTaken.txt" Mark as follows: 1. Any Initialisation of count for number of pictures taken each hour 2. Open "TimeTaken.txt" for read and subsequently close 3. Conditional loop until EOF 4. Read a line from "TimeTaken.txt" in a loop 5. 6. 7. 8. Extract Hour from line read in a loop A mechanism to compare current hour extracted from file with last one read from file in a loop If hours same increment count in a loop If not same output count (with a suitable message) and update Hour ← NextHour and set Count to 1 in a loop 9. Output final Count and Hour (with a suitable message) once only Note: max 8
  3. [8] Alternative solution and mark scheme use of an array to hold count for each hour Also, for use of 24 variables and 24 selection conditions DECLARE HoursArray[0 : 23] OF INTEGER DECLARE Index, Hour : INTEGER DECLARE Line : STRING FOR Index ← 0 ΤΟ 23 HoursArray[Index] ← 0 NEXT Index OPENFILE "TimeTaken.txt" FOR READ WHILE NOT EOF("TimeTaken.txt") READFILE "TimeTaken.txt", Line Hour ← STR_TO_NUM(LEFT(Line, 2)) HoursArray[Hour] ← HoursArray[Hour] + 1 ENDWHILE FOR Index ← 0 ΤΟ 23 IF HoursArray[Index] <> 0 THEN OUTPUT "Hour : ", Index, " Total : ", HoursArray[Index] ENDIF NEXT Index CLOSEFILE "TimeTaken.txt" Mark as follows: 1. Initialisation of 24 array elements to 0 // Initialisation of 24 Integer variables to 0 2. Open "TimeTaken.txt" for read and subsequently close 3. Conditional loop until EOF 4. Read a line from "TimeTaken.txt" in a loop 5. Extract Hour from line read in a loop 6. Convert Hour to an integer value in a loop 7. Increment appropriate array element / variable in a loop 8. Output of each hour and corresponding count variable (with a suitable message) for all values where count is not zero

Write your answer and get it marked

On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.

Sign up free →

About this question

Topic
Software development, A-Level Computer Science (syllabus 9618). Structured question, 12 marks.
Source
A-Level Computer Science, May/June 2025 Paper 2 Variant 2, question 5.

Questions and mark schemes are from past examination papers and remain the copyright of the exam board. How Oracle Prep builds its content

Related Computer Science questions

© 2026 Oracle Prep