0% found this document useful (0 votes)
97 views22 pages

One Word

Uploaded by

ninja404error11
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views22 pages

One Word

Uploaded by

ninja404error11
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Output: True

Input: x = 10001, y = 10
Output: False

Sample Input Sample Output

625 5 True

Sample Input Sample Output

128 5 False

Time Limit: - ms Memory Limit: - kb Code Size: - kb

Section 2 - ZOHO 1

Section Summary
No. of Questions: 125
Duration: 100 min

Additional Instructions:
None

Q1. 1. Find the output for the following programs


#include<stdio.h>
Void main()
{
int i;
for( i = 1 ; i < 4 ; i++)
{
switch(i)
{
case 1 : printf("%d" , i);break;
case 2 : printf("%d" , i);break;
case 3 : printf("%d" , i);break;
}

}
switch(i)
{
case 4 : printf("%d" , i);break;
}
} _________

Q2. 1. Find the output


void main()
{
int a[10] , i = 0;
for(i = 0 ; i<10 ; i++)
a[i] = 9 - i;
for(i = 0 ; i < 10 ; i++)
a[i] = a[a[i]];
for(i = 0 ; i < 10 ; i++)
printf("%d " , a[i]);
} _________

Q3. 1. Find the output


void printout(char* pstr)
{
int iretval = 0;
if(pstr)
{
while(*pstr && *pstr<= '9' && *pstr >= '0')
{
iretval = (iretval*10)+(*pstr - '0');
pstr++;
}
}
printf("%d\n" , iretval);
}
void main()
{
printout("X32");
printout("47X74");
} _________

Q4. 1. Find the output


void main()
{
char *s = "\12345s\n";
/
printf("%d" , sizeof(s));
} _________

Q5. 1. Find the output


void main()
{
int a[] = { 8 , 9 , 9 , 9};
int r[5] = { 0 , 0 , 0 , 0 , 0};
int i = 0 , m = 1 , s = 4;
for( i = s-1 ; i >= 0 ; i--)
{
r[i+1] = (a[i] + m ) % 10;
m = (a[i] + m) /10;

}
r[0] = m ;
for( i = 1 ; i <= s ; i++)
printf("%d" , r[i]);
} _________

Q6. 1. Find the output


int i = 0 ;
int fun(int a)
{
i++;
if( a > 99)
return a-12;
return fun(fun(a+25));
}
void main()
{
printf("%d " , fun(69));
printf("%d" , i);
} _________

Q7. 1. Find the output ons)


int max(int x , int y)
{
return (y > x) ? y : x;
}
void main()
{
int a[] = { -6 , - 7 , 8 , - 9 , -2 , 3,-4,5};
int value = a[0] , ctval = a[0];
int i = 0 , n = 8;
for( i = 1 ; i < n ; i++)
{
ctval = max( a[i] , ctval+a[i]);
value = max(value , ctval);
}
printf("%d" ,value) ;
} _________

Q8. 1. Find the output


void main()
{
int a=30,b=40,x;
x=(a=10)&(b=50);
printf("x=%d\n",x);
} _________

Q9. 1. Find the outputint main()


{
char *s[]={ "dharmr'a","hewlett-packard","siemens","ibm"};
char **p;
p=s;

printf("%s" ,++*p);
printf("%s",*p++); ;
printf("%s" ,++*p);
} _________

Q10. 1. Find the output


void main()
{
int x=0,y=1;
y=x;
x=!y;
printf("x=%d y=%d\n",x,y);
} _________

Q11. 1. Find the output


void main()
{
int x=3,y=4,z=4;
/
printf("ans=%d\n",(z>=y>=x?100:200));
} _________

Q12. 1. Find the output


void main()
{
oat a=12.25,b=13.65;
if(a==b)
printf("a and b are equal");
else
printf("a and b are not equal");
} _________

Q13. 1. Find the output


void main()
{
int arr[]={0,1,2,3,4};
int *ptr,i;
for(ptr=arr+4;ptr >= arr ; ptr--)
printf("%d ",*ptr);
} _________

Q14. Find the output


void junk(int,int*);
int main()
{
int i=-5,j=-2;
junk(i,&j);
printf("i=%d j=%d" ,i ,j);

return 0;
}
void junk(int i,int *j)
{
i=i*1;
*j=*j * i;
} _________

