Study guides

Programming Fundamentals

2 guides for this subject — how to prepare, what to practise, and how to know it has gone in.

A practice question

Choose an answer and it is marked, with the explanation. From Programming Fundamentals Practice Questions: 10 Worked Examples.

Question 11 mark

What does this code print? print(17 // 5, 17 % 5)

The correct answer is 3 2. Floor division gives the integer quotient: 17 // 5 is 3. The remainder operator gives what is left over: 17 % 5 is 2, since 5 × 3 + 2 = 17. The strongest distractor is 3 3; it incorrectly treats the remainder as the quotient.

Question 1 checks how Python 3 separates an integer quotient from a remainder.

A spoken answer, marked

An examiner's question, answered out loud and marked criterion by criterion. From Programming Fundamentals Viva Questions: A Practice Guide.

Oral — Parameters and caller stateMarked

Examiner

In this pseudocode, what is the value of x after the call, and why? Explain what would need to change for the caller to receive the updated value. function change(n) n = n + 1 x = 4 change(x)

2:063:00Mark answer
78%Parameters and caller state — marked78/100 · Developing · 2:06 spoken of 3:00
Correctness and precision21/25

Correctly says x remains 4 in the stated pseudocode, but initially calls n a reference without a language rule to support that claim.

ImproveState the behaviour of this pseudocode first; qualify any pass-by-reference comparison by naming the language or convention.

Step-by-step reasoning20/25

Explains that n is assigned 5 inside the function, but does not clearly separate the local name from x.

ImproveSay that the function’s parameter n receives the argument value and the assignment changes n, not the caller’s x.

Relevant example20/25

Uses the supplied values, which makes the result checkable.

ImproveAdd one contrast: return n and assign the result to x, if the pseudocode language supports that form.

Boundary cases and assumptions17/25

Recognises that behaviour can differ between languages, but does not explain what assumption the answer uses.

ImproveIdentify the snippet as value-copying pseudocode and say that object mutation and language-specific reference rules are separate cases.

A strong answerIn this pseudocode, x is still 4 after the call. The argument’s value is used to initialise the parameter n, and the assignment n = n + 1 changes that parameter to 5. It does not assign a new value to the caller’s variable x. To update x in this example, the function could return 5 and the caller could assign that result to x. Actual parameter and reference behaviour depends on the language, so I would name the language before making a broader claim.

A practice viva response on parameter passing is scored against the platform’s criteria, with specific points to improve.
Start studying programming fundamentals

Yours are written from your own notes, and the free plan needs no payment details.

Guides

Studying programming fundamentals? Build your programming fundamentals board from your own notes — the cards, papers and lectures are written from it. Free plan: 20 cards, a paper, a lecture and a viva to try.

Start on MySummaries

Other subjects