Photo AI

A programmer creates an algorithm using a flow chart - OCR - GCSE Computer Science - Question 2 - 2019 - Paper 1

Question icon

Question 2

A-programmer-creates-an-algorithm-using-a-flow-chart-OCR-GCSE Computer Science-Question 2-2019-Paper 1.png

A programmer creates an algorithm using a flow chart. - Complete the table to give the output when each of the following set of values are input into the algorithm ... show full transcript

Worked Solution & Example Answer:A programmer creates an algorithm using a flow chart - OCR - GCSE Computer Science - Question 2 - 2019 - Paper 1

Step 1

Complete the table for Input value of X = 15 and Input value of Y = 10

96%

114 rated

Answer

Since X = 15 is greater than Y = 10, we check X < 12.

15 is not less than 12, so we output Y * X:

Output = 10 * 15 = 150.

Step 2

Complete the table for Input value of X = 6 and Input value of Y = 5

99%

104 rated

Answer

Here, X = 6 is greater than Y = 5, and we check X < 12.

6 is less than 12, so we output X:

Output = 6.

Step 3

Complete the table for Input value of X = 2 and Input value of Y = 3

96%

101 rated

Answer

For X = 2 and Y = 3, since 2 is not greater than 3, we do not proceed to the next comparisons:

We directly output Y:

Output = 3.

Step 4

Complete the table for Input value of X = 12 and Input value of Y = 2

98%

120 rated

Answer

In this case, X = 12 is greater than Y = 2, but we then check X < 12.

12 is not less than 12, so we output Y * X:

Output = 2 * 12 = 24.

Step 5

Describe two methods of translating high level code into machine code.

97%

117 rated

Answer

  1. Compiler: A compiler translates the entire high-level code into machine code before execution. This produced machine code can be executed directly by the processor.

  2. Interpreter: An interpreter translates high-level code into machine code line-by-line at runtime. Unlike compilers, interpreters do not produce a separate machine code file.

Join the GCSE students using SimpleStudy...

97% of Students

Report Improved Results

98% of Students

Recommend to friends

100,000+

Students Supported

1 Million+

Questions answered

Other GCSE Computer Science topics to explore

;