Access over 35 million academic & study documents

Ccs 2010 computer programming eee

Content type
User Generated
Showing Page:
1/2
DEDAN KIMATHI UNIVERSITY OF TECHNOLOGY
University Examinations 2019/2020
SECOND YEAR FIRST SEMESTER SPECIAL/SUPPLEMENTARY EXAMINATION FOR THE
DEGREE OF BACHELOR OF SCIENCE IN ELECTRICAL AND ELECTRONICS
ENGINEERING
CCS 2010: COMPUTER PROGRAMMING
Question One-Compulsory-30 Marks
a) Explain the following terms as used in C programming (5 Marks)
i. Keyword
ii. Function
iii. Data type
iv. Case sensitive
v. Array
b) Differentiate an algorithm from a program. Give an example (6 Marks)
c) State three rules of variable name in C programming (3 Marks)
d) List any four characteristics of an algorithm (6 Marks)
e) The program below was designed to receive three integer numbers, determine the least and the largest then
displays the two values with appropriate messages but has errors. Evaluate the code then:
i. Identify four syntax errors (4 Marks)
ii. Identify two logical errors (2 Marks)
iii. Show how the errors in above can be fixed (4 Marks)
#include<stdio.h>
int main()
{
int a,b,c,max;
printf("Input three Integers,Press Enter after each:\n");
scanf("%d%d",&a,&b,&c)
if(a>b && a>c);
max=a;
else if (b>a && b<c)
max=b;
else
max=c;
if(a<b || a<c)
min=a;
else if (b<a && b<c)
min=b;
else
min=c;
printf("Max=%d\t Min=%d\n",max,min);
return 0;
}
Question Two-20 Marks
a) Using an example, explain type casting (3 Marks)
b) Given that n = 6.0 and SCALE = 2.0, explain operator precedence and solve the value of butter if butter =
25.0 + n*60.0 / SCALE (3 Marks)

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/2

Sign up to view the full document!

lock_open Sign Up
Unformatted Attachment Preview
DEDAN KIMATHI UNIVERSITY OF TECHNOLOGY University Examinations 2019/2020 SECOND YEAR FIRST SEMESTER SPECIAL/SUPPLEMENTARY EXAMINATION FOR THE DEGREE OF BACHELOR OF SCIENCE IN ELECTRICAL AND ELECTRONICS ENGINEERING CCS 2010: COMPUTER PROGRAMMING Question One-Compulsory-30 Marks a) Explain the following terms as used in C programming (5 Marks) i. Keyword ii. Function iii. Data type iv. Case sensitive v. Array b) Differentiate an algorithm from a program. Give an example (6 Marks) c) State three rules of variable name in C programming (3 Marks) d) List any four characteristics of an algorithm (6 ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
Studypool
4.7
Indeed
4.5
Sitejabber
4.4