Академический Документы
Профессиональный Документы
Культура Документы
AIMST UNIVERSITY
Instructions to Candidates
1. Please ensure that this question paper consists of EIGHT (8) printed pages, excluding
the cover page, before you start the examination.
2. You will have 10 minutes to read the paper. Do not start writing until you are told to
do so.
3. This paper consists of two (2) sections A, B and C :
Section A (Multiple Choice Questions) (15 marks)
Answer ALL questions and answer in the answer book.
Section B (Short Answer Questions) (30 marks)
Answer ALL questions and answer in the answer book.
Section C (Long Programming Questions) (15 marks)
Choose any ONE (1) question and answer in the answer book.
4. Work that you consider incorrect should be crossed out with a single line but should
not be erased or rendered unreadable.
5. Use only black or blue pen for all work other than graphs and diagrams, which may be
done in pencil.
6. Do not remove any question/answer booklet from the Examination Hall.
7. You are allowed to use a silent, non-programmable calculator for your work. All
workings must be shown.
8. Tie the question paper on top of the answer booklet.
BMIS 32132
Semantics is ____________.
A. the meaning of the language within a given context
B. the rules to join words together in forming a correct expression or phrase
C. function to tell computer what to do
D. instructions for computer to do task
2. 1 - Specification of needs
2 - Problem analysis
3-X
4- Implementation
5-Y
6- Documentation
The above lists are the steps in Software Development Methods (SDM). What are X and
Y?
A.
B.
C.
D.
BMIS 32132
4.
start
w
end
What is the meaning for the flowchart symbol labeled as w above?
A.
B.
C.
D.
Process
Calculation
Selection
Terminal
/*
/*
/*
/*
*/ and//
/* and \\
/* and //
*/ and \\
7. Choose the valid variable definition for age of kid that is 7 years old.
A. age = 7;
B. int kid age = 7;
C. int HowOld = 7;
D. int 7age=7;
8. What will be the output of the following C code fragment?
. . .
a = 52;
printf("a is %d", a);
printf("a is %d\n", a-- - 3);
. . . a is 52 a is 48
A.
B.
a is 52 a is 49
switch(num){
C.
a is 52 a is 52
case 0 :
D.
case 2 error
:
case 4 :
9. What
will6 be
case
: the output of the following C code fragment if user entered 1?
case 8 : printf(even\n);
break;
case 1 :
[This paper consists of 5 pages excluding the cover page]
case 3 :
case 5 :
case 7 :printf(odd\n);
BMIS 32132
A.
B.
C.
D.
Error
odd
even
Nothing is printed
sentinel-controlled loop
counter-controlled loop
infinite loop
for loop
12. How many times the iteration happen for the following code?
#include<stdio.h>
int main()
{
int i=5,j=2,count=0;
j=i%j;
do
{
i++;
count++;
}while(i<j);
printf("Total loop is %d\n",count);
return 0;
}
BMIS 32132
A.
B.
C.
D.
1
2
5
Infinite loop
13. __________ will tell the compiler that there exist a function with this name defined
somewhere in the program.
A. Function definition
B. Function prototype
C. Function call
D. Function prototest
BMIS 32132
14. _____________ is variable that is declared in the formal list of the function header.
A. Global parameter
B. Local parameter
C. Formal parameter
D. Actual parameter
15. After leaving the function, these variables are destroyed. When the function is called
again, they will be created (reassigned). What is the type of this variable category?
A. Actual variable
B. Formal variable
C. Global variable
D. Local variable
E.
BMIS 32132
ii.
iii.
Compute the value of new_weight as the difference of the value of weight and the
value of weight_loss.
[1 Mark]
iv.
v.
[1 Mark]
QUESTION 2
Rewrite the following code segment as an equivalent segment that uses a for statement.
[5 Marks]
product = 1;
next = 1;
while (next <= m) {
product = product * next;
next = next + 1;
}
BMIS 32132
QUESTION 3
Based on variable declarations and program fragment below, trace and write the output.
[5 Marks]
QUESTION 4
Write the following statements in C:
i.
ii.
QUESTION 5
#include<stdio.h>
intmain()
{
intmarks;
printf("Entermarks:");
scanf("%d",&marks);//getmarks
if(marks>50)//ifmarks>50displaymessage
printf("Youhavepassedtheexam!");
return0;
}
Modify program above, so that it displays two messages You have failed the exam! and
Please study to improve your grade, if marks are less than or equal to 50.
[5 Marks]
QUESTION 6
Writeafunctiondefinitionforthefollowing:
i.
Afunctionthatdividestwonumbersandreturnstheremainder.
ii.
[3Marks]
AfunctionthatprintsanATMmenutodisplayselectionsuchaswithdrawal,transfer
andbalancechecking.
[2Marks]
[TOTAL MARKS 20]
[This paper consists of 5 pages excluding the cover page]
BMIS 32132
If users, let say select F to C, the function to convert Fahrenheit to Celsius will be called. See
sample program to do your program.
Welcome to Fahrenheit Conversion Calculator.
Please enter the temperature in Fahrenheit:
200
Please select the conversion type:
1 to convert Fahrenheit to Celsius
2 to convert Fahrenheit to Kelvin
2
60 Fahrenheit is equal to 288.71 Kelvin
[15 Marks]
QUESTION 2
Write a program that takes three float values of student marks and total up them. The function
total will add up all three marks and one function grade is call to print out the message
Youre passed!, if the total marks greater or equal to 50, otherwise the message Youre
failed! is printed. See the sample output given below.
Please enter three marks for quiz, test and assignment:
20 20 60
Your total marks is 100.00
Youre passed!
[15 Marks]
ooo0ooo
[This paper consists of 5 pages excluding the cover page]
BMIS 32132