Complete the table to give the output when each of the following set of values are input into the algorithm as X and Y - OCR - GCSE Computer Science - Question 2 - 2019 - Paper 1
Question 2
Complete the table to give the output when each of the following set of values are input into the algorithm as X and Y.
Input value of X Input value of Y Output
15 ... show full transcript
Worked Solution & Example Answer:Complete the table to give the output when each of the following set of values are input into the algorithm as X and Y - OCR - GCSE Computer Science - Question 2 - 2019 - Paper 1
Step 1
Input value of X = 15; 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 15 > 10 is TRUE, we check the next condition. 15 < 12 is FALSE, thus we output Y * X= 10 * 15 = 150.
Step 2
Input value of X = 6; 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
Since 6 > 5 is TRUE, we check the next condition. 6 < 12 is TRUE, so we output X = 6.
Step 3
Input value of X = 2; 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
Since 2 > 3 is FALSE, we check the next condition. 2 < 12 is TRUE, thus we output X = 2.
Step 4
Input value of X = 12; 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
Since 12 > 2 is TRUE, we check the next condition. 12 < 12 is FALSE, so we output Y * X = 2 * 12 = 24.