0% found this document useful (0 votes)
8 views

Sit106 Programming Methodology 2

The document outlines the structure and content of a supplementary/special examination for Machakos University students in the School of Engineering and Technology, specifically for the Computing and Information Technology department. It consists of five questions covering various programming concepts, including definitions, comparisons, algorithm characteristics, programming errors, and practical coding tasks in C language. Students are instructed to answer Question One and any two additional questions from the paper.

Uploaded by

kengashkg7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Sit106 Programming Methodology 2

The document outlines the structure and content of a supplementary/special examination for Machakos University students in the School of Engineering and Technology, specifically for the Computing and Information Technology department. It consists of five questions covering various programming concepts, including definitions, comparisons, algorithm characteristics, programming errors, and practical coding tasks in C language. Students are instructed to answer Question One and any two additional questions from the paper.

Uploaded by

kengashkg7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Machakos University

Supplementary/Special Examination
SCHOOL OF ENGINEERING AND TECHNOLOGY
DEPARTMENT OF COMPUTING AND INFORMATION TECHNOLOGY

BACHELOR OF SCIENCE (COMPUTER SCIENCE)


BACHELOR OF SCIENCE (INFORMATION TECHNOLOGY)

SCO102: INTRODUCTION TO PROGRAMMING


SIT101: INTRODUCTION TO STRUCTURED PROGRAMMING
SIT106: PROGRAMMING METHODOLOGY
DATE: Time:

Instructions
This paper consists of FIVE questions.
Answer QUESTION ONE and other TWO questions in this paper.

Question One

(a) (i) Define the term programming translation as used in computer programming. (2 marks)

(ii) Compare an interpreter and a compiler as used in computer programming. (4 marks)

(b) Tom, a programmer wrote an algorithm for a program. Explain three characteristics of
algorithms he could have considered. (6 marks)

(c) (i) During a programming lesson, students incorporated comments in their program.
I. Explain the term comment as used in the statement. (2 marks)
II. State two ways through which comments are included in a C program.
(2 marks)

(ii) An organization has tasked you with writing a good program for them. Explain three
qualities you would consider. (6 marks)

(d) (i) Define the term recursive function. (2 marks)

(ii) Write a program in C language that would prompt a user to enter an integer. The
program then checks whether the integer entered in even or not and outputs the result.
(6 marks)
1
Question Two
(a) (i) Outline two disadvantages of using machine code when writing a program. (2 marks)
(ii) The following program segment created by a student has some syntax errors. Use it to answer
the question that follows.
Include<stdio.h>
int Main ( )
float x, y product
scanf(“%d%d\n a, b);
product = x * y;
printf(product);
Rewrite the program correctly. (4 marks)

(b) Computer programming have evolved over time. Discuss two paradigms that have been part
of this evolution. (4 marks)

(c) (i) Distinguish between call by value and call by reference as used in programming. (4 marks)
(ii) Write a program in C language that would prompt a user to enter distance in meters. The
program then converts the distance entered into kilometers through a function and outputs the
result. (6 marks)

Question Three
(a) The following are variable names used by a student in a C language program.
(i) Try out
(ii) Mashunjaa_Day
(iii) StudentDetails
(iv) with
State the validity of each of the variables giving a reason for your answer. (4 marks)

(b) Explain each of the methods of program testing: (6 marks)


(i) Integration testing;
(ii) Stress testing;
(iii) Unit testing.

(c) The following is an output from a computer program. Use it to answer the question that follows:
5
6 6
7 7 7
Write a program in C language that would generate the output. (4 marks)

(d) (i) Define the term function call as used in programming. (2 marks)

(ii) A program accepts two integers, it checks which of the two integers is larger than the other
and outputs the result. Draw a flow chart to represent the program logic. (4 marks)

2
Question Four

(a) Outline three operations carried out on a queue data structure. (3 marks)

(b) Write a program in C language that would store five elements in an array and output the elements in
reverse order of entry. (6 marks)

(c) (i) Explain sentinel value as used in programming. (2 marks)

(ii) Distinguish between conditional and unconditional looping. (4 marks)

(d) A university has installed a program that allows lecturers to key in marks for students. When a
registration number is entered the program checks whether the student has cleared the semester fee.
If a student has cleared then the lecturer keys in the marks otherwise a “NOT CLEARED” message
is displayed. Write a pseudocode for this scenario. (5 marks)

Question Five

(a) (i) Define the term pointer as used in C language programming. (2 marks)

(ii) Write a C language statement to declare a pointer to a float variable name Number and assign
it the memory address 2150. (3 marks)

(b) (i) Outline the three levels of computer programming languages. (3 marks)
(ii) Explain three characteristics of a fourth-generation programming language. (6 marks)

(c) Table 1 shows the approval criteria used by a certain bank. Use it to answer the question that
follows.

Evaluation Loan Limit


Result
1 10,000,000
2 5,000,000
3 1,000,000
4 500,000
Default 100,000
Table 1

Write a program in C language that would prompt a user to enter the evaluation result. The program
then outputs the loan limit for the applicant. Use switch control structure. (6 marks)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy