c Programming Asses Ment
c Programming Asses Ment
WRITTEN ASSESSMENT
Time: 3 HOURS
INSTRUCTIONS TO CANDIDATE
a) Python
b) Java
c) Assembly
d) C++
a) Designing databases
b) Defining data types
c) Solving a problem step-by-step
d) Formatting text
3. A variable is:
a) A constant value
b) A memory location to store data
c) A reserved keyword
d) A type of error
a) int
b) char
c) float
d) bool
a) Compiling
b) Debugging
c) Coding
d) Executing
Page 2 of 8
a. Programming Language
b. Algorithm
c. Data Type
d. Variable
e. Function
Answer one of the following tasks. Ensure your code is well-commented and easy to understand.
Option 2: Develop a C program that uses a function to calculate the square of a number. The
function should accept one parameter and return the square of that number. Implement the
program using appropriate function declaration.
Option 3: Create a basic algorithm to find the largest number in a given array of 10 numbers.
Provide the algorithm in pseudocode and then implement it in C programming language.
End of Assessment
Page 3 of 8
ICT Technician Level 5: Develop Computer Program Answers
Total Marks: 70
1. c) Assembly
2. c) Solving a problem step-by-step
3. b) A memory location to store data
4. c) Float
5. b) Debugging
1. Definitions:
o Programming Language: A formal language comprising instructions used to
produce various kinds of output through computers.
o Algorithm: A step-by-step set of instructions to solve a particular problem.
o Data Type: Classification of data which determines the type of value a variable
can hold (e.g., int, float, char).
o Variable: A named storage location in memory used to store data.
o Function: A block of code that performs a specific task when called.
2. History of Programming Languages:
o 1940s: First-generation machine languages using binary code.
o 1950s: Assembly languages using symbolic representations.
o 1957: FORTRAN, the first high-level programming language.
o 1960s–1970s: Development of structured languages like C and Pascal.
o 1980s–Present: Object-oriented languages like C++, Java, and Python.
3. Program Development Cycle:
o Problem Identification
o Planning and Designing Algorithms
o Writing the Code
o Compiling and Debugging
o Testing and Execution
o Maintenance and Updates
4. Primitive vs Derived Data Types:
o Primitive Data Types: Basic types such as int, char, float, double.
o Derived Data Types: Formed using primitive data types, including arrays,
pointers, and structures.
o Example: int age = 25; // Primitive and int scores[5]; // Derived
5. Arrays:
Page 4 of 8
o An array is a collection of elements of the same data type stored in contiguous
memory locations.
o Example C Code to declare and initialize an array:
#include <stdio.h>
int main() {
int num1, num2;
printf("Enter two integers: ");
scanf("%d %d", &num1, &num2);
return 0;
}
#include <stdio.h>
int main() {
int number;
printf("Enter a number: ");
scanf("%d", &number);
printf("Square of %d is %d\n", number, square(number));
return 0;
}
START
DECLARE array[10]
READ values into array
SET largest = array[0]
FOR each element in array
Page 5 of 8
IF element > largest THEN
SET largest = element
ENDIF
ENDFOR
PRINT largest
END
C Program:
#include <stdio.h>
int main() {
int array[10], i, largest;
printf("Enter 10 numbers: ");
for(i = 0; i < 10; i++) {
scanf("%d", &array[i]);
}
largest = array[0];
for(i = 1; i < 10; i++) {
if(array[i] > largest) {
largest = array[i];
}
}
End of Answers
Page 6 of 8
ICT Technician Level 5: Develop Computer Program Marking Scheme
Total Marks: 70
1. c) Assembly - 1 Mark
2. c) Solving a problem step-by-step - 1 Mark
3. b) A memory location to store data - 1 Mark
4. c) Float - 1 Mark
5. b) Debugging - 1 Mark
1. Definitions (5 Marks)
o Programming Language (1 Mark)
o Algorithm (1 Mark)
o Data Type (1 Mark)
o Variable (1 Mark)
o Function (1 Mark)
2. History of Programming Languages (5 Marks)
o Accurate timeline (2 Marks)
o Major milestones (2 Marks)
o Examples of programming languages (1 Mark)
3. Program Development Cycle (5 Marks)
o Clear description of all stages (1 Mark each for the 5 stages)
4. Primitive vs Derived Data Types (5 Marks)
o Explanation of Primitive Data Types with examples (2 Marks)
o Explanation of Derived Data Types with examples (2 Marks)
o Comparison (1 Mark)
5. Arrays (5 Marks)
o Explanation of concept (2 Marks)
o Correct C code to declare and initialize an array of 5 integers (3 Marks)
Page 7 of 8
Section C: Practical Task (30 Marks)
Page 8 of 8