Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
8 views

c Programing (1)

Uploaded by

Mighty
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

c Programing (1)

Uploaded by

Mighty
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

DAEYANG UNIVERSITY

COLLEGE OF ICT

END OF SEMESTER EXAMINATION

BICT 121: Structured Programming in C

Date: 27th July 2020 Time Allowed: 6:00-24:00 Hours

Read the instructions carefully

1. This paper contains FIVE questions, please check. Answer ALL of them.
2. Write your registration number on each answer sheet provided.
3. Marks have been indicated at the end of each question please check
4. No books, dictionaries, phones, notes or any other reference materials are
allowed in this examination.
5. Do not open this paper until you are instructed to do so by the invigilator.
Question 1

a. Define the following


i. An array (2 marks)
ii. A pointer (2 marks)
iii. A function (2 marks)
iv. A loop (2 marks)
v. Recursion (2 marks)

b. While exercising, you can use a heart-rate monitor to see that your heart rate
stays within a safe range suggested by your trainers and doctors. According to
the American Heart Association (AHA), the formula for calculating your
maximum heart rate in beats per minute is 220 minus your age in years. Your
target heart rate is a range that’s 50–85% of your maximum heart rate. [Note:
These formulas are estimates provided by the AHA. Maximum and target heart
rates may vary based on the health, fitness and gender of the individual.
Always consult a physician or qualified health care professional before
beginning or modifying an exercise program.] Create a program that reads the
user’s birthday and the current day (each consisting of the month, day and
year). Your program should calculate and display the person’s age (in years),
the person’s maximum heart rate and the person’s target-heart-rate range.
(10 marks)

Question 2

a. Drivers are concerned with the mileage obtained by their automobiles. One
driver has kept track of several tankfuls of gasoline by recording miles driven
and gallons used for each tankful. Develop a program that will input the miles
driven and gallons used for each tankful. The program should calculate and
display the miles per gallon obtained for each tankful. After processing all
input information, the program should calculate and print the combined miles
per gallon obtained for all tankfuls. (10 marks)
b.
c. Write a program in C to check whether a number is a prime number or not
using the function.

(10 marks)

Question 3

a. Using a user defined function write a program that will do the following
addition, multiplication, division and subtraction: (10 marks)
b. Write a C program to read temperature in centigrade and display a suitable
message according to temperature state below.
Temp < 0 then Freezing weather
Temp 0-10 then Very Cold weather
Temp 10-20 then Cold weather
Temp 20-30 then Normal
Temp 30-40 then Its Hot
Temp >=40 then Its Very Hot (10 marks)

Question 4

a. Write a C program to read roll no, name and marks of three subjects and
calculate the total, percentage and division. (10 marks)
b. Write a C program to check whether a triangle can be formed by the given
value for the angles. (10 marks)

Question 5

a. One interesting application of computers is drawing graphs and bar charts


(sometimes called “histograms”). Write a program that reads five numbers
(each between 1 and 30). For each number read, your program should print a
line containing that number of adjacent asterisks. For example, if your program
reads the number seven, it should print *******. (10 marks)

b. Write a C program that plays the game of “guess the number” as follows: Your
program chooses the number to be guessed by selecting an integer at random
in the range 1 to 1000. The program then types: (10 marks)
End of Question Paper

You might also like