Time Left - 15:00 mins

GATE 2024 Programming & Data Structures Rank Booster Quiz 26

Attempt now to get your rank among 39 students!

Question 1

Consider the following foo function:

int foo (unsigned int n)

{

int c, x = 0;

while (n! = 0)

{

if (n & 01) x ++;

n >> = 1;

}

return x;

}

The value returned by the foo (10) is _________.

Question 2Multiple Correct Options

Which of the following is true?

Question 3

Which of the following algorithms cannot be designed without recursion?

Question 4

Consider the following code:

int f (int a)

{

return (a * 2);

}

int g (int a)

{

return (a * 3);

}

int h (int a, int b)

{

return (a + b);

}
void main( )

{

int x =2, y = 3;

x =h (f (2), g (3));

printf ("%d", x + y);

}

What will be the output of above code?

Question 5

Consider the following code

int find (int a)

{

if (a = = 0) return 1;

else return (find (a - 1) +1):

}

What will be the return value of find (5)?

Question 6

The output of the above program is ______.

________________

Question 7

Consider the following program:

int main ( )

{

int * a;

a= function1 ( ) ;

printf(“%d”, *a);

}

int * function1 ( )

{

int m= 1;

int * x;

x = &m;

return x;

}

Which of the following statement is true?

I. It results 9

II. Runtime error

III. Compilation error

Assume all the header files and function definition correctly done.

  • 39 attempts
  • 0 upvotes
  • 0 comments
Dec 11GATE & PSU CS