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

Cosc101 Exam 17 - 18

This document is an examination paper for the Introduction to Programming in C course at Babcock University. It includes multiple sections with questions on programming concepts, data types, and practical coding tasks. Students are instructed to attempt all questions in Section A and select two from Section B, along with completing all questions in Section C.
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)
20 views3 pages

Cosc101 Exam 17 - 18

This document is an examination paper for the Introduction to Programming in C course at Babcock University. It includes multiple sections with questions on programming concepts, data types, and practical coding tasks. Students are instructed to attempt all questions in Section A and select two from Section B, along with completing all questions in Section C.
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

BABCOCK UNIVERSITY

ILISAN-REMO, OGUN STATE, NIGERIA .


__,,. .,,.. '
SCHOOL
-· OF COMPUTING AND ENGINEERING SCIENCES
COMPUTER SCIENCE DEPARTMENT

COURSE: Introduction to Programming in C (COSClOl ) SESSION: 2017/2018 I


LECTURERS: Adekola Daniel, Akande Oyebola, Ebiesuwa Oluwaseun (PhD) !
INSTRUCTION: Attempt all questions in Section A, 2 in Section Band all in section C ,,.,
FIRST SEMESTER EXAM
1

. S CTION A (Attempt all) (Total marks: 10)


1. Which one of the following is a primitive data 11 . What is the final value of count in the
type 4i C language: following code extract:
A. ' int B. array int i, count = O;
C. union D. struct for (i = 2; i < 10; i++)
count++;
2.Program execution,is done in the : 12. What is the result of the following
A.RAM ---.. . -
B. Hard Disk division operation: 17%5= ... ......
C.CPU D. CD-ROM
3. C is a .. .. .. ... .. .. ...... language. 13. Dividing a value by zero is categorized
A. Object Oriented B. Procedural under what type of error: .. ............ ...... .
C. weakly-typed D. Machine
4. A C language program runs on translator called: 14. Write the appropriate declaration for an
A. Interpreter B. Compiler 80-element character array named message:
C. Assembler D. DevC/C++ ..........
5.The symbols used in an assembly language are 15. Who invented C language
A. Codes B. Mnemonics
C. Assembler
··········· ·· ····· ··· ··
D. All of the above
6. C program execution starts from 16. What does the following represent in
A. begin() B. class() creating a function:
C. main() D. void
void factorial(int n);
7. These are properties of algorithm except: 17. Correct the error in the following line of
A. Finiteness B. Must have an Input code:
C. Must have an Output D. Must be Unambiguous int lone: e:rade = 22;
8. what is the output of the following code snippet: 18. Specify the declaration and initialization
int a= 2, b = 3; for character variable named state having
if(a = =b) printf("This is not"); initial value T.
A. This is not B. This is
C. a==b D. There is no output
9. The preprocessor directive used in defining a 19. The compiler executes comments in a
symbolic constant if program:
A. #include B. Math.h A. True B. False
C. stdio.h ,D. #define
10. After debugging a code, what next do you do to 20. Incorrect formula belongs to what type of
test your update: error: ... ... ·.. ... ... .. ..... .. .. .. .......
A. Run B. Compile and Run
C. Update D. print the code
' .
SECTION B (Attempt any 2 questions) (10 marks eacb),~'-,"-~
. "'
1. A software is to compute the monthly takehome of all categ~ry-- of employees
. . of.. an
establishment. The employee taxation is based on the follo~g con~tr~,'l't - , 1
• If basic salary is less than.or equal to N5000, 5% of basic salary IS de.. as~
otherwise 8% deducted. "-. · .
• Also 10% of the employee gross pay should be deducted as part of penstoJLSC,h~e.
• It is require that each employee pay slip should contain employee number, name,.t?tal
allowanc.e, tax, basic salary, gross pay and Net pay. ·, . .
Analyze this problem, present the input data, output information and pr~cessn~g reqwrement
and then draw a flowchart or a pseudocode representing the procedure for the
implementation of the software.

• Total allowances= Housing+ Transport


• Gross Pay = Basic salary+ Total allow~~es_ ,_
* Net pay= Gross pay - (Tax+ pension) ' -......

2. An NGO des,res to stir primary school pupils' interest in simple arithmetic. You are contacted
to develop , application that will act as a calculator to perfonn simple arithmetic operations,
namely, addftion, subtraction, multiplication, and division. Thus, develop this application
using functidn principles in C programming language. /

3. A Car Manufacturing finn produces three types of vehicles namely Salon cars, Jeeps and
Buses. It costs the firm 10,000 dollars to manufacture a Salon car, 23,000 dollars to
manufacture a Jeep and 27,000 dollars to manufacture a Bus. The selling price of each Salon
car is 12,000 dollars, the selling price of each Jeep is 27,250 dollars while the selling price of
each Bus is 29,199 dollars. The finn pays a tax of 10% on the sale of each Salon car, 12% on
the sale of each Jeep and 14% on the sale of each Bus. Determine the monthly profit in dollars
of the finn in a month in which it sold 25 Salon cars, 46 Jeeps and 37 Buses.
1. By problem decomposition, identify the input, processing and output
requirements
ii. Draw a flowchart to depict the solution to the problem
iii. Write a C program to solve the above problem

4. a) A restaurant manager consults you to develop a weight-driven menu application that will
help them servej their customers right type of food as compliment~ breakfast depending on
their weight. Thifollowing weight condition and suggested menu are given for breakfast:
I

I0-15kg
Egg, cereal, milk, bread, moinmoin, munchies, potatoes,
beverage,fish, beans
16-40kg Boiled yam, cereal, milk, boiled potatoes,
boiled egg,
vegetable, porridge, fish, meat, beans
41-60kg Egg, cereal, milk, bread, moinmoin, munchies, potatoes,
beverage, slightly creamed coleslaw
61-80kg
Uncreamed coleslaw, watermelon, cereal, vegetable WI'th dried
'fish, porridge, beans, moinmoin
81-90kg Beans,moinmoin, watermelon, cereal, vegetable
91kg ~d ~bov_e Vine seedless grape, fruit salad, beans, moirunoin,

- .
/ ,'

4.b) W!th
-<

~-
With f;heuse of ciompound-if, develop an application for this restaurant.
___,,

USf of for ... loop and a one-dimensional array, store your desired scores}-in all e
th
courses you are ~ng this first semester.

SECTION C: Ajlternative to Practical (Attempt all) (Total marks: JO)


. -~- - ""'-~, -~ - "'\. ~-

1. Locate error in the following program and correct it:

#include <stdi~.h>
int mainO ·
{
int sut, score;
score T 70.5;
sum =!O;
sum :::: sum +Score;
printf("The sum is %d", sum);
}

2. Specify the buggy lines of code and write out the correction
#include <stdoh>
intmainO
int x, y;
x=9;
floatz=x +y
printf("You've got it ", z);

3. Draw/map out the order of evaluation of the operators used in the following
(operator precedtnce):
a * (b + o) + die I

God will see you through!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy