ICG511S - INTRODUCTION TO COMPUTING - 1ST OPP - JUNE 2024


ICG511S - INTRODUCTION TO COMPUTING - 1ST OPP - JUNE 2024



1 Page 1

▲back to top


nAm I BI A un IVE RSITY
OFSCIEnCEAno TECHnOLOGY
FACULTY OF COMPUTING AND INFORMATICS
DEPARTMENTOF SOFTWAREENGINEERING
QUALIFICATION:BACHELOROF COMPUTERSCIENCE,BACHELOROF INFORMATICS
QUALIFICATIONCODE:07BCMS, 07BAIT
LEVEL:5
COURSE:INTRODUCTIONTO COMPUTING
COURSECODE:ICG511S
DATE:JUNE 2024
PAPER:THEORY
DURATION: 3 HRS
MARKS: 75
FIRSTOPPORTUNITYEXAMINATION QUESTION PAPER
EXAMINER{S)
Mr MIKE KALE
MODERATOR
Mr PETERGALLERT
THIS QUESTIONPAPERCONSISTSOF 8 PAGES
(Including this front page)
INSTRUCTIONSTO STUDENTS
1. Readall the questions, passages,scenarios, etc., carefully before answering.
2. Answer all the questions.
3. Number each answer clearly and correctly.
4. Write neatly and legibly.
5. Making use of any crib notes may lead to disqualification and disciplinary action.
6.
Usethe allocated marks as a guideline when answering questions.
7.
Looking at other students' work is strictly prohibited.

2 Page 2

▲back to top


SECTIONA: Multiple choicesand True and false Questions
(10 Marks]
Answer all the questions in the provided booklet.
The section consists of 10 questions.
1. Which of the following variable naming convention is NOT correct. [1 Mark]
A. myvehicle
B. My Vehicle
C. myVehicle
D. my_vehicle
2. The process of assigning a variable its first value is known as. [1 Mark]
A. Assignment
B. Declaration
C. Initialisation
D. Incrementation
3. Which of the following statements is correct. [1 Mark]
A. a[]= {'a', 'c', '2', "d"}
B. a[]= {"a", "c", '2', "d"}
C. a[]= {'a', 'c', '2', 'd'}
D. a[]= {'a', 'c', '2', 1}
Page 2 of 8

3 Page 3

▲back to top


4. What is the output of the following function. [1 Mark]
Start
add (2, 4)
End
add (a, b) {
b=2
c = a+ b
Display c
A. 6
B. 4
C. 10
D. 7
5. The smallest group of tasks or operations with a single purpose are known as. [1 Mark]
A. Loops
B. Global scope
C. Cohesion
D. Functions
6. A variable behaves like the value it stores. [1 Mark]
A. True
B. False
Page3 of 8

4 Page 4

▲back to top


7. If a= 7, b = 2, what will the following expression evaluate to. [1 Mark]
a!= b AND a< 2
A. True
B. False
8. A WHILE loop and a DO - WHILE loop are both leading decision loops. [1 Marl<]
A. True
B. False
9. An index is used to accessan element in an array. [1 Mark]
A. True
B. False
10. A global variable is a variable that is declared inside a function and is accessible to all
functions. [1 Mark]
A. True
B. False
Page 4 of 8

5 Page 5

▲back to top


SECTIONB: Structured Questions
[65 Marks]
Answer all the questions in the provided booklet.
The section consists of 7 questions.
1. Re-write the following DO - WHILEloop using a WHILEloop. [5 Marks]
count= 20
DO
IF(count > 30} THEN
Display count
ENDIF
count= count+ 1
WHILE (count< 50}
ENDDO
2. Write a pseudocode that will help a user at NUSTto determine whether the student has
passed the ICG511Scourse or not. The program should accept the student's name, the
semester mark, and the examination mark, then calculate the final mark. The program
should then determine whether the student has passed or not. The program should
display the student's name and the final mark to the screen. Use correct variable naming
convention in your pseudocode.
The decisionismade based on the following criteria:
• If the final mark is 50 percent and above, and the examination mark is 40 percent
and above, then the student has passed. The program should display "Pass", if the
student has passed, otherwise, it should display "Fail".
• If the final mark is 50 percent and above, but the examination mark is lessthan 40
percent, then the student has failed. The program should display "Fail. Sub
minimum not obtained."
Page 5 of8

6 Page 6

▲back to top


Below is the formula to calculate the final mark.
Final Mark= (Semester Mark* 0.4) + (Examination Mark* 0.6)
a. Identify the inputs and outputs in the problem above. [5 Marks]
b. Write a complete pseudocode for the problem above. [9 Marks]
3. Given the array below,
0
1
2
3
4
5
6
2
10
7
8
15
a. Write a pseudocode to display the elements from index 2 to index 4 in the array
above. [4 Marks]
4. Write a pseudocode that will count the positive and negative numbers that are received
as input from the user. The program should allow the user to enter 10 numbers in total
(positive and negative) continuously. The count of positive numbers and the count of
negative numbers should then be displayed to the screen. Use a WHILE loop for your
solution. [8 Marks]
5. Convert the following Linear IF Statement to a Case Structure pseudocode. [S Marks]
Start
Prompt user for the level in algorithms
Get level
IF (level== 1) THEN
userlevel = "Beginner"
ELSEIF (level == 2) THEN
Page 6 of 8

7 Page 7

▲back to top


userLevel = "Intermediate"
ELSEIF (level== 3} THEN
userLevel = "Expert"
ELSE
userLevel = "Invalid level"
ENDIF
ENDIF
ENDIF
DISPLAY userLevel
End
6. Convert the following pseudocode into a flowchart. (9 Marks]
Start
Prompt for language code
Get languageCode
IF(languageCode == 'E'} THEN
DISPLAY"You have chosen English."
ELSEIF(languageCode == 'A'} THEN
DISPLAY"You have chosen Afrikaans."
ELSEIF(languageCode == 'O') THEN
DISPLAY"You have chosen Otjiherero."
ELSE
DISPLAY"Invalid choice."
ENDIF
ENDIF
ENDIF
ENDIF
End
Page 7 of 8

8 Page 8

▲back to top


7. Create a function named lowestMark(), that receives two arrays as parameters and
return and display the name of the student with the lowest mark. Your program should
allow the user to enter the names of 10 students and their test marks and store them in
two separate arrays. One array is for the student's name, and the other array is for the
student's test mark. Your solution must include a function call. [20 Marks]
************************ End of the Paper************************
Page 8 of 8