Question 4

OCR Computer Science June 2025 Computational thinking, algorithms and programming (J277-02)GCSE6 marks

On the specification

(a)
2.2 Programming fundamentals
(b)
2.2 Programming fundamentals
Question text

4 An algorithm is written to read numbers from the external text file data.txt Each number is checked when it is read from the external text file. The number is output to the user if it is not 0. (a) Complete the algorithm using the OCR Exam Reference Language statements in the box. Not all statements are used. data for if myFile.close() myFile.readLine() input() myFile.writeLine() open print temp txt x myFile = ("data.txt") while NOT myFile.endOfFile() temp = if int ( ) != 0 (temp) endif endwhile [5] (b) Identify how casting is used in this algorithm. [1]