0% found this document useful (0 votes)
71 views2 pages

Ecv 102 Computer Programming I Main Exam

The document contains instructions and questions for an exam on computer programming. Question 1 is compulsory and contains subquestions on defining programming language and compiler, writing an algorithm to calculate triangle area, writing a C++ program to find the third angle of a triangle given two angles, and writing a program to calculate the selling price of an apartment with a 40% markup on construction cost. It also contains a subquestion involving an algorithm and C++ program to simulate an ATM transaction with various service charges. The remaining questions cover topics like if-else statements, stages of problem solving, data types, functions, algorithms, source and target code, case control structures, and variable scope and function definition.

Uploaded by

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

Ecv 102 Computer Programming I Main Exam

The document contains instructions and questions for an exam on computer programming. Question 1 is compulsory and contains subquestions on defining programming language and compiler, writing an algorithm to calculate triangle area, writing a C++ program to find the third angle of a triangle given two angles, and writing a program to calculate the selling price of an apartment with a 40% markup on construction cost. It also contains a subquestion involving an algorithm and C++ program to simulate an ATM transaction with various service charges. The remaining questions cover topics like if-else statements, stages of problem solving, data types, functions, algorithms, source and target code, case control structures, and variable scope and function definition.

Uploaded by

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

IST1010 INTRODUCTION

KENYATTA UNIVERSITY
UNIVERSITY EXAMINATIONS 2021/2022
FIRST YEAR, SECOND SEMESTER EXAMINATION FOR THE DEGREE OF BACHELOR OF
SCIENCE (CIVIL ENGINEERING)
ECV 102: COMPUTER PROGRAMMING I
DADATE: APRIL 2022 TIME: 2HOURS
------------------------ --------------------------------------------------------
INSTRUCTIONS
• This paper consists of FIVE questions
• Question ONE is compulsory and contains 30 marks
• Attempt any TWO of the remaining four questions. Each question is 20 marks
--------------------------------------------------------------------------------------------------------------

Question 1(30 Marks)

• Define the following terms and give example for each


• Programming language
• Language compiler [4 marks]
• Suppose a, b, and c denote the lengths of the sides of a triangle. Then the area of
the triangle can be calculated using the formula:

Design an algorithm that uses this formula to find the area of a triangle [4 marks]
• Write a program in C++ to enter two angles of a triangle and find the third angle.
[6 marks]
• To make a profit, the cost of constructing an apartment is marked up by 40%. Write a program to find the
selling price of apartment sold by real estate developer. [4 marks]
• An ATM allows a customer to withdraw a maximum of kshs 40000 per day. If a customer withdraws more
than kshs 30000, the service charge is 4% of the amount over kshs 30000. If the customer does not have
sufficient money in the account, the ATM informs the customer about the insufficient fund and gives the
option to withdraw the money for a service charge of kshs 250.00. If there is no money in the account or if
the account balance is negative, the ATM does not allow the customer to withdraw any money. If the
amount to be withdrawn is greater than kshs 40000, the ATM informs the customer about the maximum
amount that can be withdrawn.
•Write an algorithm that allows the customer to enter the amount to be withdrawn. The algorithm then
checks the total amount in the account, dispenses the money to the customer, and debits the account by the
amount withdrawn and the service charges, if any. [6 marks]
•Write a C++ program to implement above program. [6 marks]

Question 2(20 Marks).

• Using a simple diagram illustrate structure of if—else statement. [3 marks]


• Briefly explain stages of computer problem solving. State product of each stage.
[6 marks]
• Differentiate between inbuilt and user defined data types. Give example in each case.
[4 marks]

Functions [7 marks]

Question 3(20 Marks).

• Discuss any two characteristics of an algorithm. [4 marks]


• Briefly outline three reasons why programs aren’t written using natural language.
[4 marks]

[12 Marks]

Question 4(20 Marks).


• Briefly explain how the following product are generated
• Target code
• Source code [4 marks]
• Illustrate general structure of case control structure. [2 marks]
• Write a program that inputs three different items’ costs and outputs the cheapest of them.
[4 marks]
(d) The cutting speed of a drill is expressed as

Where
π (3.14): Circular constant
DC (mm): Drill diameter
n (min-1): Spindle speed
write a program to display various VC for drill diameter between 10mm
to 35 mm in steps of 3
[8 marks]

Question 5(20 Marks).

• Define the following items


• Code block
• variable scope
• function definition
[6 marks]
• Briefly explain any two disadvantages of low level programming language.
[4 marks]
c)

[10 marks]

***************************END OFEXAMINATION**********************

You might also like