Nc2410 - Principles of Computer Programming l3 p1 QP Nov 2022
Nc2410 - Principles of Computer Programming l3 p1 QP Nov 2022
(10041023)
263Q1N2211
TIME: 2 HOURS
MARKS: 100
SECTION A
QUESTION 1
Various options are given as possible answers to the following questions. Choose the
correct answer and write only the letter (A–D) next to the question number (1.1–1.10) in
the ANSWER BOOK.
1.1 Which of the following examples will determine the lowest available subscript
of an array?
A UBound
B LBound
C HBound
D SBound
1.2 A(n) … occurs when the result of a calculation is the lowest number that the
computer can actually represent in memory.
A overflow error
B
C
D
underflow error
conversion error
syntax error
1.3 An algorithm that traverses a list to match each item in the list against a search
item whose location is to be found.
A Linear search
B Binary search
C Jump search
D List search
1.4 Which combinations of the following statements (i–iv) about the Visual Basic
statement ReDim Preserve intArrMarks(10) are correct?
A i, ii
B
C
i, iii
ii, iii
D iii, iv
1.5 Which combination of the following options are examples of events of the button
control?
i Click
ii
iii
Move
Focus
iv Load
A i, ii, iii
B ii, iii, iv
C i, iii, iv
D i ii, iv
A Integer
B
C
Short
Decimal
D Long
A 2.5
B 3
C 2
D 2.4
1.8 The comparison operator … checks whether the values of two operands are
equal or not; if values are not equal, then the condition becomes true.
A <>
B
C
=
>=
D <=
1.9 The VB.NET class … is used to read from and write to any location in a file.
A directorystream
B binarystream
C filestream
D memorystream
A one-to-one
B
C
one-to-many
many-to-one
D many-to-many
(10 × 1) [10]
QUESTION 2
Indicate whether the following statements are TRUE or FALSE. Choose the answer and
write only 'True' or 'False' next to the question number (2.1–2.10) in the ANSWER
BOOK.
2.1 A Sub procedure must always specify a return datatype.
2.2 The VB.Net String function Len() returns an integer that contains the number
of characters in a string.
2.3 A foreign key is a field in a table which uniquely identifies each row/record in a
database table.
2.4 The File.Exists function returns a Boolean value of either true or false.
2.5 The For ... Next loop runs a set of statements once for each element in
2.6
an array.
A Do loop allows one to test a condition at either the beginning or the end of a
loop structure.
2.8 The square brackets [ ] are used when initialising an array in VB.Net.
2.9 The IsNumeric() function returns a Boolean value that indicates whether a
specified expression can be evaluated as a decimal number.
Complete the following sentences by writing only in the missing word or words next to
the question number (3.1–3.5) in the ANSWER BOOK.
3.1 … errors are those types of errors that appear only after one compiles and
debugs code.
3.2 An SQL … clause is used to combine rows from two or more tables, based on
a related column between them.
3.3 The last digit of a South African ID number is calculated using the Luhn … .
Copyright reserved Please turn over
(10041023) -6-
TOTAL SECTION A: 25
SECTION B
QUESTION 4
4.1 Study FIGURE 1 below and answer the questions the follow.
4.1.1 Determine the Boolean expression for the logic gate given above.
4.2.1 -1710.
4.2.2 -1110
4.2.3 -12310
(3 × 2) (6)
[10]
QUESTION 5
5.1 Study the following snippet of a flowchart and answer the questions that follow.
NOTE: Assume that the datatype of variables COUNT and SUM are
whole numbers that need to be declared. (6)
5.1.3 Explain ONE reason why infinite loops are considered bad
programming practice. (2)
5.2 Provide a reason for the use of EACH of the following structures in VB.NET:
5.2.3 I P O diagram
5.2.4 Naming conventions for datatypes
5.3 Study FIGURE 2 below and answer the questions that follow.
FIGURE 2: DO LOOP
6.1 Define the following programming structures in the context of file handling:
6.1.5 BinaryWriter
(5 × 2) (10)
6.2 Study the following snippet of code and answer the questions that follow.
6.2.2 Identify the type of single dimension array declared in line 1 and line
4 respectively. (1)
6.2.4 Identify TWO other VB.Net statements that are commonly used
together with the type of array identified in QUESTION 6.2.2.(1 × 2) (2)
6.2.5 Identify the subscript value for the strArrSpokLang() array that will
yield a result of “Sesotho”. (1)
6.2.6 Identify the subscript value for the strArrCompLang() array that will
yield a result of “VB.Net”. (1)
6.2.8 Explain the purpose of the curly brackets used in line 1 and line 4
respectively. (2)
[22]
QUESTION 7
7.1 uKhahlamba Tours uses custom designed software that has been developed
to keep track of all their tours in a central database.
A snippet of one of the tables in the database named ToursInfo that is used to
store information on the different tours and clients is shown in FIGURE 3 below.
7.1.1 The database table shown above has no primary key defined.
7.1.2 The general properties for the SurnameClient1 field are shown in
FIGURE 4 below.
Copyright reserved