A 3 by 4 matrix M is to be added to another 3 by 4 matrix array N so as to give a third 3 by 4 matrix array P. Using a high level programming language, write a program segment that assigns the sum of M and N to P.
Program add matrix (input, Output);
Type Matrix = Array (14, 13) of integer; Var A, B, C: Matrix; I, J: Integer; Producer add (Var X, Y, Z: Matrix); Begin (add) For I: to 3 do Begin For J: 1 to 4 do Z [l,J]: X [l, J] + Y[l,J]; End End; {add}
0 Comments
High level programming languages
Question Source: KNEC KCSE 1998 Computer Studies
The ‘while…do’ loop is a control structure designed to execute the same block of code again and again until a certain condition is fulfilled. This loop is used if a condition has to be met before the statements within the loop are executed. A program is required for reading in a student’s name and scores obtained in two subjects. The output of the program will consist of the student’s name, the two scores, the average of the two scores and comment. The comment is based on the average as follows:
Write a program to solve the problem using a high level language (15 mks)
In the following flowchart, what will be the value of the sum when printed?
Show how you arrive at your answer. Steps in program development cycle in their logical sequence
Name six steps in program development cycle in their logical sequence. (3mks)
Advantages of computer networking
Reasons why computer networks are important:
Define the term array as used in computer programming (2mks)
An array is a structure, which holds many variables, all of the same data type.
The array consists of so may element, each element of the array capable of storing one piece of data (variable)
An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type.
What are the applications of array?
The roots of the equation ax2 +bx + c= 0 are by the formula
a) Draw a flowchart to compute the roots of the equation. (10 mks)
Give two differences between high-level and low-level languages
What is program documentation? Give two examples of program documentations.
This refers to information that serves to explain the purpose of a program.
Documentation may be internal in the form of comments and appropriate named variables and constants e.t.c. or may be extended in the form of a written description and structure diagram. E.g. user oriented and program oriented.
Testing of a program should not be miscued with system implementation and testing of SDLC stages.
Testing of a program is also called debugging and its done by programmers unlike system testing phase done by Quality assurance professionals. Expected Response
For debugging to take place, the programmer needs the following tools.
|
Categories
All
Archives
December 2024
|
Can't find what you are looking for? Don't worry, Use the Search Box Below.
Primary Resources
College Resources
|
Secondary Resources
|
Contact Us
Manyam Franchise
P.O Box 1189 - 40200 Kisii Tel: 0728 450 424 Tel: 0738 619 279 E-mail - sales@manyamfranchise.com |