A programmer creates an algorithm using a flow chart - OCR - GCSE Computer Science - Question 2 - 2019 - Paper 1
Question 2
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
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
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
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
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
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
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
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
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
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
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.
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.