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

Comp 111: Introduction To Computer Programming August 2009 Question Paper

Comp 111: Introduction To Computer Programming August 2009 

Course:Bachelor Of Education Science

Institution: Kabarak University question papers

Exam Year:2009



INSTRUCTIONS:
Attempt Question ONE and Any other TWO
QUESTION ONE (30 MARKS):
a) i) Define an operating system. [2 Marks]
ii) Differentiate between a general purpose and a specific purpose
programming language with two examples each.. [4 Marks]
b) Describe the drawbacks of Machine Language. [4 Marks]
c) Differentiate between the following:
i. Loader and Linker. [2 Marks]
ii. Assembler and Compiler. [2 Marks]
d) Write and explain the output of the following C program. [4 Marks]
#include<stdio.h>
main()
{
int a=6, b=10;
printf(“a=%d\n,a++);
printf(“b=%d\n,++b);
}
e) List any ten (10) reserved words in C. [5 Marks]
f) Describe the variable naming conventions in C language. [4 Marks]
g) Write an Assembly language Program to add two numbers x and y and store the result at
z. [3 Marks]
QUESTION TWO (20 MARKS):
a) State and explain the steps followed when executing a C program. [4 Marks]
b) Write a program in C that accepts two numbers and checks whether they are equal or not.
[4 Marks]
c) Describe the nested-if statement. [4 Marks]
d) Differentiate between the while and do-while statements. [4 Marks]
e) List and explain the types of errors in programming. [4 Marks]
QUESTION THREE (20 MARKS):
a) Define the following terms:
i. Programming. [1 Marks]
ii. Flowchart. [1 Marks]
iii. Variable [1 Marks]
iv. Debugging. [1 Marks]
v. Error [1 Marks]
b) Write a program in C for printing prime numbers between 1 and 100. [5 Marks]
c) Describe the basic structure of a C program. [5 Marks]
d) Differentiate between constants and variables in programming. [2 Marks]
e) Explain how values are assigned to variables. [3 Marks]
QUESTION FOUR (20 MARKS):
a) Write down the errors in the following code. [4 Marks]
#include stdio.h
main
int number;
printf (“enter an integer number”)
scanf(“%”,&number
if(number<100
printf “your number is smaller than 100”
else
printf(“your number contains more than two digits”)
}
b) Describe the binary operators. [6 Marks]
c) Write a C program to compute the compound interest of money deposited in a bank that
is compounded quarterly. . [6 Marks]
c) State the ways you can use the following symbols in C programming.
i) % ii) # iii) { iv)} v) “ “ vi) && vii) ! viii) || [4 Marks]
QUESTION FIVE (20 MARKS):
a) Write a C equivalent of the following mathematical expression.
(2x2
+2x-2)(3y3
+z) [2 Marks]
b) What is a data type? Explain four basic data types in C. [7 Marks]
c) List and explain formatted and unformatted input statements in C. [4 Marks]
d) Write a program that prints the sum of the first n natural numbers. [5 Marks]
e) Write and explain the output of the following program. [2 Marks]
main()
{
int m=4, n=8;
printf(“m=%d\n”,m++);
printf(“n=%d\n”,--n);
}






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