Professional Documents
Culture Documents
Zoho Interview
Easy L1 Questions
1. Find output
1 #include <stdio.h>
2 #include <ctype.h>
3 int main()
4 {
5 int i= _____ ; //Initialize i to your last digit of
rollnumber
6 char str[]="zohocorporation";
7 str[0] = toupper(str[i]);
8 puts(str);
9 }
Output :
Zohocorporation or Oohocorporation or Hohocorporation or Cohocorporation ..
depending on his roll number
2. Find output
1 #include <stdio.h>
2 #include<stdlib.h>
3 int main()
4 {
5 int a= _____ ; //Last digit of rollnumber
6 int b= _____ ; //Last before digit of rollnumber
7 printf ("[%d, %d]", ((a+b) + abs(a-b))/2, ((a+b) -
abs(a-b)) /2);
8 return 0;
9 }
Output : Prints minimum of a and b as [min,max]
3. Find output
1 #include<iostream>
2 using namespace std;
3 int main() {
4 int x = _____ ; // Last digit of your rollnumber
5 int y = x % 5;
6 switch (y)
7 {
8 case 1:
9 cout << "Cliq";
10 break;
11 case 2:
12 cout << "Connect";
13 case 3:
14 cout << "ZohoMail";
15 break;
16 case 4:
17 cout << "Desktopcentral";
18 break;
19 default:
20 cout << "ManageEngine";
21 break;
22 }
23 return 0;
24 }
4. Find output
1 #include <stdio.h>
2 #include <string.h>
3 int main()
4 {
5 char str[]="manageengine";
6 char *alter[]={"desktop","edr","mobile","patch","remote"};
7 int i= ____ ; // Last digit of your roll number
8 int j = i%4;
9 printf("%s",str+strlen(alter[j]));
10 return 0;
11 }
Prints : str+ 4 => prints 4th char to end of str
5. Find output
1 #include <stdio.h>
2 int main()
3 {
4 int i;
5 int j= ___; //Last Digit of your roll number
6 char str[]="ManageEngine";
7 for(i=0;str[i]!='\0';i++)
8 {
9 if(i%j!=0){
10 putchar(str[i]);
11 }
12 putchar('*');
13 }
14 return 0;
15 }
Sample Output: *a*n*a*g*e**n*g*i*n*e*
6.
1 #include <stdio.h>
2 void main()
3 {
4 char var1='A';
5 const int val= ______ ; //Your roll number
6 val = val + (int)var1;
7 printf("%c",val);
8 }
Output : Error reason - const value cannot be modified
7.
1 #include <stdio.h>
2 int main(void) {
3 int x=2;
4 int y=____; //Last digit of your rollnumber
5 int z=4;
6 x*=-2*(y+z)/3;
7 printf("result %d",x);
8
9 return 0;
10 }
Output : Output of simple BODMAS evaluation
8.
1 #include <stdio.h>
2 int main()
3 {
4 int magic=0;
5 int color= _____ ; //Last digit of your rollnumber
6 for(;;)
7 {
8 if(magic==color)
9 break;
10 printf("%d ",++magic);
11 }
12 return 0;
13 }
Output : 1 or
1 2 or
1 2 3... N where N is last digit of rollno
9.
1 #include <stdio.h>
2 void main()
3 {
4 int x=____; //Last digit of your roll number
5 ++x;
6 x=x%5;
7 ++x;
8 int y= x-(x+1)>0?2:1;
9 int charVal='A';
10 for(int i=x;i>=y;i--)
11 {
12 for(int j=0;j< i;j++)
13 printf("%c ",(charVal+j));
14 printf("\n");
15 }
16 }
A B C
A B
A
10.
1 #include <stdio.h>
2 int main()
3 {
4 static int var[10];
5 int count=0;
6 int myrollno= ______; //Last digit of your roll number
7 var[++count]=++count;
8 for(count=0;count<myrollno;count++)
9 printf("%d ",var[count]);
10 return 0;
11 }
0 0 2 0 0 0 0 0
11.
1 #include<stdio.h>
2
3 int main()
4 {
5 char *names[] = { "Apple", "Google", "Microsoft",
"Samsung", "Nokia"};
6 int rollNo= _____; //Last digit of your roll number
7 rollNo=rollNo%4;
8 char *t;
9 t = names[rollNo];
10 names[rollNo] = names[rollNo+1];
11 names[rollNo+1] = t;
12 for(int i=0; i<=4; i++)
13 printf("%s,", names[i]);
14 return 0;
15 }
Apple,Google,Samsung,Microsoft,Nokia,
12.
1 #include<stdio.h>
2
3 int main()
4 {
5 static char s[25] = "UnifiedEndpointManagerPlus";
6 int i=__; //Last digit of your roll number
7 char ch;
8 ch = s[++i];
9 printf("%c", ch);
10 ch = s[i++];
11 printf("%c", ch);
12 ch = i++[s];
13 printf("%c", ch);
14 ch = ++i[s];
15 printf("%c", ch);
16 return 0;
17 }
13
1 #include <stdio.h>
2 int main()
3 {
4 int var=_____; // Last digit of your rollnumber
5 {
6 int var=200;
7 printf("%d...",var-(var);
8 }
9 printf("%d",var);
10 return 0;
11 }
14.
1 #include <stdio.h>
2 int main()
3 {
4 int var=____; //Last two digits of your roll number
5 {
6 int var=200;
7 printf("%d...",((2*--var)-1)-(++var)+(var++));
8 }
9 printf("%d",var);
10 return 0;
11 }
15.
1 #include <stdio.h>
2 int main () {
3
4 int b = 200;
5 int n = _____ ; //Last digit of your rollnumber
6 int a = n*5+n-(n/n)*n;
7 doTheMagic(&a, b,n);
8
9 printf("After Magic A : %d\n", a );
10 printf("After Magic B : : %d\n", b );
11
12 return 0;
13 }
14 void doTheMagic(int *x, int y,int n) {
15 *x = (y)+n;
16 y = n+n;
17 return;
18 }
After Magic A : 205 (5 is last digit of rollnumber)
After Magic B : : 200