BIT1303A BBIT105 BAC1203 BISF1203 BSD1203  PROGRAMMING METHODOLOGY INTRODUCTION TO PROGRAMMING.

UNIVERSITY EXAMINATIONS: 2018/2019
EXAMINATION FOR THE DEGREES OF BACHELOR OF SCIENCE IN
IT/ BUSINESS IT/ APPLIED COMPUTING/ ISF/ SD
BIT 1303A/BBIT 105/BAC 1203/ BISF 1203/ BSD 1203: PROGRAMMING
METHODOLOGY/ INTRODUCTION TO PROGRAMMING
FULLTIME/ PART TIME/ DISTANCE LEARNING
ORDINARY EXAMINATIONS
DATE: DECEMBER, 2018 TIME: 2 HOURS
INSTRUCTIONS: Answer Question One & ANY OTHER TWO questions.

QUESTION ONE [30 MARKS]
a) Explain any FOUR data types in the C programming language. (4 Marks)
b) Write single line statements to accomplish the following:
i) Prompt the user to enter an integer (2 Marks)
ii) Read an integer from the keyboard an assign it to variable “num” (2 Marks)
iii) If the variable “num” is not equal to 9, print “value not 9” (2 Marks)
iv) Print the message “This is a C program”, on two lines where first line ends with C. (2 Marks)
c) Distinguish between relational and logical operators and give examples of each. (6 Marks)
d) Briefly explain any TWO advantages and TWO disadvantages of imperative programming
paradigm. (4 Marks)
e) Define the term ‘algorithm’ and describe any FOUR characteristics of algorithms (5 Marks)
f) Predict and explain the output of the following C code: (3 Marks)
#include<stdio.h>
#define min(a,b) (a<b)? a:b
int main()
{
int a,b; a=8; b=3;
printf(“%d”,min(a,b));
return 0;
}
QUESTION TWO [20 MARKS]
a) Describe any THREE attributes of a variable. (3 Marks)
b) Identify THREE rules for naming variables in C (3 Marks)
c) Write a C main() function that finds the length of a typed string value (6 Marks)
d) Write a program in C that prints the square of all elements of a square matrix using a
function that is called from main(). (8 Marks)
QUESTION THREE [20 MARKS]
a) Discuss the idea behind programming language control structures. (2 Marks)
b) Explain the differences between the following:
i) ‘A’ and “B” (2 Marks)
ii) Escape sequence character and format specifier character (2 Marks)
iii) Symbolic constant and literal constant (2 Marks)
c) Write a program in C that reads N numbers iteratively and prints biggest and smallest of
these numbers (6 Marks)
d) Discuss any THREE differences between first and second generation of programming
languages. (3 Marks)
e) Identify any THREE advantages of using C as a programming language (3 Marks)
QUESTION FOUR [20 MARKS]
a) Define the following terms commonly used in C and offer examples:
i) Compound statement (2 Marks)
ii) Operator precedence (2 Marks)
b) Explain what each of the following lines of code does. Also write the output of the program.
(6 Marks)
int i, j;
for(i=1, j=0; i+j<25; i+=2, j+=3) {
printf(“%d \n”, j+i);
}
c) A program is required to request and accept a digit between 1 and 10. If the digit is 1-4 the
program should assign the user 200 points and display these points. Otherwise it should
request for a number between 50 and 150, divide this input by 200 and display the output.
Create a flowchart or write pseudocode to illustrate the solution. (5 Marks)
d) Write a program in C to store the integers in the following table (hint: ignore the row and
column labels) (5 Marks)


(5 Marks)
QUESTION FIVE [20 MARKS]
a) Discuss any THREE program errors and give examples of such errors (6 Marks)
b) Explain the following types of testing:
i) Alpha testing (2 Marks)
ii) Beta testing (2 Marks)
c) A program is required to request and accept the marks for four subjects, then compute and
display the total marks, the average and the grade. The grade is computed in the following
manner: • 70-100 = A • 60-69 = B • 50-59 = C • 40-49 = D • 0-39 = F
Required:
i) Create a flowchart to design the solution. (4 Marks)
ii) Write C code to implement this solution. (6 Marks)
0 1 2 3
0 10 20 30 40
1 100 200 300 400
2 1000 2000 3000 4000

(Visited 108 times, 1 visits today)
Share this:

Written by