Mas 104:Programming Methodology Question Paper
Mas 104:Programming Methodology
Course:Bachelor Of Science In Applied Statistics
Institution: Maseno University question papers
Exam Year:2012
MASENO UNIVERSITY
UNIVERSITY EXAMINATIONS 2012/2013
BACHELOR OF SCIENCE IN APPLIED STATISTICS WITH IT
MAS 104:PROGRAMMING METHODOLGY
Time 2hrs
Answer all questions in SECTION A and any two in SECTION B.
SECTION A
QUESTION 1
a)What is the difference between executable and non executable statements?
b)List three files created during the execution of a C program.
c)Write a function segment called AREA that calculates the area of acircle and returns the computed result to the main function.
d)Using the for loop,write a function called sum-series for computing summation of ,1<i^2<100.
e)Write a program to nfind whether an integer number is even or odd.
f)Explain two conditions that would prompt a programmer to use the void keyword in a program with functions.
g)Identify syntax errors in the program:
#include<stdio.h>
include <math.h>
main()
{
FLOAT x;
/*ASSIGNMENT SECTION
x=2.8;
y=exp(x);
/*printing section*/
printf("The values of y is %f ,y)
}
h)Rewrite the following code segment using a while statement
int a=1, b=10;
for(a=1; a<b;a++)
{
printf("%d\n", a/b);
}
int a=1, b=10;
SECTION B
QUESTION 2
a)What is one''s complement of the binary number 11010100?
b)Add the two binary numbers:
i)10101010 and 00011011
ii)10101010 and 11011000
c)What is the effect of the following line of code and where you would expect it to appear in a program?
#define PI 3.14158
d)If you need
More Question Papers