#include<stdio.h>

int rec_fun(int i)

{

if ( i%2 ) return (i++);

else return rec_fun( i - 1 );

}

int main()

{

printf("%d\n", rec_fun(20));

return 0;

}

What will be the output of the above C program?

20
19
Segmentation fault

21
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider the following declaration of a ‘two-dimensional array in C:

Assume array use row major order to store.

char arr[100][100];

The array is stored starting from memory address 0, the address of arr[40][50] is

4040
4050
5040
5050
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
What is the output of the following program?

#include<stdio.h>

unsigned int rec(unsigned int n, unsigned int r)

{

int x;

if (n>0)

{ x= (n%r * rec(n/r ,r));

return(x);}

else

return 1;

}

void main()

{

printf("%d\n",rec(989,11));

}

80
0
180
1
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
What will be the output of the following program?

#include<stdio.h>

void main()

{

char str[]= "abcde";

printf("%c ", 3[str]);

}

Compiler error
d
c
None
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
#include <stdio.h>

int main()

{

int i = 1024;

for (; i; i >>= 1)

printf("GatesQuiz\n");

return 0;

}

How many times will GatesQuiz be printed in the above program?

10
11
Infinite
The program will show compile-time error
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider the following program:

#include "stdio.h"

int main()

{

int array[5];

printf("%p %p \n", array, &array);

printf("%p %p", array+1, &array+1);

return 0;

}


The output of the above code is:

A B

C D

Where, A, B, C and D are some memory address values.

Which of the options is correct about A, B, C and D?

A== B, C == D
A != B, C != D
A== B, C != D
A != B, C == D
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
x=i++;

Choose the correct option among following for the piece of code mentioned above:

first x is assigned to i and then value of x is incremented.
value of i is incremented first and then i is assigned to x.
value of i is assigned to x and then value of x is incremented.
first value of i is assigned to x and then the value of i is incremented.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
#include<stdio.h>

void switch_check(int x)

{

switch(x)

{

case 0: printf("@");

case 1: printf("H");

case 2: printf("I");

case 3: printf("M");

case 4: printf("A");

case 5: printf("L");

case 6: printf("A");

case 7: printf("Y");

case 8: printf("A");

default: printf("!");

}

}

void main()

{

switch_check(1 && 0 - 2.9);


}

What will be the output of above program?

HIMALAYA!
@HIMALAYA!
MALAYA!
!
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
#include<stdio.h>

void fun()

{

static int i=5;

printf("%d ",i);

if(i--)

{

fun();

}

}

void main()

{

fun();

}

What will be the output of the above code?

5 4 3 2 1 0
5 4 3 2 1
4 3 2 1 0
4 3 2 1
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
#include<stdio.h>

int foo(int n)

{return (n & n |1);}

void main()

{

printf("%d", foo(110));

}

What will be the output of above program?___

111
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
What will be the output of following program:void ptrFun(void);

main()

{

static int a=1;

ptrFun();

a+=1;

ptrFun();

printf(" %d \n",a);

}

void ptrFun()

{

static int a=2;

int b=1;

a+=++b;

}

2
4
8
6
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
#include <stdio.h>

int main()

{

int q = 63, r = 29, s = 30;

{

int q = 68;

float r = 25;

{

int s = 10;

printf(" %d, %f, %d \n", q, r, s);

}

}

return 0;

}

What is the output of the above code?

63, 25.000000, 30
68, 25.000000, 10
68, 29.000000, 10
63, 29.000000, 30
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
What will be the output of the following program?

#include<stdio.h>

void main()

{

int arr[][] = {{4,5,6},{6,7,8}};

int i, j;

for (i = 0; i < 2; i++)

for (j = 0; j < 3; j++)

printf("%d ", arr[i][j]);

return 0;

}

4 5 6 6 7 8
4 6 5 7 6 8
Sequence of 6 garbage values
Compiler Error
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
What will be the output of the following program?

#include<stdio.h>

int main()

{

const int i = 1;

i = 5;

printf("%d", i);

return 0;

}

1
5
0
Error
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
#include <stdio.h>

#include <string.h>

int main(void)

{

char line[100] = "mango\n";

printf( "%zu ", strlen( line ) );

return 0;

}

The output of the above program is:

6
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00