Computer Programming Concepts
12 Grade 10 Computer Studies questions on Computer Programming Concepts, with worked marking schemes. 12 questions are available on this topic in full.
Question 1
3 marksA learner writes these steps: set Count to 1; while Count is less than 10, display Count. When the program is run it prints the value 1 endlessly. Account for this behaviour and state the change needed to correct it.
(3 marks)
Marking scheme for this question
Create a free account to see itQuestion 2
1 markA programmer is drawing a flowchart for a program that must work out whether a learner has passed or failed. Which symbol is used at the point where that decision is made?
A. An oval
B. A parallelogram
C. A rectangle
D. A diamond
(1 mark)
Marking scheme for this question
Create a free account to see itQuestion 3
1 markWhich statement is true of a post-test loop (repeat ... until) but NOT of a pre-test loop (while ... do)?
A. It tests its condition before the first repetition is carried out.
B. Its instructions are always carried out at least once, even when the stopping condition is already true.
C. It does not need any variable to control how many times it repeats.
D. It can only be used when the number of repetitions is known before the loop starts.
(1 mark)
Marking scheme for this question
Create a free account to see itQuestion 4
4 marksDistinguish between a variable and a constant, using one example of each drawn from a program that works out the cost of fertiliser bought by a farmer.
(4 marks)
Marking scheme for this question
Create a free account to see itQuestion 5
3 marksDescribe what is meant by dry running a program using a trace table, and state two benefits of doing so.
(3 marks)
Marking scheme
1. Dry running means working through the program steps by hand, away from the computer, recording the value of each variable after every instruction in a table with one column per variable. (1 mark) 2. Benefit: it reveals logic errors, such as a wrong total or a loop that repeats the wrong number of times, which the translator would not report. (1 mark) 3. Benefit: it lets the programmer check the design before spending time coding, and it helps predict the expected output to compare with the actual output during testing. (1 mark) Maximum 2 marks for benefits.
Question 6
1 markA program is to charge a dairy farmer KSh 50 per litre for the first 100 litres delivered and KSh 45 per litre for every litre above that. Which control structure must the program use in order to decide which rate to apply?
A. Selection, using an IF ... ELSE decision.
B. Assignment, storing the rate in a variable.
C. Sequence only, carrying out the instructions one after another.
D. Iteration, using a loop that repeats the calculation.
(1 mark)
Marking scheme for this question
Create a free account to see itQuestion 7
4 marksDistinguish between a syntax error and a logic error in a program, giving one example of each.
(4 marks)
Marking scheme for this question
Create a free account to see itQuestion 8
4 marksOutline four stages a programmer follows when developing a new program.
(4 marks)
Marking scheme
1 mark for each stage correctly named and briefly outlined, to a maximum of 4. 1. Problem definition - state clearly what the program must do, its inputs and its expected outputs. 2. Design - plan the solution using pseudocode or a flowchart before any code is written. 3. Coding - translate the design into statements of a chosen programming language. 4. Testing and debugging - run the program with suitable test data, including extreme and invalid values, and correct the errors found. 5. Documentation and maintenance - write user and technical documentation and later update the program as needs change. Accept any four stages given in a sensible order.
Question 9
1 markWhat is the purpose of pseudocode in program development?
A. It is the set of test data used to check whether a finished program works.
B. It is a programming language that the computer is able to run directly.
C. It sets out the steps of a solution in ordinary, structured language before any code is written.
D. It is the message a translator displays when a rule of the language has been broken.
(1 mark)
Marking scheme for this question
Create a free account to see itQuestion 10
1 markA school database is to store admission numbers such as 0457 and mobile numbers such as 0722000111. Which data type is the most suitable for these two fields, and why?
A. Real, because the values are large numbers.
B. Integer, because both entries are made up only of digits.
C. Boolean, because each entry is either valid or invalid.
D. String (text), because the leading zero must be kept and the values are never used in calculations.
(1 mark)
Marking scheme for this question
Create a free account to see itQuestion 11
5 marksA cereal store clerk wants a program that reads in the mass of each of twenty bags of maize, then displays the total mass and the average mass of a bag. Write, in words, the pseudocode steps the program would follow.
(5 marks)
Marking scheme
1 mark for each correct step, to a maximum of 5. 1. Set Total to 0 and set Counter to 1 (initialisation of the accumulator and the control variable). 2. Begin a loop that repeats while Counter is less than or equal to 20. 3. Inside the loop, read the mass of the next bag into Mass and add Mass to Total. 4. Still inside the loop, increase Counter by 1, then return to the test. 5. After the loop ends, work out Average as Total divided by 20, then display Total and Average. Accept a post-test loop or a for-loop of twenty repetitions. Deduct nothing for reasonable variations in variable names, but the accumulator must be initialised before the loop and the counter must be increased inside it.
Question 12
1 markA learner writes the following steps: set Total to 0; set Count to 1; while Count is less than or equal to 4, add Count to Total and then increase Count by 1; when the loop ends, display Total. What value is displayed?
A. 4
B. 15
C. 10
D. 6
(1 mark)
Marking scheme for this question
Create a free account to see it9 more marking schemes are on this page. A free account opens all of them, and lets you build your own paper on the topics you have actually taught, laid out in KNEC format with its full marking scheme.
Create a free account