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

SPI 2101 Introduction To Computer Programming Year I II Semester I

The document is an examination paper for the University for the course SPI 2101: Introduction to Computer Programming. It includes various questions related to C programming, such as writing functions, understanding data types, and creating flowcharts. Students are instructed to attempt question one and any other two questions from the paper.

Uploaded by

floydannold
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)
21 views3 pages

SPI 2101 Introduction To Computer Programming Year I II Semester I

The document is an examination paper for the University for the course SPI 2101: Introduction to Computer Programming. It includes various questions related to C programming, such as writing functions, understanding data types, and creating flowcharts. Students are instructed to attempt question one and any other two questions from the paper.

Uploaded by

floydannold
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

UNIVERSITY EXAMINATION 2020/2021

YEAR 1/2 SEMESTER I/II EXAMINATION FOR THE DEGREE OF BACHELOR OF


SCIENCE IN ANALYTICAL CHEMISTRY/ACTUARIAL SCIENCE

SPI 2101: INTRODUCTION TO COMPUTER PROGRAMMING

DATE: Monday, 24th May,2021 TIME: 11.00 am – 1.00 pm

Instructions: Attempt question ONE and ANY OTHER TWO Questions


Question One
a) Describe the term Pseudocode. (2 Marks)
b) Using while loop, write a C function that can accept five integers and display their
average. (5 Marks)
c) Using sample code distinguish between single line and multi-line comments in C
programming. (2 Marks)
d) Using sample code, describe any two preprocessor directives used in C
programming. (2 Marks)
e) Study the C program below, identify and correct the errors. (4 Marks)

f) Write a C program that can output numbers 30 to 50 in reverse order. The


program should be implemented using for structure. (5 Marks)

Page 1 of 3
g) Describe three translator programs used in programming. (3 Marks)
h) Write a code snippet to declare a two dimensional array called 'Grade' of 3
rows and 3 columns. Initialize the array with the following values. 56, 98, 53,
74, 62, 81, 59, 61, 78. (4 Marks)
i) Study the variables below and indicate whether they are valid or invalid. Justify
your answer. (3 Marks)
1. @totalweight
2. Net Weight

3. Weekl
Question Two
a) Using for loop, write a C program that can generate the output below.
(7 Marks)

b) Draw a flowchart that can compare weights of three students and display the
heaviest. (7 Marks)
c) Using examples explain any three data types used in C programming. (6 Marks)
Question Three
a) Write a C program to generate the multiplication table below as output. (7 Marks)

b) Explain the purpose of printf() and scanf() functions in C programming. (4 Marks)


c) Write an algorithm to calculate simple interest of loans offered by financial
institutions. Hint: Inerest = (principle*Rate*time)/100 (6 Marks)
d) Describe three advantages of high level languages. (3 Marks)

Page 2 of 3
Question Four
a) Write a C program that can display the grades on the table below based on
the inputted marks. The program should be implemented using switch statement.
(7 Marks)

b) Draw a flowchart for the above program. (7 Marks)


c) Explain two advantages of assembly language. (4 Marks)
d) Write the syntax for constant declaration in C programming. (2 Marks)
Question Five
a) Using examples, distinguish between arithmetic and relational operators. (4 Marks)
b) Write a code snippet that demonstrates local and global variable declaration in
C programming. (4 Marks)
c) Write an algorithm to calculate the circumference of a circle with radius greater
than 15. (6 Marks)
d) Translate the above algorithm (Q3 c) to a Pseudocode. (6 Marks)

Page 3 of 3

You might also like