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

ICS 2102 Introduction to Computer Programming (1)

The document is an examination paper for the Bachelor of Science in Electronic and Computer Engineering at Jomo Kenyatta University, covering topics in computer programming. It includes questions on algorithms, variables, control statements, arrays, and pointers, requiring students to demonstrate their understanding of programming concepts and C language syntax. Students are instructed to answer question one and any two additional questions within a two-hour timeframe.

Uploaded by

kiribalaura
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

ICS 2102 Introduction to Computer Programming (1)

The document is an examination paper for the Bachelor of Science in Electronic and Computer Engineering at Jomo Kenyatta University, covering topics in computer programming. It includes questions on algorithms, variables, control statements, arrays, and pointers, requiring students to demonstrate their understanding of programming concepts and C language syntax. Students are instructed to answer question one and any two additional questions within a two-hour timeframe.

Uploaded by

kiribalaura
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

W1-2-60-1-6

JOMO KENYATTA UNIVERSITY OF AGRICULTURE AND


TECHNOLOGY
UNIVERSITY EXAMINATIONS 2017/2018
EXAMINATIONS FOR THE DEGREE OF BACHELOR OF SCIENCE IN
ELECTRONIC AND COMPUTER ENGINEERING
ICS 2102: INTRODUCTION TO COMPUTER PROGRAMMING
DATE: JANUARY 2018 TIME: 2 HOURS
INSTRUCTIONS: ANSWER QUESTION ONE AND ANY OTHER TWO QUESTIONS

QUESTION ONE

a) The “/n” character does what operations (1 mark)

b) Explain the following (5 marks)

1) Algorithm
2) Pseudo code
3) Arithmetic operations
4) Syntax errors
5) Semantic errors

c) Discuss four properties of a good algorithm (4 marks)

d) What is a variable? Which symbol separates variable names? (3 marks)

1) &
2) ;(period)
3) ‘ (apostrophe)
4) ,(comad)
5) ;(semicolon)

e) What is a keyword? State two keywords of C program (3 marks)

f) Write the syntax if the if-else statement (2 marks)

g) State and explain three logical operators (6 marks)

h) What is the purpose of break statement (2 marks)

i) What will be the output of the following program (4 marks)


Void main (){
int a=10;
Print f ( “”%d”, aJ;
{
int a=20;
Print f( “%d”, a J;
}
Print f %d”, aJ;
}

QUESTION TWO

a) Explain the if-else statement execution with its flowchart (5 marks)

b) For the following program fragment, derive the output generated by


print f statement (3 marks)

int val 2 =255;


float num=79.54123;
print f “%4d, %x, %7.3, %8.3e”, val 2, val2,
num, num;

c) Explain the concept of array of pointers with example (6 marks)

d) Explain the representation of two-dimensional array with example


(6 marks)

QUESTION THREE

a) Design an algorithm to add two numbers and display the results.

b) Describe the process of dedaring a function in C program.

c) Find out errors in the following program component and justify the
same (5 marks)

float i ;
int P=0;
for (i=0; i=10; i+=2)
{
P=i*2;
Printf ( “%d”, I, P);

d) Explain with example the array of structures (6 marks)

QUESTION FOUR

a) Write a program to find whether the given year is a leap or not (6


marks)
b) Explain a function of two parameters num 1 and num 2 and return the
maximum value (4 marks)

c) Explain the concept pointer’s arithmetic operations (4 marks)

d) Explain the meaning of the following statements with reference to


pointers (6 marks)

1) int*ptr, m=8;
2) *ptr =m;
3) ptr=$m;

You might also like