0% found this document useful (0 votes)
36 views5 pages

Pseudocode for Average Calculation

programming logic and design

Uploaded by

Chelsea Solomons
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views5 pages

Pseudocode for Average Calculation

programming logic and design

Uploaded by

Chelsea Solomons
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

20; 21 2021

MODULE NAME: MODULE CODE:


PROGRAMMING LOGIC AND DESIGN PRLD5121
PROGRAMMING LOGIC AND DESIGN PRLD5121d

ASSESSMENT TYPE: TEST (PAPER ONLY)


TOTAL MARK ALLOCATION: 60 MARKS
TOTAL HOURS: 1 HOUR (+5 minutes reading time)
INSTRUCTIONS:
1. Please adhere to all instructions in the assessment booklet.
2. Independent work is required.
3. Five minutes per hour of the assessment to a maximum of 15 minutes is dedicated to reading
time before the start of the assessment. You may make notes on your question paper, but not in
your answer sheet. Calculators may not be used during reading time.
4. You may not leave the assessment venue during reading time, or during the first hour or during
the last 15 minutes of the assessment.
5. Ensure that your name is on all pieces of paper or books that you will be submitting. Submit all
the pages of this assessment’s question paper as well as your answer script.
6. Answer all the questions on the answer sheets or in answer booklets provided. The phrase ‘END
OF PAPER’ will appear after the final set question of this assessment.
7. Remember to work at a steady pace so that you are able to complete the assessment within the
allocated time. Use the mark allocation as a guideline as to how much time to spend on each
section.
Additional instructions:
1. This is a CLOSED BOOK assessment.
2. Calculators are allowed.
3. Answer All Questions .

© The Independent Institute of Education (Pty) Ltd 2021


Page 1 of 5
20; 21 2021

Question 1 (Marks: 5)
Multiple‐choice questions: Select one correct answer for each of the following. In your answer
booklet, write down only the number of the question and next to it, the number of the correct
answer.

Q.1.1 Assume you have written a method with the header (1)
void myMethod(num a, string b)
Which of the following is a correct method call?
(1) myMethod(12);
(2) myMethod("Goodbye");
(3) myMethod(12, "Hello");

(4) myMethod();
(5) It is impossible to tell.

Q.1.2 A two‐dimensional array declared as num myArray[6][7] has _____ columns. (1)
(1) 4;
(2) 5;
(3) 6;
(4) 7;
(5) 8.

Q.1.3 Suppose that you have declared an array as follows: (1)


num values[4] = 0, 0, 0, 0.

Which of the following is an allowed operation?


(1) values[2] = 17;
(2) input values[0];

(3) values[3] = values[0] + 10;


(4) input values[1] = 0;
(5) all of the above.

© The Independent Institute of Education (Pty) Ltd 2021


Page 2 of 5
20; 21 2021

Q.1.4 Which of the lettered choices is equivalent to the following decision? (1)
if x > 10 then
if y > 10 then
output "X"
endif
endif
(1) if x > 10 OR y > 10 then output "X" endif;
(2) if x > 10 AND x > y then output "X" endif;
(3) if y > x then output "X" endif;

(4) if x > 10 AND y > 10 then output "X" endif;


(5) if x > 10 AND x > y then input "X" endif.

Q.1.5 Most programmers use a for loop______________________. (1)


(1) for every loop they write;
(2) when they know the exact number of times a loop will repeat;
(3) when a loop must repeat many times;
(4) when a loop will not repeat;
(5) all of the above.

Question 2 (Marks: 10)


Provide the name of the concept that is defined in Column A. In your answer booklet complete
Column B by writing down only the question number and, next to it, the concept being described.

Column A Column B
Q.2.1 An expression in which the outcome
can only be true or false.
Q.2.2 IF x > 5 AND x <7 then a valid value for
x could be _________
Q.2.3 True Or False = ?
Q.2.4 The expression ‘NOT(age<18)’ could
also be effectively expressed as..
Q.2.5 In an expression where the AND and
OR operator is present, the _____
operator takes precedence.

© The Independent Institute of Education (Pty) Ltd 2021


Page 3 of 5
20; 21 2021

Question 3 (Marks: 15)

Q.3.1 Write a snippet of pseudocode that will demonstrate the use of:
 A string constant;
(7)
 A numeric variable initialized to zero;
 A mathematical expression that utilises the numeric variable.

Q.3.2 Consider the diagram below, then motivate, by referring to the


characteristics of a structured programme, whether the solution
represented by the diagram below is a structured solution or not.

(8)

Question 4 (Marks: 20)

Q.4.1 Consider the structure below. Then, answer the questions that follow.

Q.4.1.1 Identify and describe the structure declared at the beginning of (4)
the question.
Q.4.1.2 Write the pseudocode that will add each of the following values (6)
individually to the structure identified in 3.1.1.
Values: 13, 14, 15
Q.4.1.3 Briefly explain how a Bubble Sort works. (2)

© The Independent Institute of Education (Pty) Ltd 2021


Page 4 of 5
20; 21 2021

Q.4.2 Write the pseudocode that will demonstrate how the structure provided in
(8)
Q.4.1 can be searched in order to find a specific value?

Question 5 (Marks: 10)

Q.5.1 Write the pseudocode for mainline logic that will ask a user to enter two
numeric values. These two values then need to be passed as arguments to a
method called average which will have two parameters to accept these
(10)
arguments. The average method will calculate the average of the two
numbers and return it to the mainline logic which will be responsible for
displaying the result.

END OF PAPER

© The Independent Institute of Education (Pty) Ltd 2021


Page 5 of 5

You might also like