Back to 课程

Computer Science GCES OCR

0% Complete
0/0 Steps
  1. Cpu Architecture Performance And Embedded Systems Ocr
    5 主题
  2. Primary And Secondary Storage Ocr
    6 主题
  3. Data Storage And Compression Ocr
    12 主题
  4. Networks And Topologies Ocr
    6 主题
  5. Wired And Wireless Networks Protocols And Layers Ocr
    6 主题
  6. Identifying And Preventing Threats To Computer Systems And Networks Ocr
    2 主题
  7. Operating Systems And Utility Software Ocr
    2 主题
  8. Ethical Legal Cultural And Environmental Impact Ocr
    2 主题
  9. Computational Thinking Searching And Sorting Algorithms Ocr
    3 主题
  10. Designing Creating And Refining Algorithms Ocr
    5 主题
  11. Programming Fundamentals And Data Types Ocr
    5 主题
  12. Additional Programming Techniques Ocr
    7 主题
  13. Defensive Design And Testing Ocr
    6 主题
  14. Boolean Logic Diagrams Ocr
    2 主题
  15. Programming Languages And Integrated Development Environments Ides Ocr
    3 主题
  16. The Exam Papers Ocr
    2 主题
  17. Structuring Your Responses Ocr
    3 主题
课 Progress
0% Complete

Exam code:J277

How do I answer an OCR GCSE (9-1) Computer Science programming question?

  • Programming questions can appear in both papers

  • Paper 1 may include questions that test understanding and interpretation of algorithms and computational thinking principles

  • Paper 2 is the dedicated component for assessing the ability to actively design, write, test, and refine programs

    • Section A questions can be answered using either pseudocode, flowcharts, bullet points, OCR Exam Reference Language or a high-level programming language

    • Section B questions must be answered using either OCR Exam Reference Language or a high-level programming language

  • To attempt a programming question that requires the writing of a new program, you should always ask yourself the following five key questions:

    • What are the inputs?

    • What are the outputs?

    • What processes take place?

    • What constructs will I need to use?

    • Do I need to use subprograms?

Example 1

Question

Charlie is developing an adding game. The rules of the game are:

  • the player is asked 3 addition questions

  • each question asks the player to add together two random whole numbers between 1 and 10 inclusive

  • if the player gets the correct answer, 1 is added to their score

  • at the end of the game their score is displayed.

Write an algorithm to play this game.

[6 marks]

What are the inputs? What are the outputs? What processes take place?

  • the player is asked 3 addition questions

  • each question asks the player to add together two random whole numbers between 1 and 10 inclusive

  • if the player gets the correct answer, 1 is added to their score

  • at the end of the game their score is displayed.

What constructs will I need to use?

  • Iteration – a FOR loop can be used as the game is a fixed length (3 questions)

  • Selection – an IF statement can be used to check if the answer is correct

  • Declare a score variable to keep track of the score

Do I need to use subprograms?

  • This program can be written without the need to use a subprogram (function or procedure)

Answer

Pseudocode

score = 0

for count = 1 to 3

num1 = random(1, 10)

num2 = random(1, 10)

ans = input(“What is” +num1 + ” + ” + num2 + “?”)

if ans = num1 + num2 then

score = score + 1

end if

next count

print(“You scored ” + score)

Example 2

Question

A program written in a high-level language is used to access data from a database.

This program has a procedure, SaveLogs(), that stores the data to an external text file.

The procedure SaveLogs():

  • takes the string of data to be stored to the text file as a parameter

  • takes the filename of the text file as a parameter

  • stores the string of data to the text file.

Write the procedure SaveLogs()

You must use either:

  • OCR Exam Reference Language, or

  • A high-level programming language that you have studied

[6 marks]

What are the inputs? What are the outputs? What processes take place?

  • takes the string of data to be stored to the text file as a parameter

  • takes the filename of the text file as a parameter

  • stores the string of data to the text file.

Write the procedure SaveLogs()

What constructs will I need to use?

  • This question is testing knowledge of how to write procedures

  • Selection must be used to ensure the correct order of operations

  • No selection or iteration is required

Do I need to use subprograms?

  • This question requires the answer written as a procedure which includes 2 x parameters

  • A procedure does not return a value

Answer

Pseudocode

procedure SaveLogs(data, filename)

logFile = open(filename)

logFile.writeLine(data)

logFile.close()

endprocedure

Responses

您的邮箱地址不会被公开。 必填项已用 * 标注