ICT1511 May/Jun 2017 exam paper — questions
Question 1.1 · Selection and loops · 1 mark
A sentential value is a value that is not a legitimate data value for a particular problem, but is of the proper type, and is used to check for a 'stopping value'.Show the full question
Question 1.2 · Programming concepts and terminology · 1 mark
In cases where quite a number of files are used at different stages in a program, it is very important to keep open all the files that are in use at all times.Show the full question
Question 1.3 · Functions and subprocedures · 1 mark
While solving a problem, two variables may have the same name.Show the full question
Question 1.4 · Arrays · 1 mark
An element in an array need not have an initial value.Show the full question
Question 1.5 · Variables, data types and operators · 1 mark
Determine whether the following statement is true or false: m + 7 > 3 * p, where m = 4 and p = 5.Show the full question
Question 1.6 · Functions and subprocedures · 1 mark
The data type of the value returned by a function must be the same in all the return statements when a function contains an if statement.Show the full question
Question 1.7 · Selection and loops · 1 mark
In some cases, a loop control variable does not have to be initialized.Show the full question
Question 1.8 · Variables, data types and operators · 1 mark
Determine whether the following statement is true or false: a + t <> (a + b) * 4, where a = 6, b = 19 and t = 22.Show the full question
Question 1.9 · Algorithm design and planning (IPO) · 1 mark
Intermediate variables may be used to assist with calculations.Show the full question
Question 1.10 · Variables, data types and operators · 1 mark
When different operators are combined in one expression, all the mathematical operators will be processed first, then the relational operators, and finally the logical operators.Show the full question
Question 1.11 · Selection and loops · 1 mark
It is important to appreciate that each nested IF statement is designed to eliminate the potential answers until only one result is left.Show the full question
Question 1.12 · Arrays · 1 mark
The position of an element in an array is called an index or a subscript.Show the full question
Question 1.13 · Programming concepts and terminology · 1 mark
The way that data is stored in a file determines the type of file it is.Show the full question
Question 1.14 · Variables, data types and operators · 1 mark
The keyword 'together', in an arithmetic expression, indicates that addition will take place.Show the full question
Question 1.15 · Functions and subprocedures · 1 mark
The name of the value returned by a function need not be the same as that used in the calling statement.Show the full question
Question 2.1 · Selection and loops · 1 mark
Which of the ‘if’ statements below correctly handles this problem: to earn a medal in a competition, a participant must cycle at least 20 kilometres and swim 500 metres?Show the full question
Question 2.2 · Functions and subprocedures · 1 mark
From how many places in the code can a procedure be called?Show the full question
Question 2.3 · Selection and loops · 1 mark
Which of the ‘if’ statements below correctly handles this problem: Dabarior wants to go to the dance; tickets cost R60 and he must take a date (represented as a Boolean value); display a message indicating whether he can go?Show the full question
Question 2.4 · Programming concepts and terminology · 1 mark
The way that _____ is stored in a file determines the type of file it is.Show the full question
Question 2.5 · Programming concepts and terminology · 1 mark
Mapping of files is managed by _____.Show the full question
Question 2.6 · Selection and loops · 1 mark
Given the pseudocode below, what would be displayed as the monthly increased salary if the user enters the department as "C" and the annual salary as 50000? if anSalary is numeric then monSalary = anSalary / 12 if deptCode = "A" then monSalary = monSalary + monSalary * 0.072 else if deptCode = "B" then monSalary = monSalary + monSalary * 0.068 else monSalary = monSalary + monSalary * 0.063 endif endif display "The increased monthly salary is R", monSalary else display "The annual salary must be numeric" endifShow the full question
Question 2.7 · Selection and loops · 1 mark
How many times would "Hello World" be displayed when the following pseudocode is executed? ShowHelloWorld a = 0 display "Hello World" do while a < 5 display "Hello World" a = a + 1 loop endShow the full question
Question 2.8 · Arrays · 1 mark
A program contains an array that holds all the names of the days of the week. Which of the following is true?Show the full question
Question 2.9 · Variables, data types and operators · 1 mark
The following equation would result in an answer of _____: x = 38 ^ (45 mod 2) + 99 \ 2 - 16 * 2Show the full question
Question 2.10 · Selection and loops · 1 mark
When you ask multiple questions before an outcome is determined, you create a _____ condition.Show the full question
Question 2.11 · Variables, data types and operators · 1 mark
How would you set up the following arithmetic equation: Maria bought 10 notebooks costing 5 Rand each and 5 pens costing 2 Rand each. How much did Maria pay?Show the full question
Question 2.12 · Programming concepts and terminology · 1 mark
Objects often need to hold _____ about themselves.Show the full question
Question 2.13 · Programming concepts and terminology · 1 mark
_____ are the characteristics that define an object.Show the full question
Question 2.14 · Selection and loops · 1 mark
Which of the following is not true about count-controlled and sentinel-controlled loops?Show the full question
Question 2.15 · Selection and loops · 1 mark
How many times would "Programming is Fun" be displayed when the following pseudocode is executed? ProgrammingIsFun x = 2 y = 3 do x = x + 1 do while y <= 5 display "Programming is Fun" y = y + 2 loop display "Programming is Fun" loop until x = 6 display "Programming is Fun" endShow the full question
Question 3.1 · Programming concepts and terminology · 1 mark
Test data must include a sample of every category and must also be ______.Show the full question
Question 3.2 · Variables, data types and operators · 1 mark
A group of related characters that conveys meaning is called a ______.Show the full question
Question 3.3 · Input, processing and output · 1 mark
Lines can be read from a file until the ______ character is found, which indicates that the file doesn't contain any data that has not been read.Show the full question
Question 3.4 · Variables, data types and operators · 1 mark
A ______ is made up of several fields.Show the full question
Question 3.5 · Selection and loops · 1 mark
In an if statement the ______ clause is executed when the condition is not TRUE.Show the full question
Question 3.6 · Programming concepts and terminology · 1 mark
Encapsulation is an OOP feature that is made possible by using the ______ access specifier.Show the full question
Question 3.7 · Algorithm design and planning (IPO) · 1 mark
The ______ is the steps to solve a problem, and the pseudocode is the way in which these steps are expressed.Show the full question
Question 3.8 · Selection and loops · 1 mark
Each case is followed by one or more statements that are executed if the value of the case matches the value of the ______ statement's expression.Show the full question
Question 3.9 · Selection and loops · 1 mark
The value of result will be ______ when the following nested for loop has finished executing: for x = 4 to 0 step -2, for y = x to 7 step 2, result = x + y, next y, next x.Show the full question
Question 3.10 · Selection and loops · 1 mark
Programming often involves ______ a set of instructions a number of times.Show the full question
Question 3.11 · Programming concepts and terminology · 1 mark
To achieve the intended results, the programmer compiles a set of ______ ______ to test the logic.Show the full question
Question 3.12 · Selection and loops · 1 mark
Post-test loops evaluate a loop condition located at the ______ of a loop body.Show the full question
Question 3.13 · Variables, data types and operators · 1 mark
The ______ symbol is used to indicate exponentiation.Show the full question
Question 3.14 · Selection and loops · 1 mark
The value of answer will be ______ when the following nested for loop has finished executing: a = 0, b = 30, for w 1 to 5 step 2, for y = 1 to w, answer = a + b - y, a = a + 2, b = b - 4, next y, next w.Show the full question
Question 3.15 · Arrays · 1 mark
When working with arrays, you can use ______ in several ways: to hold the size of an array, as the array values, and as a subscript.Show the full question
Question 4 · Selection and loops · 55 marks
The Reliable Car Hire Company charges a daily hire rate that depends on the size of car selected: a small (S) car costs R200 per day, a medium (M) car costs R260 per day, and a large (L) car costs R400 per day. The user must be asked to enter the size of car required and the number of days it will be hired for, after which the program must calculate and display the total amount the customer must pay, using a nested if statement in the algorithm. Note that there is currently a special offer giving a 12.5% discount on the daily rate when a small car is hired. The program must also display suitable error messages if the user enters invalid data for either the car size or the number of days. Using the planning table and IPO (Input-Processing-Output) table layout provided, identify and describe the inputs and outputs (including their data type and variable name) and the processing steps needed, and then write out the full algorithm (pseudocode) that solves this problem. Finally, trace through the algorithm using each of the following four sets of test data in turn, and give the output that the program would produce for each: a small car hired for 4 days; a large car hired for 3 days; a 'Grand' car hired for 9 days; and a medium car hired for 'K' days.Show the full question