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?
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
#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));
}
#include<stdio.h>
void main()
{
char str[]= "abcde";
printf("%c ", 3[str]);
}
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?
#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?
Choose the correct option among following for the piece of code mentioned above:
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?
void fun()
{
static int i=5;
printf("%d ",i);
if(i--)
{
fun();
}
}
void main()
{
fun();
}
What will be the output of the above code?
int foo(int n)
{return (n & n |1);}
void main()
{
printf("%d", foo(110));
}
What will be the output of above program?___
main()
{
static int a=1;
ptrFun();
a+=1;
ptrFun();
printf(" %d \n",a);
}
void ptrFun()
{
static int a=2;
int b=1;
a+=++b;
}
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?
#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;
}
#include<stdio.h>
int main()
{
const int i = 1;
i = 5;
printf("%d", i);
return 0;
}
#include <string.h>
int main(void)
{
char line[100] = "mango\n";
printf( "%zu ", strlen( line ) );
return 0;
}
The output of the above program is: