Introduction To Programming Question Paper
Introduction To Programming
Course:Bachelor Of Education (Science With It) ()
Institution: Kabarak University question papers
Exam Year:2010
Page 1 of 3
KABARAK UNIVERSITY
UNIVERSITY EXAMINATIONS
2010/2011 ACADEMIC YEAR
FOR THE DEGREE OF BACHELOR OF EDUCATION
SCIENCE
COURSE CODE: COMP 111
COURSE TITLE: INTRODUCTION TO
PROGRAMMING
STREAM: SESSION II
DAY: TUESDAY
TIME: 9.00 – 11.00 A.M
DATE: 30/11/2010
INSTRUCTIONS:
Attempt Question ONE and Any other TWO
PLEASE TURNOVER
Page 2 of 3
QUESTION ONE (30 MARKS)
(a) Explain any four data types used in C language (4 marks)
(b) Write the syntax of if-else statement (4 marks)
(c) Write a program to find sum, average of any three numbers which are entered by
the user through the key board. (5 marks)
(d) Explain the following terms functions with their syntax
i. (i) strcpy() (2 marks)
ii. (ii) strcat() (2 marks)
(e) Explain the use of continue and break statements with their format (3 marks)
(f) Write an assembly language program to add two numbers x and y and store the
result in z. (4 marks)
(g) Explain steps used to execute a C program (4 marks)
(h) Write a C program to print student name, roll no, marks (2 marks)
QUESTION TWO (20 MARKS)
(a) What is an array? State three rules used to declare the array (4 marks)
(b) Write a program using the nested-if statement and explain its syntax.
(3 marks)
(c) Explain the importance of using control statements in programming (3 marks)
(d) What is an identifier? List the rules used when writing identifiers. (3 marks)
(e) What is a keyword in C Programming? State Six examples (4 marks)
(f) Describe the basic structure of a C program (3 marks)
Page 3 of 3
QUESTION THREE (20 MARKS)
Using suitable examples explain any three looping statements (4 marks)
(a) Identify the errors in the program below, correct them and explain the output
thereof. (4 marks)
main()
{
int i;
1. printf(“enter a number”)
2. scanf ” “,&i);
3. if(i<=50)
4. printf(“\n entered number is <50)
(b) Write the syntax of switch case statement and explain it (4 marks)
(c) Differentiate between call by value and call by reference functions. (4 marks)
(d) Discuss the unary operator with a sample program. (4 Marks)
QUESTION FOUR (20 MARKS)
(a) Write a program in C language to check wether the character entered is a vowel or
not (4 marks)
(b) What is the difference between while and Do-While statements? (3 marks)
(c) Explain the factors that led to the development of 3rd generation programming
languages. (4 marks)
(d) Describe the classification of binary operators in C. (3 marks)
(e) Write and explain the output of the following c program. (2 marks)
#include<stdio.h>
main()
{
i. int a=6, b=10;
ii. printf(“a=%d\n,a++);
iii. printf(“b=%d\n,++b);
}
(f) Differentiate between a compiler and an interpreter. (4 marks)
More Question Papers