4/30/2019 myModules : ICT1511-19-S1 : Online Assessment
myModules
myAdmin
ICT1511-19-S1 / Online Assessment
Online Assessment
Online Assessment
3 Assignment 3
RETURN TO ASSESSMENT LIST
Part 1 of 10 - 0.0 Points
No Questions
Part 2 of 10 - True or False 5.0 Points
Question 1 of 45
Large and complex programs can be divide into independently developed modules. 1.0 Points
A. True
B. False
Answer Key: True
Question 2 of 45
Lines of code that perform a specific task that is repeated often would typically be coded as a 1.0 Points
separate procedure.
A. True
B. False
Answer Key: True
Question 3 of 45
A parameter may not contain the address of an answer when dealing with a sub-procedure. 1.0 Points
A. True
B. False
Answer Key: False
Question 4 of 45
Modularisation makes it harder for multiple programmers to work on a problem. 1.0 Points
A. True
B. False
https://mymodules.unisa.ac.za/portal/site/ICT1511-19-S1/tool/197a0f7d-f4c9-497b-9249-ff2414a510eb/jsf/index/mainIndex 1/15
4/30/2019 myModules : ICT1511-19-S1 : Online Assessment
Answer Key: False
Question 5 of 45
There are two types of parameters namely value parameters and reference parameters. 1.0 Points
A. True
B. False
Answer Key: True
Part 3 of 10 - True or False 5.0 Points
Question 6 of 45
In a sequential access file, text lines cannot be added to an existing file. 1.0 Points
A. True
B. False
Answer Key: False
Question 7 of 45
The Programmer must specify in the open statement what type of file must be opened. 1.0 Points
A. True
B. False
Answer Key: True
Question 8 of 45
Text files are made up of a sequence of records. 1.0 Points
A. True
B. False
Answer Key: True
Question 9 of 45
As a general rule, an eof question should always come immediately after an input statement 1.0 Points
because the end-of-file condition will be detected at input.
A. True
B. False
Answer Key: True
Question 10 of 45
When a programmer wants the next string of text to be written on a new line in a sequential access 1.0 Points
file it must be specified.
A. True
B. False
https://mymodules.unisa.ac.za/portal/site/ICT1511-19-S1/tool/197a0f7d-f4c9-497b-9249-ff2414a510eb/jsf/index/mainIndex 2/15
4/30/2019 myModules : ICT1511-19-S1 : Online Assessment
Answer Key: True
Part 4 of 10 - True or False 5.0 Points
Question 11 of 45
Methods of a class must always be public inside a class. 1.0 Points
A. True
B. False
Answer Key: False
Question 12 of 45
Classes can be used to create/derive other classes. 1.0 Points
A. True
B. False
Answer Key: True
Question 13 of 45
One or more objects can be created from a single class 1.0 Points
A. True
B. False
Answer Key: True
Question 14 of 45
Inheritance is an OOP feature that allows data to be hidden inside a class. 1.0 Points
A. True
B. False
Answer Key: False
Question 15 of 45
Most of the concepts in procedural languages also feature in most OO languages. 1.0 Points
A. True
B. False
Answer Key: True
Part 5 of 10 - Multiple Choice 5.0 Points
Question 16 of 45
How many return statements are allowed in a Function Procedure? 1.0 Points
A. There is no limit.
B. 1
https://mymodules.unisa.ac.za/portal/site/ICT1511-19-S1/tool/197a0f7d-f4c9-497b-9249-ff2414a510eb/jsf/index/mainIndex 3/15
4/30/2019 myModules : ICT1511-19-S1 : Online Assessment
C. 2
D. None of the above
Answer Key: A
Question 17 of 45
1.0 Points
Provided the problem statement below, which of the following algorithms will solve the problem?
Reginald went to a shop to buy a number of fruit bars. The amount due must be calculated and 14% vat
added. The calculated value must be displayed on the screen.
A. CalcAmntDue (valNum, valPrice)
Return (valNum * valPrice * 1.14)
ShoppingProgram
display “Enter the number of fruit bars bought”
enter numberItems
display “Enter the price of a fruit bar”
enter price
amtDue = CalcAmntDue (numItems, price)
display “The amound due is R”, amtDue
end
B. Function CalcAmntDue (valNum, valPrice)
Return (valNum * valPrice * 1.14)
ShoppingProgram
display “Enter the number of fruit bars bought”
enter numberItems
display “Enter the price of a fruit bar”
enter price
amtDue = CalcAmntDue (valNum, valPrice)
display “The amound due is R”, amtDue
end
C. Function CalcAmntDue ()
Return (valNum * valPrice * 1.14)
https://mymodules.unisa.ac.za/portal/site/ICT1511-19-S1/tool/197a0f7d-f4c9-497b-9249-ff2414a510eb/jsf/index/mainIndex 4/15
4/30/2019 myModules : ICT1511-19-S1 : Online Assessment
ShoppingProgram
display “Enter the number of fruit bars bought”
enter numberItems
display “Enter the price of a fruit bar”
enter price
amtDue = CalcAmntDue (numItems, price)
display “The amound due is R”, amtDue
end
D. Function CalcAmntDue (valNum, valPrice)
Return (valNum * valPrice * 1.14)
ShoppingProgram
display “Enter the number of fruit bars bought”
enter numberItems
display “Enter the price of a fruit bar”
enter price
amtDue = CalcAmntDue (numItems, price)
display “The amound due is R”, amtDue
end
Answer Key: D
Question 18 of 45
1.0 Points
Provided the problem statement below, which of the following algorithms will solve the problem?
A student name and three test marks are entered, the average mark must be calculated and it must be
determined if the student passes or fails (mark equal or above 50%). The student name, average and result
must be displayed on screen.
A. CalcAve (valTest1, valTest2, valTest3)
return (valTest1 + valTest2 + valTest3) / 3
DetermineResults(valAve)
if valAve < 50 then
message = “fail”
else
https://mymodules.unisa.ac.za/portal/site/ICT1511-19-S1/tool/197a0f7d-f4c9-497b-9249-ff2414a510eb/jsf/index/mainIndex 5/15
4/30/2019 myModules : ICT1511-19-S1 : Online Assessment
message = “pass”
endif
return message
ShowResults
display “Enter the student name”
enter studentName
display “Enter the first test mark”
enter testMark1
display “Enter the second test mark”
enter testMark2
display “Enter the third test mark”
enter testMark3
average = CalcAve (valTest1, valTest2, valTest3)
display “The average mark for “, studentName, “ is “, average
display “This student will “, DetermineResults(message)
end
B. Function CalcAve ()
return (valTest1 + valTest2 + valTest3) / 3
Function DetermineResults()
if valAve < 50 then
message = “fail”
else
message = “pass”
endif
return message
ShowResults
display “Enter the student name”
enter studentName
display “Enter the first test mark”
enter testMark1
https://mymodules.unisa.ac.za/portal/site/ICT1511-19-S1/tool/197a0f7d-f4c9-497b-9249-ff2414a510eb/jsf/index/mainIndex 6/15
4/30/2019 myModules : ICT1511-19-S1 : Online Assessment
display “Enter the second test mark”
enter testMark2
display “Enter the third test mark”
enter testMark3
average = CalcAve (valTest1, valTest2, valTest3)
display “The average mark for “, studentName, “ is “, average
display “This student will “, DetermineResults(message)
end
C. Function CalcAve (valTest1, valTest2, valTest3)
return (valTest1 + valTest2 + valTest3) / 3
Function DetermineResults(valAve)
if valAve < 50 then
message = “fail”
else
message = “pass”
endif
return message
ShowResults
display “Enter the student name”
enter studentName
display “Enter the first test mark”
enter testMark1
display “Enter the second test mark”
enter testMark2
display “Enter the third test mark”
enter testMark3
average = CalcAve()
display “The average mark for “, studentName, “ is “, average
display “This student will “, DetermineResults()
end
D. Function CalcAve (valTest1, valTest2, valTest3)
https://mymodules.unisa.ac.za/portal/site/ICT1511-19-S1/tool/197a0f7d-f4c9-497b-9249-ff2414a510eb/jsf/index/mainIndex 7/15
4/30/2019 myModules : ICT1511-19-S1 : Online Assessment
return (valTest1 + valTest2 + valTest3) / 3
Function DetermineResults(valAve)
if valAve < 50 then
message = “fail”
else
message = “pass”
endif
return message
ShowResults
display “Enter the student name”
enter studentName
display “Enter the first test mark”
enter testMark1
display “Enter the second test mark”
enter testMark2
display “Enter the third test mark”
enter testMark3
average = CalcAve(valTest1, valTest2, valTest3)
display “The average mark for “, studentName, “ is “, average
display “This student will “, DetermineResults(message)
end
Answer Key: D
Question 19 of 45
The methodology where code is broken into small, logical procedures is called: 1.0 Points
A. event-driven programming
B. functional programming
C. granular programming
D. modular programming
Answer Key: D
https://mymodules.unisa.ac.za/portal/site/ICT1511-19-S1/tool/197a0f7d-f4c9-497b-9249-ff2414a510eb/jsf/index/mainIndex 8/15
4/30/2019 myModules : ICT1511-19-S1 : Online Assessment
Question 20 of 45
1.0 Points
Provided the problem statement below, which of the following algorithms will solve the problem?
A product price and the discount applicable to the product is entered. The discount may never be more than
25%. If the discount is more than 25% the user must re-enter the discount percentage. The amount due after
the discount have been applied must be displayed.
A. CalcPercDiscount()
do
display “Enter the percentage discount that applies”
enter percDiscount
if percDiscount < 0 or percDiscount > 25 then
display “Invalid discount – please re-enter”
endif
loop until percDiscount >= 0 and percDiscount <= 25
return percDiscount
mainModule
display “Enter the price of the product”
enter price
discount = CalcPercDiscount(percDiscount)
amtDue = price – price * (discount / 100)
display “Amount due = R”, amtDue
end
B. Function CalcPercDiscount()
do
display “Enter the percentage discount that applies”
enter percDiscount
if percDiscount < 0 or percDiscount > 25 then
display “Invalid discount – please re-enter”
endif
loop until percDiscount >= 0 and percDiscount <= 25
return percDiscount
mainModule
https://mymodules.unisa.ac.za/portal/site/ICT1511-19-S1/tool/197a0f7d-f4c9-497b-9249-ff2414a510eb/jsf/index/mainIndex 9/15
4/30/2019 myModules : ICT1511-19-S1 : Online Assessment
display “Enter the price of the product”
enter price
discount = CalcPercDiscount(percDiscount)
amtDue = price – price * (discount / 100)
display “Amount due = R”, amtDue
end
C. Function CalcPercDiscount()
do
display “Enter the percentage discount that applies”
enter percDiscount
if percDiscount < 0 or percDiscount > 25 then
display “Invalid discount – please re-enter”
endif
loop until percDiscount >= 0 and percDiscount <= 25
return percDiscount
Function mainModule
display “Enter the price of the product”
enter price
discount = CalcPercDiscount()
amtDue = price – price * (discount / 100)
display “Amount due = R”, amtDue
end
D. Function CalcPercDiscount()
do
display “Enter the percentage discount that applies”
enter percDiscount
if percDiscount < 0 or percDiscount > 25 then
display “Invalid discount – please re-enter”
endif
loop until percDiscount >= 0 and percDiscount <= 25
return percDiscount
https://mymodules.unisa.ac.za/portal/site/ICT1511-19-S1/tool/197a0f7d-f4c9-497b-9249-ff2414a510eb/jsf/index/mainIndex 10/15
4/30/2019 myModules : ICT1511-19-S1 : Online Assessment
mainModule
display “Enter the price of the product”
enter price
discount = CalcPercDiscount()
amtDue = price – price * (discount / 100)
display “Amount due = R”, amtDue
end
Answer Key: B
Part 6 of 10 - Multiple Choice 5.0 Points
Question 21 of 45
The only way to modify a sequential file is by to read all the records into a(n) ____, manipulate the 1.0 Points
elements, then write it back to the file by recreating the file.
A. if statement
B. loop statement
C. function
D. array
Answer Key: D
Question 22 of 45
Why the file should be closed as soon as possible 1.0 Points
A. to read the file
B. rewrite index
C. to prevent data loss
D. none of the above
Answer Key: C
Question 23 of 45
____Contains stored data that can be specified as input to a program when read from the file during 1.0 Points
processing.
A. Output file
B. serial file
C. retired file
D. input File
https://mymodules.unisa.ac.za/portal/site/ICT1511-19-S1/tool/197a0f7d-f4c9-497b-9249-ff2414a510eb/jsf/index/mainIndex 11/15
4/30/2019 myModules : ICT1511-19-S1 : Online Assessment
Answer Key: D
Question 24 of 45
What is a sequential file used by a program to store new data, by writing it to the file, called? 1.0 Points
A. appended file
B. input file
C. output file
D. sequence file
Answer Key: C
Question 25 of 45
To create a file you need to: 1.0 Points
A. Allocate space in the file system
B. make an entry for new file in the directory
C. Both (a) and (b)
D. None of the above
Answer Key: C
Part 7 of 10 - Multiple Choice 5.0 Points
Question 26 of 45
Objects both in the real world and in object-oriented programming contain ____ and methods. 1.0 Points
A. behaviors
B. attributes
C. help
D. primitive data types
Answer Key: B
Question 27 of 45
A ____ is a set of program statements that lists the characteristics of each object and the methods 1.0 Points
each object can use.
A. class interface
B. class definition
C. class reference
https://mymodules.unisa.ac.za/portal/site/ICT1511-19-S1/tool/197a0f7d-f4c9-497b-9249-ff2414a510eb/jsf/index/mainIndex 12/15
4/30/2019 myModules : ICT1511-19-S1 : Online Assessment
D. class model
Answer Key: B
Question 28 of 45
Properties and operations that can be manipulated by other classes should be made _____. 1.0 Points
A. Private
B. Dynamic
C. public
D. none of the above
Answer Key: C
Question 29 of 45
In _____ inheritance, a class can be derived from more than 1 class. 1.0 Points
A. Double
B. Single
C. Multiple
D. Both (a) and (b)
Answer Key: C
Question 30 of 45
The mechanism that binds code and data together and keeps them secure from outside world is 1.0 Points
known as:
A. Abstraction
B. Inheritance
C. Polymorphism
D. Encapsulation
Answer Key: D
Part 8 of 10 - Fill in the Missing Word 5.0 Points
Spelling is important in this section!
Question 31 of 45
The function name used in the _____ statement and the function name in the function header must 1.0 Points
always be the same. Calling
Answer Key: calling
https://mymodules.unisa.ac.za/portal/site/ICT1511-19-S1/tool/197a0f7d-f4c9-497b-9249-ff2414a510eb/jsf/index/mainIndex 13/15
4/30/2019 myModules : ICT1511-19-S1 : Online Assessment
Question 32 of 45
Using function procedures and sub procedures enables you to split large complex algorithms into 1.0 Points
smaller _____, which makes the computer coding more effective. Modules
Answer Key: modules
Question 33 of 45
The last statement of the function to be processed with be a _____ statement that sends the results 1.0 Points
of the function to the calling statement. return
Answer Key: return
Question 34 of 45
A(n) _____ is data (variables or values) that is sent to a function or a sub procedure, which it needs 1.0 Points
to perform the tasks it has to do. Parameter
Answer Key: parameter
Question 35 of 45
_____ divides the solution to a problem into smaller pieces to improve the flexibility of a program 1.0 Points
and shorten its development. Modularisation
Answer Key: modularisation
Part 9 of 10 - Fill in the Missing Word 5.0 Points
Question 36 of 45
Every file name consists of an _____ that helps to identify the type of the file. arrays 1.0 Points
Answer Key: extension
Question 37 of 45
Records can be read from a file until the _____ character is found. end-of-file (eof) 1.0 Points
Answer Key: end-of-file || end of file || eof ||(eof)
Question 38 of 45
When you store data in a computer file on a persistent storage device, you _____ to the file. 1.0 Points
write
Answer Key: write
Question 39 of 45
A group of related characters that conveys meaning is called a _____ Field 1.0 Points
Answer Key: field
Question 40 of 45
Files are typically stored in _____ storage. Computer 1.0 Points
Answer Key: non-volatile
Part 10 of 10 - Fill in the Missing Word 5.0 Points
Question 41 of 45
An attribute that has a _____ scope is visible only inside the object it applies to. Private 1.0 Points
Answer Key: private
https://mymodules.unisa.ac.za/portal/site/ICT1511-19-S1/tool/197a0f7d-f4c9-497b-9249-ff2414a510eb/jsf/index/mainIndex 14/15
4/30/2019 myModules : ICT1511-19-S1 : Online Assessment
Question 42 of 45
An operation in an object has a unique _____ consisting of its name, optional parameters and 1.0 Points
optional return values. Signature
Answer Key: signature
Question 43 of 45
Another important concept in object-oriented programming is _____, which is the process of 1.0 Points
acquiring the traits of one’s predecessors.
Answer Key: inheritance
Question 44 of 45
A(n) _____ expresses the relationship between two classes. Association 1.0 Points
Answer Key: association
Question 45 of 45
The operations of a class are normally _____. Methods 1.0 Points
Answer Key: public
Gateway
Mobile View
The Sakai Project
University of South Africa
Powered by Sakai
Copyright 2003-2018 The Sakai Foundation. All rights reserved. Portions of Sakai are copyrighted by other
parties as described in the Acknowledgments screen.
https://mymodules.unisa.ac.za/portal/site/ICT1511-19-S1/tool/197a0f7d-f4c9-497b-9249-ff2414a510eb/jsf/index/mainIndex 15/15