Get premium membership and access revision papers, questions with answers as well as video lessons.

Bcom 270: Computer Programming  Question Paper

Bcom 270: Computer Programming  

Course:Bachelor Of Commerce

Institution: Chuka University question papers

Exam Year:2013





CHUKA

UNIVERSITY

UNIVERSITY EXAMINATIONS
SECOND YEAR EXAMINATIONS FOR THE AWARD OF
DEGREE IN BACHELOR OF COMMERCE
BCOM 270: COMPUTER PROGRAMMING
STREAMS: BCOM Y2S1 TIME: 2 HOURS
DAY/DATE: TUESDAY 23/4/2013 2.30 PM – 4.30 PM
INSTRUCTIONS:

• Answer QUESTION 1 and any other TWO QUESTIONS from section b
• This is a CLOSED BOOK EXAM, No reference materials allowed in examination room. Make sure such materials are not found anywhere near your sitting.
• No use of mobile phones, no electronic calculators, no memory watches.
• Write your answers legibly and use your time wisely.

SECTION A: COMPULSORY

QUESTION I (30 MARKS)

(a) Write a Pascal program that clears the screen and displays the following text:
“Hello world, welcome to Pascal programming!” [4 Marks]

(b) Describe the use of the following keywords as used in Pascal programming
[10 Marks]
(i) Begin
(ii) End
(iii) WriteIn
(iv) ReadIn
(v) Uses.


(c) With use of appropriate examples, define and show how a variable, a constant and an
integer are declared and initialized in Pascal. [6 Marks]

(d) With use of an appropriate control construct, show how you would print a table of squares and cubes shown below. [5 Marks]

Number Square Cube
1 1 1
2 4 8
3 9 27
4 16 64
5 25 125
6 36 216
7 49 343
8 64 512
9 81 729

(e) Use an example to illustrate the difference between syntax and logic errors as they often occurs in programming. [5 Marks]

SECTION B: ATTEMPT ANY TWO QUESTIONS FROM THIS SESSION

QUESTION TWO (20 MARKS)

Write a program that prompts the user to enter the price of 3 items that are VAT able, and a fourth item which is not VAT able. The program then calculates and outputs:

1) The total
2) The VAT at 18% chargeable on the total and
3) The final amount inclusive of VAT.

Example:

Please input price of item 1:20
Please input price of item 2:15.30
Please input price of item 3:10
Please input price of item 4:20.20
-----------------------------------------------
Total: 65:50
VAT: 11.79
Final amount: 77.29

You should declare the VAT rate as a constant (const vat-rate: real = 0.18);



QUESTION THREE (20 MARKS)

(a) What differentiates a function from a procedure? Illustrate. [4 Marks]

(b) Explain how a function or a procedure simplifies the task of programming. [6 Marks]

(c) Write a program that uses a function to calculate the area of a circle. [10 Marks]

QUESTION FOUR (20 MARKS)

(a) What are arrays? [2 Marks]

(b) Show how to declare and initialize two arrays with size (5) and (1) [4 Marks]

(c) Write a sample program in Pascal that demonstrate the use of Arrays. [10 Marks]

(d) Show how multi-dimensional arrays are declared and initialized. [4 Marks]

QUESTION FIVE (20 MARKS)

(a) Data types are core to programming languages. What do you understand by the term “Data type”? Giving examples explain any four of the main data types supported in Pascal. [10 Marks]

(b) Write a complete Pascal program that converts temperature from degrees Celsius to Fahrenheit. To perform the Celsius-Farenheight conversion use the formula: [10 Marks]

Celsius :=(Farenheight -32) x (5.0/9.0).
The output should be presented on the screen in the following format:

“15 degrees Celsius is equal to 93.2 degrees Farenheight”
---------------------------------------------------------------------------------------------------------------------









More Question Papers


Popular Exams



Return to Question Papers