Time Left - 15:00 mins
GATE 2024 Programming and Data Structures Quiz 2
Attempt now to get your rank among 156 students!
Question 1
What will be the output of following?
main()
{
Static int a = 3;
printf(“%d” ,a- -);
if (a)
main();
}
Question 2
What is the output of the program.?
void myshow();
int main()
{
myshow();
myshow();
myshow();
}
void myshow()
{
static int k = 20;
printf("%d ", k);
k++;
}
Question 3
What does the following function return when called as test(6,3)?
test(a,b)
{
static int c =0;
if(b>0)
{
c = c + a;
test(a, b-1) ;
}
return c;
}
test(a,b)
{
static int c =0;
if(b>0)
{
c = c + a;
test(a, b-1) ;
}
return c;
}
Question 4
Consider the function shoo below:
int shoo(int k)
{
int x=0;
while(k)
{
x++;
k>>=1;
}
return(x);
}
The value returned by shoo(132)is?
int shoo(int k)
{
int x=0;
while(k)
{
x++;
k>>=1;
}
return(x);
}
The value returned by shoo(132)is?
Question 5
Consider the following C function:
What will the function return when x=4 and y = 2?
What will the function return when x=4 and y = 2?
Question 6
If a base condition isn’t specified in a recursive program, what will it lead to?
- 156 attempts
- 0 upvotes
- 2 comments
Nov 7GATE & PSU CS