Question 41
Consider the following pseudocode:
x:=1; i:=1; while (x ? 500) begin x:=2x ; i:=i+1; end
What is the value of i at the end of the pseudocode?
Question 42
In _______, the bodies of the two loops are merged together to form a single loop provided that they do not make any references to each other.
Question 43
How many lines of output does the following C code produce?
#include<stdio.h>
float i=2.0;
float j=1.0;
float sum = 0.0;
main()
{
while (i/j > 0.001)
{
j+=j;
sum=sum+(i/j);
printf(\"%f\\n\", sum);
}
}
Question 44
#include <stdio.h>
int main()
{
unsigned int i = 65000;
while (i++ != 0);
printf(\"%d\", i);
return 0;
}
Question 45
Consider the C program below.
#include <stdio.h>
int *A, stkTop;
int stkFunc (int opcode, int val)
{
static int size=0, stkTop=0;
switch (opcode)
{
case -1:
size = val;
break;
case 0:
if (stkTop < size ) A[stkTop++]=val;
break;
default:
if (stkTop) return A[--stkTop];
}
return -1;
}
int main()
{
int B[20];
A=B;
stkTop = -1;
stkFunc (-1, 10);
stkFunc (0, 5);
stkFunc (0, 10);
printf (\"%d\\n\", stkFunc(1, 0)+ stkFunc(1, 0));
}
The value printed by the above program is ___________
There are 45 questions to complete.