









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










INSTRUCTIONS DATE: 02/06/2020 TIME: 3 HOURS ANSWER ALL QUESTIONS IN SECTION A ANSWER ALL QUESTIONS IN SECTION B _____________________________________________________________________________________
SECTION A QUESTION ONE
a) Define computer programming (2 marks) b) What is the difference between algorithm and pseudo code? (4 marks) c) Explain machine language (2 marks)
QUESTION TWO
a) Define a compiler (2 marks) b) What is the low level language and high level language? (4 marks) c) Define HTML (2 marks)
QUESTION THREE
Explain the following elements of algorithm
I. Acquire data II. Computation
III. Selection IV. Iteration (8 marks)
QUESTION FOUR
a) Define subroutine (2 marks) b) Write four reasons C programming has become a widely used professional language (4 marks) c) Define linking (2 marks)
QUESTION FIVE
Write and explain the C structure of “ hello world ” program (8 marks)
SECTION B
QUESTION ONE
Write an algorithm and flowcharts of the following two problems listed below;
I. Determine and output whether number N is even or old. II. Determine whether a student passed the exam or not. (20 marks)
QUESTION TWO
a) Fill in the blank spaces of the diagram below on the data types in C programming
(10 marks)
b) Define the following terms
C DATA TYPE
Primary data type Secondary data type
1._________
2._________
3.__________
4.___________
5.__________
1._________
2._________
3.__________
4.___________
5.__________
QUESTION FIVE
a) Define the following terms in C programming I. Function II. Procedure III. Subprogram IV. Routine (8 marks) b) Define a programmer (2 marks) c) There are six basic symbols commonly used in the flowchart. You are requested to name and state the functions of the five symbols in the table below. Symbol Name Function
(10 marks)
END OF MOCK EXAMS (ALL THE BEST NDHLOVU)
a) Define computer programming (2 marks)
Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result. Programming involves tasks such as: analysis, generating algorithms, profiling algorithms' accuracy and resource consumption, and the implementation of algorithms in a chosen programming language (commonly referred to as coding ).
b) What is the difference between an algorithm and a pseudo code? (4 marks)
An algorithm is a sequence of steps which is utilized in order to solve a computational problem whereas pseudo code is nothing but a more simple form of an algorithm which involves some part of natural language to enhance the understandability of the high-level programming constructs or for making it more human-friendly. This is it.
The main difference between an algorithm and a pseudo code is that an algorithm is a step by step procedure to solve a given problem while a pseudo code is a method of writing an algorithm. An algorithm is a procedure for solving a problem. In other words, it is a sequence of steps to solve a given problem.
c) Explain machine language. (2 marks)
Sometimes referred to as machine code or object code , machine language is a collection of binary digits or bits that the computer reads and interprets. Machine language is the only language a computer is capable of understanding. The exact machine language for a program or action can differ by the operating system on the computer. The specific operating system will dictate how a compiler writes a program or action into machine language.
a) Define a compiler. (2 marks)
A compiler is a software program that converts computer programming code written by a human programmer into binary code (machine code) that can be
IV. Iteration: This is some means of repeatedly executing a collection of instructions, for a fixed number of times or until some logical condition holds.
a) Define subroutine. (2 marks)
A routine or subroutine , also referred to as a function , procedure , and subprogram , is code that may be called and executed anywhere in a program. For example, a routine may be used to save a file or display the time. Instead of writing the code each time these commonly performed tasks are needed, routines are created and called when these tasks need to be performed. Below is a basic example of a Perl subroutine.
b) Write four reasons C programming has become a widely used professional language. (4 marks)
c) Define linking. (2 marks)
Linking is the process of collecting and combining various pieces of code and data into a single file that can be loaded (copied) into memory and executed. Linking can be performed at compile time, when the source code is translated into machine code, at load time, when the program is loaded into memory and executed by the loader, and even at run time, by application programs. On early computer systems, linking was performed manually. On modern systems, linking is performed automatically by programs called linkers.
QUESTION FIVE
Write and explain the C structure of “ Hello World ” program. (8 marks)
A C program basically consists of the following parts:
Preprocessor Commands Functions Variables Statements and Expressions Comments
A simple C structure code that would print the words "Hello World" would be:
#include
int main() { /* my first program in C */ printf("Hello, World! \n");
return 0; }
Explaining the various parts of the program code: The first line of the program _#include _ is a preprocessor command, which tells a C compiler to include stdio.h file before going to actual compilation. The next line int main() is the main function where the program execution begins. The next line /.../ will be ignored by the compiler and it has been put to add additional comments in the program. So such lines are called comments in the program. The next line printf(...) is another function available in C which causes the message "Hello, World!" to be displayed on the screen. The next line return 0; terminates the main() function and returns the value 0.
Write an algorithm and flowcharts of the following two problems listed below:
II. Determine whether a student passed the exam or not. (20 marks)
Algorithm:
Step 1: Input grades of 4 courses M1, M2, M3 and M4, Step 2: Calculate the average grade with formula "Grade=(M1+M2+M3+M4)/4" Step 3: If the average grade is less than 60, print "FAIL", else print "PASS". Step 4: Stop.
Flow Chart:
a) Fill in the blank space of the below diagram on the data types in C programming.
(10 marks)
b) Define the following terms. (6 marks)
I. Syntax: Syntax refers to the structure/form of the code that a specific programming language specifies.
II. Semantics: Semantics deals with the meaning assigned to the symbols, characters and words in the programming language.
III. Inference rules: An Inference Rule is a pattern establishing that if we know that a set of premise statements of certain forms are all true, then we can validly deduce that a certain related conclusion statement is true.
IV. Proposition: A proposition is the basic building block of logic. It is defined as a declarative sentence that is either True or False, but not both. The Truth Value of a proposition is True(denoted as T) if it is a true statement, and False(denoted as F) if it is a false statement.
C DATA TYPES
Primary Data Types Secondary Data Types
and void.
II. Derived Data Types: Derived data types are the same as primary data types but just a little twisted or grouped together like array , structure , union, and pointer. These are also called Secondary Data Types.
III. User Defined Data Types: C language supports a feature where the user can define an identifier that characterizes an existing data type. This user defined data type identifier can later be used to declare variables. So its purpose is to redefine the name of an existing data type. (6 marks)
d) What is a loop? (2 marks)
In computer programming, a loop is a sequence of instructions that is continually repeated until a certain condition is reached. Typically, a certain process is done, such as getting an item of data and changing it, and then some condition is checked such as whether a counter has reached a prescribed number. If it hasn't, the next instruction in the sequence is an instruction to return to the first instruction in the sequence and repeat the sequence. If the condition has been reached, the next instruction "falls through" to the next sequential instruction or branches outside the loop. A loop is a fundamental programming idea that is commonly used in writing programs.
QUESTION FOUR
a) Outline two reasons why it is important to test a software in the process of developing it. (4 marks)
b) State and explain three general instructions for a flowchart. (6 marks)
(1) All boxes of flowcharts are connected with arrows to show the logical connection between them. (2) Flowcharts will flow from top to bottom. (3) All flowcharts start with a Start Box and end with a Terminal Box.
c) Write on the following system development: (10 marks)
I. Joint Application Development: Joint Application Development (JAD) is a development methodology system originally used for designing a computer-based system, but can be applied to any development process. It involves continuous interaction with the users and different designers of the system in development. JAD centers around a workshop session that is structured and focused. Participants of these sessions would typically include a facilitator, end users, developers, observers, mediators and experts. JAD allows for a faster development process and minimizes errors at the same time. JAD also improves the quality of the final product by focusing on the up-front portion of the development lifecycle, thus reducing the likelihood of errors that are expensive to correct later on. Rapid Application Development (RAD) is the opposite of Joint Application Development (JAD).
II. Rapid Application Development: Rapid Application Development (RAD) is a form of agile software development methodology that prioritizes rapid prototype releases and iterations. Unlike the Waterfall method, RAD emphasizes the use of software and user feedback over strict planning and requirements recording. Rapid Application Development (RAD) is the opposite of Joint Application Development. (JAD).
a) Define the following terms in C programming. (8 marks)
I. Function: This refers to any named code block in C. II. Procedure: This is a named block of code, like subroutine. III. Subprogram: This is a program inside any lager program that can be reused any number of times. IV. Routine: A routine is any sequence of code that is intended to be called and used repeatedly during the execution of a program.
b) Define a programmer. (2 marks)
A programmer is a skilled professional, an individual that writes or creates computer software or applications called programs by giving the computer specific programming instructions. Most programmers have a broad computing and coding background across multiple programming languages and platforms, including Structured Query Language (SQL), Perl, Extensible Markup Language