Get premium membership and access revision papers, questions with answers as well as video lessons.
Got a question or eager to learn? Discover limitless learning on WhatsApp now - Start Now!

Introduction To Programming Question Paper

Introduction To Programming 

Course:Bachelor Of Science In Computer Information Systems

Institution: Kenya Methodist University question papers

Exam Year:2012



DEPARTMENT OF COMPUTER SCIENCE AND BUSINESS INFORMATION
CISY 110/BBIT 121: INTRODUCTION TO PROGRAMMING
Date: November 2012
1. A user has given you the following pseudo code for a task he has to perform
a. j ? 80
b. do while j ? 0
c. j ? j -5
d. if j is divisible by 3 then
goto line b.
e. display j
f. if there is no remainder when j divided by 3 then
goto line h.
g. loop
h. display “Done”
i. Convert the pseudo code to structured C++ code. (4 Mks)
ii. What is the output (screen print/capture) of the program? (1 Mks)
2. Think of a program that reads four numbers from a user and determines the largest of the
four
i. Write an algorithm that would be used to solve the problem (2 Mks)
ii. Draw a flowchart representation of your algorithm (3 Mks)
iii. Write a C++ program to solve the problem (5 Mks)

3. For a certain electric circuit with an inductance L and resistance R, the dumped natural
frequency is given by: frequency =
C
R
LC 4 2
2 1 ? . It is desired to study the variation of
these frequency with capacitor C. Write a program to calculate the values C staring from
0.01 (in steps of 0.01) to 0.1. (5 Mks)
4. Write a program that converts the temperature from Celsius (ºC) to Fahrenheit (ºF) from – 50oc to 50oc in steps if 5.
Use the formula:
fahrenheit = 5
9
* celsius + 32
Celsius = (fahrenheit - 32)*
9
5 (10 marks)

5. In inventory management the economic order quantity for a single item is given by:
EOQ =
holdingCost
2*demandRate* setUpCost and the optimal time between the orders is given
by TBO =
demandRate holdingCost
setUpCost
*
2* . Write a C++ program to compute EOQ and
TBO (optimal time), and it should prompt to give the demand rate given in item per unit
time, setup cost per order and the holding cost per item per unit time. (5 Mks)
6.6. A hardware merchant sells steel bars at a flat rate of Kes 1000.00 per meter, and has
announced the following discounts:
Quantity of steel bar bought (per meter) Discount (%)
<20 0
21-40 5
41-60 10
61-80 15
81-100 20
>100 25
Implement the following programs:
i. Using if..else statement, write a program that accepts the quantities of steel bar
purchased and displays the amount to be paid by the customer. (5 Mks)
ii. Using switch statement, write a program that accepts the quantities of steel bar
purchased and displays the amount to be paid by the customer. (5 Mks)






More Question Papers


Popular Exams



Return to Question Papers