0% found this document useful (0 votes)
35 views3 pages

Sit 106 Programming Methodology 4

The document is an examination paper for the Bachelor of Science in Information Technology at Machakos University, focusing on Programming Methodology. It includes various questions related to flowcharts, programming languages, loops, algorithms, and C programming concepts. Students are required to answer one compulsory question 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)
35 views3 pages

Sit 106 Programming Methodology 4

The document is an examination paper for the Bachelor of Science in Information Technology at Machakos University, focusing on Programming Methodology. It includes various questions related to flowcharts, programming languages, loops, algorithms, and C programming concepts. Students are required to answer one compulsory question 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

University Examinations for 2020/2021 Academic Year


SCHOOL OF ENGINEERING AND TECHNOLOGY
DEPARTMENT OF COMPUTING AND INFORMATION TECHNOLOGY
FIRST YEAR FIRST SEMESTER EXAMINATION FOR
BACHELOR OF SCIENCE (INFORMATION TECHNOLOGY)
SIT 106: PROGRAMMING METHODOLOGY
DATE: 1/3/2021 TIME: 2.00-4.00 PM
INSTRUCTIONS
Answer question ONE and any other TWO questions.
QUESTION ONE (COMPULSORY) (30 MARKS)
a) Name and explain three basic symbols of a flowchart (6 marks)
b) Draw a flow chart diagram for a program that checks if a number is prime number or not.
(4 marks)
c) Programming languages use assembler, compiler and interpreter to produce results of the
programs given. Explain the function of each of the THREE resources. (6 marks)
d) We programmers use pre decrement operator and post decrement operators in our programs.
Using a simple code snippet, illustrate how each of the above decrement operators can be used
correctly in a C program. (6 marks)
e) Write a program using the WHILE loop to output 1-10 in ascending order. (6 marks)
f) What will be the output of the following C code? (2 marks)
#include <stdio.h>
int main()
{
float f = 1;
switch (f)
{
case 1.0:
printf("yes\n");
break;
default:
printf("default\n");
}
}

Examination Irregularity is punishable by expulsion Page 1 of 3


QUESTION TWO (20 MARKS)
a) Most C Programs use a technique called divide and conquer. What do you understand by the
statement “divide and conquer” with reference to programming. (4 marks)
b) Describe four rules for naming a variable in C program (4 marks)
c) Strings are always enclosed by double quotes. A programmer can use the following
declarations while writing a program
 char string[20] = “fresh2refresh”; (or)
 char string [] = “fresh2refresh”;
You are required to:
i) Differentiate the above declarations (4 marks)
ii) use strcpy() to write a program in C to copy one string to another string (4 marks)
d) write a code snipet in C program to illustrate the use of assignment operators. (4 marks)

QUESTION THREE (20 MARKS)


a) Many programmers use loops in their programs. With the aid of a code snippet, illustrate
ONE type of a loop used in C program. (3 marks)
b) What is the difference between ++x and x++? (3 marks)
c) Write a code program by defining a function called “square” that calculates the square of two
given numbers. The user should enter the numbers to be squared. (4 marks)
d) Write a C program that adds 2 numbers. The user will enter the numbers to be added.
(4 marks)
e) In programming, the use of algorithms cannot be assumed. Explain THREE important
features of an algorithm? (6 marks)
QUESTION FOUR (20 MARKS)
a) Write a program to print the multiplication table up to ten of the number entered by the
user. The table should be displayed in the following format: (6 marks)
29 * 1 = 29
29 * 2 = 58
b) Differentiate between pass by reference and pass by value. (4 marks)
c) What is the explanation for prototype function in C? Illustrate using a code snippet
(4 marks)
d) Enumerate and explain the THREE types of errors that can occur during the execution of a
computer program? (6 marks)

Examination Irregularity is punishable by expulsion Page 2 of 3


QUESTION FIVE (20 MARKS)
a) Main (), and Size of () are used in programming. Explain the meaning of each of the
expressions using code snippets. (6 marks)
b) Storage classes are used in C Programming language. Explain giving two examples why
storage classes are used in the program. (4 marks)
c) Identify four errors in the following code program. (4 marks)
#include<stdio.h>
{
int n;
printf("Enter an integer\n");
scanf("",&n);
if ( n%2 == 0 )
printf("Even\n");
else
printf("Odd\n");
return 0;
}
d) Programmers use C programming language on everyday life. Discuss three main areas where
C programming language is used. (6 marks)

Examination Irregularity is punishable by expulsion Page 3 of 3

You might also like