![]() |
VOOZH | about |
Question 1
Consider the following ANSI C function:
int SimpleFunction(int Y[], int n, int x)
{
int total = Y[0], loopIndex;
for (loopIndex=1; loopIndex<=n-1; loopIndex++)
total=x*total +Y[loopIndex];
return total;
}
Let Z be an array of 10 elements with Z[i]=1, for all i such that 0 <= i <= 9. The value returned by SimpleFunction(Z,10,2) is __________ .
1023
1024
2047
511
Question 2
Consider the following C code. Assume that unsigned long int type length is 64 bits.
The value returned when we call fun with the input [Tex]2^{40}[/Tex] is
4
5
6
40
Question 3
Consider the following C program:
The output of the program above is
Hi Bye Bye Hi
Hi Bye Hi Bye
Bye Hi Hi Bye
Bye Hi Bye Hi
Question 4
Consider the following C program
The output is
19
18
20
3
Question 5
Consider the following C functions.
The value returned by pp(3,4) is ________ .
Note -
This question was Numerical Type.
81
64
100
49
Question 6
Consider the following C program.
Which one of the following options is correct?
The program will not compile successfully
The program will compile successfully and output 10 when executed
The program will compile successfully and output 8 when executed
The program will compile successfully and output 13 when executed
Question 7
Consider the following ANSI C program.
#include < stdio.h >
int main( )
{
int arr[4][5];
int i, j;
for (i=0; i<4; i++)
{
for (j=0; j<5; j++)
{
arr[i][j] = 10 * i + j;
}
}
printf("%d", *(arr[1]+9));
return 0;
}
What is the output of the above program?
14
20
24
30
Question 8
Consider the following ANSI C function:
int SomeFunction (int x, int y)
{
if ((x==1) || (y==1)) return 1;
if (x==y) return x;
if (x > y) return SomeFunction(x-y, y);
if (y > x) return SomeFunction (x, y-x);
}
The value returned by SomeFunction (15, 255) is __________ .
15
1275
30
255
Question 9
Consider the following ANSI C program
#include
int foo(int x, int y, int q)
{
if ((x<=0) && (y<=0))
return q;
if (x<=0)
return foo(x, y-q, q);
if (y<=0)
return foo(x-q, y, q);
return foo(x, y-q, q) + foo(x-q, y, q);
}
int main( )
{
int r = foo(15, 15, 10);
printf(ā%dā, r);
return 0;
}
The output of the program upon execution is _________ .
60
10
15
50
Question 10
Consider the following C program.
The output of this program is:
0, c
0, a+2
'0', 'a+2'
'0', 'c'
There are 91 questions to complete.