Q15. Find the output


void main()
{
if('Z' < 'z')
printf("Pilots are on strike...\n");
else
printf("for absolutely outlandish demands\n");

} _________

Q16. Find the output


void main()
{
oat a = 0.7;
if( a < 0.7)
printf("Stoned");
else
printf("Avenged");

}
_________

Q17. Find the output


void main()
{
oat a=0.5,b=0.9;
if(a&&b>0.9)
printf("tce-cse-a\n");
else
printf("tce-cse-b\n");
} _________

Q18. 1. Find the output(branching and looping)


void main()
{
int i;
for(i=1;i++<=5;printf("%d ",i));
}
_________

Q19. Find the output


void main()
{
int i = 1 , j = 1;
for(;j;printf("%d %d\n",i,j))
j=i++<=5; /
}
_________

Q20. Find the outputvoid main()


{
int x=3,y,z;
z=y=x;
z*=y=x*x;
printf("x=%d y=%d z=%d\n",x,y,z);
} _________

Q21. Find the output


void main()
{
int x=3,z;
z=x/++x;
printf("x=%d z=%d\n",x,z);

}
_________

Q22. Find the output


void main()
{
int x , y , z;
x=y=z=1;
z=++x || ++y&&++z;
printf("x=%d y=%d z=%d \n",x,y,z);

}
_________

Q23. Find the output


int main()
{
char *s[]={ "dharmr'a","hewlett-packard","siemens","ibm"};
char **p;
p=s;

printf("%s" ,++*p);
printf("%s",*p++); ;
printf("%s" ,++*p);
}
Output: _________

Q24. Find the output


