Question 1 |
Consider the following ANSI C program
#include < stdio.h >
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 ____10 | |
60 | |
180 | |
220 |
Question 1 Explanation:
Question 2 |
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 __________17 | |
15 | |
255 | |
5 |
Question 2 Explanation:
Question 3 |
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\leq i \leq 9. The value returned by SimpleFunction(Z,10,2) is __________1023 | |
511 | |
255 | |
2047 |
Question 3 Explanation:
Question 4 |
In the following procedure
Integer procedure P(X,Y);
Integer X,Y;
value x;
begin
K=5;
L=8;
P=x+y;
end
X is called by value and Y is called by name. If the procedure were invoked by the following program fragment K=0;
L=0;
Z=P(K,L);
then the value of Z will be set equal to5 | |
8 | |
13 | |
0 |
Question 4 Explanation:
Question 5 |
What is the output in a 32 bit machine with 32 bit compiler?
#include < stdio.h >
rer(int **ptr2, int **ptr1)
{
int *ii;
ii=*ptr2;
*ptr2=*ptr1;
*ptr1=ii;
**ptr1*=**ptr2;
**ptr2+=**ptr1;
}
void main(){
int var1=5, var2=10;
int *ptr1=&var1,*ptr2=&var2;
rer(&ptr1,&ptr2);
printf("%d %d",var2,var1);
}
60,70 | |
50,50 | |
50,60 | |
60,50 |
Question 5 Explanation:
Question 6 |
Consider the following recursive C function that takes two arguments
unsigned int rer(unsigned int n, unsigned int r){
if(n>0)return(n%r + rer(n/r,r));
else retturn 0;
}
What is the return value of the function rer when it is called as rer(513,2)?9 | |
8 | |
5 | |
2 |
Question 6 Explanation:
Question 7 |
Consider the following C functions.

The value returned by pp(3,4) is _____

The value returned by pp(3,4) is _____
9 | |
81 | |
16 | |
125 |
Question 7 Explanation:
Question 8 |
Consider the following C functions.

The return value of fun2(5) is ______

The return value of fun2(5) is ______
55 | |
25 | |
35 | |
10 |
Question 8 Explanation:
Question 9 |
Consider the following C program:
#include < stdio.h >
int r(){
int static num=7;
return num--;
}
int main() {
for(r();r();r()) {
printf("%d ",r());
};
return 0;
}
Which one of the following values will be displayed on execution of the programs?41 | |
52 | |
63 | |
630 |
Question 9 Explanation:
Question 10 |
Consider the following C program:
void convert(int n) {
if (n<0)
printf("%d",n);
else {
convert(n/2);
printf("%d",n%2);
}
}
Which one of the following will happen when the function convert is called with any positive integer n as argument?It will print the binary representation of n and terminate. | |
It will print the binary representation of n in the reverse order and terminate. | |
It will print the binary representation of n but will not terminate. | |
It will not print anything and will not terminate. |
Question 10 Explanation:
There are 10 questions to complete.
Question 65 wrong
Thank You Abhishek Chavle,
We have updated the question.
Question number 86 of functions in c programming it should be c<b instead of c=b . Please do change.
Thank You PRAFUL SAMBHAJI RANE,
We have updated the question.
Question number 12 of functions of c programming there is typing mistake in question itself . Instead f () you have written if. Please do change it 🙏
Thank You PRAFUL SAMBHAJI RANE,
We have updated the question.
Question number 86 of functions in c programming
Correct question
int Trial (int a, int b, int c)
{
if ((a >= b) && (c =b) return Trial(a, c, b);
else return Trial(b, a, c);
}
Thank You PRAFUL SAMBHAJI RANE,
We have updated the question.
question 58.
2 options are same
Thank You Bikash Dutta,
We have updated the options.
In Ques no-62 there is one small misprint , there will be z=**ppz
in Q 60.
z= **ppz
Pls separate out ISRO and GATE questions!
Page 11 is redirecting to a wrong location. Unable to solve questions from page 11.
Dear Dhruv,
We have tested page 11 and working perfect for our testing device.