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

Coe 162: Introduction To Computer Programming Question Paper

Coe 162: Introduction To Computer Programming 

Course:Bachelor Of Electrical And Electronics Engineering

Institution: Moi University question papers

Exam Year:2008



MOI UNIVERSITY SCHOOL OF ENGINEERING

COE 162: INTRODUCTION TO COMPUTER PROGRAMMING

QUESTION ONE AND TWO ARE COMPULSORY. ANSWER ANY OTHER THREE QUESTIONS FROM THE REMAINING.

QUESTION ONE (COMPULSORY)
Use the following C code to answer the following questions
1. void fahrenheitTOCelsius(int fahrenheit)
2. {
3. int celsius;
4. Celsius = (5/9)*(fahrenheit - 32)
5. Printf ("%d" in celsius is %d, farenheit, celsius);
6. }

a. What is the output of the function, explain why? (7mks)

b. Rewrite the code so that it performs better. (3mks)
c. Draw a flowchart for the code you have rewritten. (2mks)
d. Write pseudocode to support your flowchart. (2mks)

QUESTION TWO (COMPULSORY)
a. Describe how a computer works. (4mks)
b. What are the two view points for studying a programming language? (2mks)
c. Why can't a program written in high level programming language be executed direct from source code? (1mk)
d. What is a pointer? (1mk)
e. What is the difference between a while loop and a do while loop? (1mk)
f. With the help of a diagram describe the selection programming construct. (3mks)
g. Why must we declare variables before we use them in the C programming language? (1mk)
h. How do we achieve modularity, readability, ease of debugging and ease of documentation in a C program? (1mk)

QUESTION THREE
a. Define the distinct phases of the program development process. (12mks)
b. Define the following as used in programming. (2mks)
a. Statement
b. Expression

QUESTION FOUR
a. Draw flow chart that computes the average of 5 numbers. (3mks)
b. Write an algorithm in pseudocode that implements the flowchart. (3mks)
c. Write the pseudocode in the previous question in C code. (5mks)

d. Declare an array of integers and initialize it to hold 10 different integers using C code. (1mk)
e. Initialize the same array using a for loop using C code. (2mks)

QUESTION FIVE
a. List the different categories of if structures and give an example for each in pseudocode. (3mks)
b. With the help of a diagram describe the sequential programming construct. (3mks)
c. What is the difference between unit testing and system testing? (1mk)
d. List the program design tools. (4mks)

QUESTION SEVEN
a. What is the main difference between syntax errors and logical errors? (1mk)
b. What is the difference between the call by value and the call by reference argument passing conventions in the C programming language? (2mks)
c. Describe the basic data types in the C programming language? (8mks)
d. Define what the following mean in programming. (3mks)
a. Variable
b. Assignment statement
c. Comments






More Question Papers


Popular Exams


Mid Term Exams

End Term 1 Exams

End Term 3 Exams

Opener Exams

Full Set Exams



Return to Question Papers