void main()
{
char ch='E';
switch(ch)
{
case(ch>=65 && ch<=90):
printf("Capital letter\n");
break;
case(ch>=97 && ch<=122):
printf("small letter\n");
break;
case (ch>=48 && ch<=57):
printf("Digit");
break;
default:printf("Anyother");
}
_________

Q25. Find the output


void main()
{
int i = 3;
switch(i)
{
case 1: printf("cse\t");
case 2: printf("It\n");break;
case 3: continue;
default : printf("goodbye");
}
}
_________

Q26. Find the output


void main()
{
char s;
switch(s)
{
case '1': printf("database");
/
case '2': printf("data-structure");
default: printf("c");
printf("byebye");
}
}
_________

Q27. Find the output


void main()
{
int k=-2,j=4;
switch(k/=j/k)
{
default:printf("lenovo");
case 0 : printf("hp");
case 1: printf("acer");
case 2: printf("dell");
}
}
_________

Q28. Find the output


void main()
{
int j,x=0;
for (j=0;j<=5;j++)
{
switch(j-1)
{
case 0:
case -1:
x -= 1;break;
case 1:
case 2:
case 3:
break;
default: x+=3;

}
printf("%d " , x);
}

}
_________

Q29. Find the output


void main()
{
int i;
for(i = 2 ; i <= 10 ; i++)
{
switch(i)
{
case 2: printf("0");continue;
case 3: break;
case 4:
case 5:printf("1");break;
default: printf("000");
}
}
}
_________

Q30. Find the output


void main()
{
char ch='E';
switch(ch) {
case(ch>=65 &&ch<=90):
printf("Capital letter\n");
break;
case(ch>=97 &&ch<=122):
printf("small letter\n");
break;
case (ch>=48&&ch<=57):
printf("Digit");
break;
default: printf("Any other");

}
_________

Q31. Find the output


#include<stdio.h>
#include<malloc.h>
#include<string.h>
int main()
{
int i; /
char a[]="String";
char *p = "New String";
char *temp;
temp = malloc(strlen(p) + 1);
p = malloc( strlen(temp) + 1);
strcpy(p , temp);
printf("%s" , p);
}
Output : _________

Q32. Find the output


int funcl(int k)
{
k++;
return k;
}

void main()
{
int k=35,z;
k=funcl(k=funcl(k=funcl(k)));
printf("k =%d\n",k);

}
_________

Q33. Find the output


int main()
{
int n = 12 , res = 1;
while( n > 3)
{
n -= 3;
res *= 3;
}
printf("%d" , n*res);
}
Output : _________

Q34. Find the output


void fun(int [][3]);
int main()
{
int a[3][3] = {9,8,7,6,5,4,3,2,1};
fun(a);
printf("%d\n" , a[2][1]);
}
void fun(int b[][3])
{
++b;
b[1][1]=5;
}
Output : _________

Q35. Find the outputvoid pri(int,int);


void printit( oat,int);
void main()
{
oat a=3.14;
int i=99;
pri(i,a);
printit(a,i);

}
void pri(int i,int a)
{
printf("i=%d a=%f\n",i,a);
printf("a=%f i=%d\n",a,i);
}
void printit( oat a,int i)
{
printf("a=%f i=%d\n",a,i);
printf("i=%d a=%f\n",i,a);
}
_________
_________
_________
_________

Q36. Find the output


void main()
{

int i , n;
char x[5];
strcpy( x , "Zoho");
n = strlen(x);
*x = *(x+(n-1));
printf("%s" , x);
} /
Output: _________

Q37. Find the output


void main()
{
int c[]={5,4,3,4,5};
int j , *q = c;
for( j = 0 ; j<5 ; j++){
printf("%d" , *c);
++q;
}
}
Output: _________

Q38. Find the output


void main(){
int k=35,*z,*y;
z=&k; y=z;
*z++=*y++;
k++;
printf("k=%d z=%d y=%d",k,z,y);
}
_________

Q39. Find the output


void main()
{
int i = 1;
for(i =0 ; i= -1 ; i=1){
printf("%d", i);
if(i!= 1) break;
}
}
Output: _________

Q40. Find the output


void main()
{

int s[] = {1,0,5,0,10,0};


int f[] = {2,4,6,8,10,12};
int n = 6 , i = 0 , j = 0;
for( j = 1 ; j < n ; j++)
{
if( s[j] >= f[i])
{
printf("%d" , i);
i = j;
}
}
}
output : _________

Q41. Find the output


void main(){
int a=100,*b,**c,***d;
b=&a; c=&b; d=&c;
printf("%d %d %d %d",a,*b,**c,***d);

}
_________

Q42. Find the output


void main(){
int z=4;
printf("%d\n",printf("%d%d\n",z, z-1));
}
_________

Q43. Find the output


void f(int *a , int m)
{
int j = 0;
for(j = 0 ; j < m ; j++)
{
*(a+j) = *(a+j) - 5;
}
}
void main()
{
int a[] = {'f' , 'g' , 'h' , 'i' , 'j'};
int j = 0 ;
f(a , 5);
for(j = 0 ; j<= 4 ; j++)
printf("%c\t" , a[j]);
/
}
Output: _________

Q44. Find the output


oat *jam( oat *r){

r=r+1;
return (r);
}

void main()
{
oat *jam( oat *);
oat p=23.5,*q;
q=&p;
printf("q before call=%d\n",q);
q=jam(&p);
printf("q after call=%d",q);
}
_________
_________

Q45. Find the output


void main()
{
int i;
printf("hai");
for(i = 1 ; i<= 10 ; i++)
main();

}
_________

Q46. Find the output


void main()
{
int i=0, j=0 , sum=0;
for(i= 1; i < 500 ; i*=3)
for(j=0;j<i;j++)
sum++;
printf("%d",sum);

}
Output: _________

Q47. Find the output


void main()
{
if(printf("C for yourself how it works\n"))
main();

}
_________

Q48. Find the output


void main()
{
int n;
for(n = 6 ; n!= 1; n--)
printf("%d" , n--);
}
Output: _________

Q49. Find the output


void main()
{
unsigned int ch=0;

for(ch=65;ch<=255;)
printf("%d %c\n",ch,ch++);

}
_________

Q50. Find the output


void main()
{
int a[3][4] = {2,4,6,5,10,12,12,10,5,6,4,2};
int i = 0 , j , k =99;
while(i < 3)
{
for(j = 0 ; j < 4 ; j= j++)
{
if( a[i][j] < k)
{
/
k = a[i][j];
}
}
i++;
}
printf("%d" , k);
}
Output : _________

Q51. Find the output


void main()
{
oat a=0.7;
double b=0.7;
if(a==b)
printf("condition statis ed");
else
printf("condition not statis ed");

printf("\na=%f b=%lf\n",a,b);
}
_________
_________

Q52. Find the output


void main()
{

char *x="Alice";
int i , n = strlen(x);
*x = x[n];
for(i=0; i<=n; i++)
{
printf("%s ", x); x++;
printf("\n", x);
}

return 0;

}
Output : _________

Q53. Find the output


void main()
{
oat y=0.9;
long double z=0.9;

if(y=-z)
printf("icecrearm");
else
printf("cake");

}
_________

Q54. Find the output


void change()
{
auto int i=100;
register int j=200;
printf("change's i and j are %d %d\n",i,j);

}
void main()
{
auto int i=10;
register int j=20;
printf("main's I and j are %d %d\n",i,j);
change();
printf("main's I and j are %d %d\n",i,j);
}
_________
_________
_________

Q55. Find the output


void main()
{
double x,d=4.4;
int i=2,y;
x=(y=d/i)*2;
printf("x=%lf y=%d\n",x,y);
y=(x=d/i)*2;
printf("x=%lf y=%d\n",x,y);
}

_________
_________
/
Q56. Find the output
void main()
{
double x,d=5.0;
int y;
x=d*(x=2.5/d);
printf("x=%lf\n",x);
x=d*(y=(int)2.5+1.5);
printf("x=%lf y=%d\n",x,y);
}
_________
_________

Q57. Find the output


struct value{
int bit1:1;
int bit3:4;
int bit4:4;
}bit;
int main()
{
printf("%d\n", sizeof(bit));
return 0;
}
Output : _________

Q58. Find the output


void main()
{
double x,d=5.0;
int y;
x=d*(x=2.5/d);
printf("x=%lf\n",x);
x=d*(y=(int)2.5+1.5);
printf("x=%lf y=%d\n",x,y);
}
_________
_________

Q59. Find the output


struct node
{
int data;
oat d;
struct node *link;
};
int main()
{
struct node *p, *q;
p = (struct node *) malloc(sizeof(struct node));
q = (struct node *) malloc(sizeof(struct node));
printf("%d, %d\n", sizeof(p), sizeof(q));
return 0;
}
Output : _________

Q60. Find the output


void main()
{
int c=5;
printf("c=%d\n",c--);
if(c) main();
}
_________

Q61. Find the output


int func(int x)
{
static int v=2;
v--;
return (v-x);
}
int i;
void main()
{
int j;
for(;;)
{
if( j= func(i) )
printf("j= %d " , j);
else
break;
}

}
_________

/
Q62. Find the output
void main()
{
long num=2;
short n=2;
signed no=2;
printf("num=%ld n=%d no=%d\n",num,n,no);
}
_________

Q63. Find the output


void main()
{
char ch=122,ch1='z';
printf("ch=%c\n",ch);
printf("chl=%d\n",ch1);
}
_________
_________

Q64. Find the output


typedef union
{
int a;
char b[10];
oat c;
}Union;
int main()
{
Union x , y = {100};
x.a = 50;
strcpy(x.b , "Hello");
x.c = 21.50;
printf("%d %s %f\n" , x.a , x.b , x.c);
printf("%d %s %f" , y.a,y.b, y.c);

}
Output: _________
_________

Q65. Find the output


void main()
{
unsigned int a=25;
unsigned b=25;
long unsigned c=345L;
long signed d=345L;
printf("a=%u b=%u\n",a,b);
printf("c=%lu d=%d\n",c,d);
}
_________

Q66. Find the output


struct point{

int x;
int y ;
};
struct point origin , *pp;
int main()
{
pp = &origin;
printf("origin is (%d %d)\n", (*pp).x , (*pp).y);
printf("origin is (%d %d)" , pp->x , pp->y);
return 0;
}
Output : _________
_________

Q67. Find the output


void main()
{
int i = -1;
printf("i =%d +i = %d\n" , i , +1);
}
Output : _________

Q68. Find the output


void main()
{
char not;
not=12;
printf("%d",not);

}
Output : _________

/
Q69. Find the output
void main()
{
auto int i=100;
printf("i=%d\n",i);
i+=1;
printf("i=%d\n",i);

}
_________
_________

Q70. Find the output


#p1
void main()
{
register int i;
for(i=1;i<=100;i++)
printf("%d\n",i);

}
#p2
void main()
{
auto int i;
for(i=1;i<=100;i++)
printf("%d\n",i);

}
_________

Q71. Find the output


#de ne FALSE -1
#de ne TRUE 1
#de ne NULL 0
void main()
{
if(NULL)
puts("NULL");
else if(FALSE)
puts("TRUE");
else
puts(" FALSE");

}
Output : _________

Q72. Find the output


#de ne CUBE(x) x*x*x
void main()
{
int a;
a= 27 / CUBE(3);
printf("%d" , a);

}
_________

Q73. Find the output


#de ne CUBE(x) (x*x*x)
void main()
{
int a , b;
a = CUBE(b+4) / b++;
printf("a= %d b = %d ", a , b);

}
_________

Q74. Find the output


void main()
{
int k = 1;
printf("%d==1 is"" %s" ,k, k == 1 ? "TRUE":"FALSE");
}
Output : _________

Q75. Find the output


#de ne AND &&
#de ne OR ||
#de ne LE <=
#de ne GE >=
void main()
{
char ch='D';
if((ch GE 65 AND ch LE 90) OR (ch GE 97 AND ch LE 122))
printf("Alphabet\n");
/
else
printf("Not alnhabet");

}
_________

Q76. Find the output


void main()
{
static oat arr[]={1.2,12,2.4,24,3.5,35};
int i;
for(i=0;i<=5;i++)
printf("%f ",arr[i]);
}
_________

Q77. Find the output


void main()
{
static int b[]={10,20,30,40,50};
int i;
for(i = 0; i<= 4 ; i++)
printf("%d ",b[i]);
}
_________

Q78. Find the output


int main()
{
int t , i ;
for ( t=4;scanf("%d",&i)-t;printf("%d\n",i))
printf("%d--",t--);

}
Output : _________

Q79. Find the output


void main()
{
static int a[5]={5,10,15,20,25};
int i,j,m,n;
i=4-a[1];
j=a[1]++;
printf("i=%d j=%d a[1]=%d\n",i,j,a[1]);
i=1;
m=a[1]+41;
printf("i =64 m=%d\n",i,m);
i=2;
n=a[1]++;
printf("i=%d n=%d\n",i,n);

}
_________
_________
_________

Q80. Find the output


struct emp{
int len;
char name[1];
};
int main()
{
char newname[] = "Rahul";
struct emp *p = (struct emp *) malloc(sizeof(struct emp) -1 + strlen(newname)+ 1);
p->len = strlen(newname);
strcpy(p -> name, newname);
printf("%d %s\n", p->len, p->name); return 0;
}
Output : _________

Q81. Find the output


void main()
{
static int a[]={10,20,30,40,50};
int j;
for (j=0;j<5;j++)
{
printf("%cl\n",*a);
a++;
}
_________

Q82. Find the output


int main() {
printf("%d %d %d %d\n",72,072,0x72,0X72);
/
return 0;
}
Output : _________

Q83. Find the output


void main()
{
char ch;
int a;
oat b;
printf("bytes occupied by ch=%d\n",sizeof(ch));
printf("bytes occupied by a=%d\n",sizeof(a));
printf("bytes occupied by b=%d\n",sizeof(b));
}
Output :
_________
_________
_________

Q84. Find the output


void main()
{
printf("%d\n" , sizeof('7'));
printf("%d\n" , sizeof(7));
printf("%d\n" , sizeof(7.0));
}
Output: _________
_________
_________

Q85. Find the output


void main()
{
char ch=291;
printf("%d %d %c\n",2147483648,ch,ch);
return 0;
}
Output : _________

Q86. Find the output


void main()
{
static int b[]={10,20,30,40,50};
int i,*k;
k= &b[4]-4;
for(i=0;i<=4;i++)
printf("%d ",*k);
k++;

}
_________

Q87. Find the output


void main()
{
int g;
g=300000*300000/300000;
printf("g=%d\n",g);
}
Output : _________

Q88. Find the output


void main()
{
static int a[]={2,4,6,8,10};
int i;
for(i=0;i<=4;i++)
*(a+i)=a[i]+i[a];
printf("%d\n",*(i+a));

_________

Q89. Find the output


void main()
{
oat a;
a=4/2;
printf("%f %f\n",a,4/2);

}
Output : _________

/
Q90. Find the outputvoid main()
{
int arr[]={0,1,2,3,4};
int i,*ptr;
for(ptr=&arr[0],i=0;i<=4;i++)
printf("%d ",ptr[i]);
}
_________

Q91. Find the output


void main()
{
printf("%d\n",sizeof(4)/sizeof(2.0));
printf("%d\n",sizeof(2.0)/sizeof(4));
}
Output : _________

Q92. Find the output


void main()
{
int arr[]={0,1,2,3,4};
int i,*p;
for(p=arr,i=0;p+i<=arr+4;p++,i++)
printf("%d ",*(p+i));

}
_________

Q93. Find the output


void main()
{
int x=10,y=5,p,q;
p=x > 9;
q=x>3&& y!=3;
printf("p=%d q=%d \n",p,q);

}
Output : _________

Q94. Find the output


void main()
{
static int a[]={0,1,2,3,4};
static int *p[]={a,a+1,a+2,a+3,a+4};
int **ptr=p;
printf("%d %d\n",a,*a);
printf("%d %d %d\n",p,*p,**p);
printf("%d %d %d\n",ptr,*ptr,**ptr);
}
_________
_________
_________

Q95. Find the output


void main()
{
static int a[]={0,1,2,3,4};
static int *p[]={a,a+1,a+2,a+3,a+4};
int **ptr=p;
printf("%d %d %d\n",ptr-p,*ptr-a,**ptr);
*ptr++;
printf("%d %d %d\n",ptr-p,*ptr-a,**ptr);
*++ptr;
printf("%d %d %d\n",ptr-p,*ptr-a,**ptr);
++*ptr;
printf("%d %d %d\n",ptr-p,*ptr-a,**ptr);
}
_________
_________
_________
_________

Q96. Find the output


void main()
{
static int n[3][3]={12,4,3,6,8,5,3,5,11};
printf("%d %d %d\n",n,n[2],n[2][2]);
}
_________

Q97. Find the output


void main()
{
char s[]="Rendezvous !";
printf("%d\n",*(s+strlen(s)));
/
}
_________

Q98. Find the output


void main()
{
char str[20];
static int i;
for(;;) {
i++[str]='A'+2;
if(i==19)
break;
}
i[str]=0;
printf("%s" , str);

}
_________

Q99. 1. Find the output( strings)


void main()
{
char s[]="C smart!!";
int i;
for(i=0;s[i];i++)
printf("%c%c%c%c\n",s[i],*(s+i),i[s],*(i+s));

}
Output :
_________

Q100. 1. Find the outputvoid main()


{
char s[]="Dinks Grunts and Guffaws";
printf("%c\n",*(&s[2]));
printf("%s\n",(s+5));
printf("%s\n",s);
printf("%c\n",*(s+10));
}
_________
_________
_________
_________

Q101. Find the output


void main()
{
int a = 3 , b = 2 , c = 1 , d;
d = a | b & c;
printf("d = %d\n", d);
d = a+ b & -c;
printf("d = %d\n" , d);
}
_________

Q102. Find the output


void main()
{
char str[]="MalayalaM";
char *s;
s = str+8;
while( s > str)
{
printf("%c" , *s);
s--;
}
}
_________

Q103. Find the output


int show();
void main()
{

int (*f)();
f= show;
printf("address= %d\n",f);
}
int show()
{
printf("Diamonds are very costly");
}
_________

Q104. Find the output


void main()
/
{
char str[]="Shall we tell the Deputy Director?";
printf("%s\n%s\n%s\n",str,str+6,str+9);

}
_________
_________
_________

Q105. Find the output


struct num
{
unsigned bit0:1;
unsigned bit1:1;
unsigned bit2:1;
unsigned rest:5;
};
union a
{
struct num n;
char ch;
}b;
void main()
{
b.ch = 32;
printf("%d %d %d %d", b.n.bit0 , b.n.bit1,b.n.bit2,b.n.rest);
}
_________

Q106. Find the output


void main()
{
printf("%f\n" , ( oat)(int)( oat)(int)6.5/2+3.5);
}
_________

Q107. Find the output


struct employee
{
char name[25];
int age;
oat bs;
};

void main()
{
struct employee e;
e.name = "Hacker";
e.age=25;
printf("%s %d" , e.name , e.age);

}
_________

Q108. Find the output


typedef struct
{
char name[20];
int age;
}a;
void main()
{
a temp= {"sunil" , 30};
printf("%s %d" , temp.name , temp.age);

}
_________

Q109. Find the output


struct name1
{
char name[25];
char lang[10];
};
static struct name1 a = {"Hacker" , "cr"};
void main()
{
printf("%s %s" , a.name , a.lang);
}
_________

Q110. Find the output


void main()
{
enum status {low,medium,high};
enum status rain;
rain = 0;
if(rain == low)
/
printf("rain = %d", rain);
}
_________

Q111. Find the output


struct a {
char ch[7];
char *str;

};

void main()
{
static struct a s1={"Nagpur" , "Bombay"};
printf("%c %c\n" , s1.ch[0] , *s1.str);
printf("%s %s" , s1.ch , s1.str);
}
_________
_________

Q112. Find the output


void main()
{
int a=0Xff;
if(a<<4>>12)
printf("leftest");
else
printf("rightest");
}
_________

Q113. Find the output


void main()
{
int a=0Xff;
if(a<<4>>12)
printf("leftest");
else
printf("rightest");
}
_________

Q114. Find the output


struct a
{
int i;
char ch[4];
};
union b
{
int j;
char ch[4];
};
void main()
{
printf("%d " , sizeof(struct a));
printf("%d " , sizeof(union b));
}
_________

Q115. Find the output


void main()
{
short int k;
k = -35;
printf("k=%d " , k);
k = -k;
printf("k = %d " , k);
}
_________

Q116. Find the output


int main(int argc , char* argv[])
{
printf("%d ", argc);
printf("%s" , argv[0]);
}
_________

Q117. Find the output


union a
{
int i;
char ch[2];
};
void main()
/
{
union a u;
u.i = 256;
printf("%d %d %d " , u.i , u.ch[0] , u.ch[1]);
}
_________

Q118. Find the output


{
long int i;
char ch[4];
};
void main()
{
struct a s;
s.i = 512;
printf("%d %d %d" , s.ch[0] , s.ch[1] ,s.ch[3]);
}
_________

Q119. Find the output


void main()
{
static char str[]="Triplet";
char *s;
s = str;
while(*s)
{
putc(*s , stdout);
fputchar(*s);
printf("%c\n ",*s);
s++;
}
}
_________

Q120. Find the output


void main()
{
char name[20]="Sandeep";
int salary=1500;
printf("%s %d\n", name , salary);
fprintf(stdout , "%s%d\n",name,salary);
}
_________
_________

Q121. Find the output


{
int i;
char ch[4];
};
void main()
{
union a u;
u.ch[0]=3;
u.ch[1]=2;
u.ch[2]=0;
u.ch[3]=0;
printf("%d %d %d",u.ch[0],u.ch[1], u.i);
}
_________

Q122. Find the output


void main()
{
printf("I\tam\ta\tboy\n");
}
_________

Q123. Find the output


void main()
{
oat a=3.14;
printf("a=%f\n",a);
printf("a=%6.2f\n",a);
printf("a=%-6.2\n",a);
printf("a=%6.1f\n",a);
printf("a=%6.0f\n",a);
}
_________
_________
_________
_________
_________

/
Q124. Find the output
void main()
{
printf("Hello\nHi\n");
printf("Hello\rHi\n");
printf("Hello\b\b\b\b\b\n");
printf("Hil\b\b\bBye\n");
}
_________
_________
_________
_________
_________

Q125. Find the output


void main()
{
printf("%20\s\n","short leg");
printf("%20\s\n","long leg");
printf("%20\s\n","deep ne leg");
printf("%20\s\n","backward short leg");
printf("%20\s","legs are the same");
}
_________
_________
_________
_________
_________

Section 3 - ZOHO

Section Summary
No. of Questions: 6
Duration: 100 min

Additional Instructions:
None

Q1. New Number System


Form a number system with only 3 and 4. Find the nth number of the number system.
Eg.) The numbers are: 3, 4, 33, 34, 43, 44, 333, 334, 343, 344, 433, 434, 443, 444, 3333, 3334, 3343, 3344, 3433, 3434, 3443, 3444 ….

Input Format

Input will be an integer

Output Format

Print the nth number

Constraints

1<=N<=10000000

Sample Input Sample Output

10 344

Sample Input Sample Output

6743 434334344333

Time Limit: - ms Memory Limit: - kb Code Size: - kb

Q2. Word Reversal form the rst occurrence of sub-string


Write a program to accept two strings S1 and S2 and reverse the words of S1,starting from the word where the rst occurrence of S2 present in S1. Same empty
spaces between the words must be maintained in the output. Write the program without splitting up the strings into array of words.
DON'T use any inbuilt functions
Input: S1= This is a test input string S2=st
Output : This is a string input test

Sample Input Sample Output

this is a test sentence this is a sentence test


st

Time Limit: - ms Memory Limit: - kb Code Size: - kb

Q3. Permutation of string

/
A permutation, also called an “arrangement number” or “order,” is a rearrangement of the elements of an ordered list S into a one-to-one correspondence with S
itself. A string of length n has n! permutation.
Below are the permutations of string ABC.
ABC ACB BAC BCA CBA CAB

Sample Input Sample Output

ABC ABC ACB BAC BCA CBA CAB

Sample Input Sample Output

1234 1234 1243 1324 1342 1432 1423 2134 2143 2314 2341 2431 2413 3214 324

Time Limit: - ms Memory Limit: - kb Code Size: - kb

Q4. Locker Problem


There is a school with 100 students, and correspondingly 100 lockers, all of which start off closed. The rst student opens every locker. The second student closes
every other locker, starting with the second (2, 4, 6 etc). The third student changes the state of every third locker starting with the third (3,6,9 etc). The fourth would
change the status of lockers numbered 4,8,12 etc.,. That is, if the locker is open, it is closed, and if it is closed, it is opened. This continues until all 100 students have
passed along the lockers. After the 100th student is done, which lockers are open and which are closed?
[Note: program should work for any number of students/lockers]

Sample Input Sample Output

100 open = 10
close = 90

Time Limit: - ms Memory Limit: - kb Code Size: - kb

Q5. Find the Path


Given an (m x n) matrix, write a program to traverse the cell and print the values present in the given path. Inclued necessary validation and proper error messages in
case of given path is out of bounds.
5 x 5 matrix :
{1 2 3 4 5 } (row 1)
{6 7 8 9 0 } (row 2)
{1 2 3 4 5 } (row 3)
{6 7 8 9 0 } (row 4)
{1 2 3 4 5 } (row 5)

Path Notation : ‘’>” is going right, “v” going down, “<” is going left, “^” is going up.

Example Input 1 :
Start at (Row, Column): 1, 2
Path: >>> v
Output: 2 3 4 5 0

Example Input 2:
Start at (Row, Column): 2,3
Path: v > > v < < ^ > > v v

Output 8 3 4 5 0 9 8 3 4 5 0 5

Example Input 3:
Start at(row, Column): 1 , 4
Path: > v > >

Output: Invalid Path

Input Format

N M - matrix row and col


input for matrix
startrow startcol
path string

Sample Input Sample Output

5 5 8 3 4 5 0 9 8 3 4 5 0 5
1 2 3 4 5
6 7 8 9 0
1 2 3 4 5
Time Limit: - ms Memory Limit: - kb Code Size: - kb

Q6. Group anagram words


Given array of words, group the anagrams and print. Any word or phrase that exactly reproduces the letters in another order is an anagram. Arrive most ef cient
algorithm.

Examples :
Input: {tar,rat,banana,atr,nanaba}
Output: Anagrams:
rat atr tar
nanaba banana

Input: {abc, cde, xyz, dec}


Output: Anagrams:
cde dec
Others:
/
Abc
xyz

Input Format

N - no of words
get input words into array

Sample Input Sample Output

5 rat atr tar


tar rat banana atr nanaba nanaba banana

Time Limit: - ms Memory Limit: - kb Code Size: - kb

You might also like