2.2.3 Additional Programming Techniques

2D Array Index (2 marks)

Consider the following two-dimensional array representing scores for students in different subjects, where each row represents a student and each column represents a subject (Math, Science, English): [[65, 70, 75], [80, 85, 90], [55, 60, 65]] Write lines of code to output the Science score for the second student and the English score for the […]

2D Array Index (2 marks) Read More »

End of File Handling (3 marks)

Consider the following code used to read a file until the end: myFileHandler = open(“myFile.txt”) while NOT myFileHandler.endOfFile() print(myFileHandler.readLine()) endwhile myFileHandler.close() (a) Explain what the endOfFile() method does in this context. (1 mark) (b) What does readLine() do in this loop? (1 mark) (c) Why is it important to close the file after all operations

End of File Handling (3 marks) Read More »

SQL Query 3. (5 marks)

A table named Orders contains the columns OrderID, CustomerID, OrderDate, and Amount. Describe how you would write an SQL query to display the OrderID and Amount for all orders placed in the month of December, 2021, where the order amount was over £500. Include an explanation of your SQL command.

SQL Query 3. (5 marks) Read More »

Shopping Cart
Scroll to Top