Zoho Computer Programming Questions and Answers

The following are the Zoho Computer Programming Quesitons and Answers which are asked in level 1

1]

#include <iostream>

using namespace std;
int a=20;
int main()
{
  int a=10;
  std::cout<<a<<""<<::a;
  return 0;
}

Output: 1020

2]

#include<iostream>
void func(int *b){
    *b=1;
}

int main(){
    int *a;
    int n;
    a=&n;
    *a=0;
    func(a);
    std::cout<<*a<<std::endl;
    return 0;
}

Output: 1

3]

#include <iostream>

using namespace std;


class Test{
    static int i;
    int j;
};
int Test::i;
int main(){
    cout<<sizeof(Test);
    return 0;
}

Output: 4

4]

#include <stdio.h>

int main()
{
   int i;
   char ch[]={'z','o','h','o'};
   char *ptr, *str1;
   ptr=ch;
   str1=ch;
   i=(*ptr-- + ++*str1) - 10;
   printf("%d",i);
   return 0;
}

Output: 235

5]

int main(){
int a[10][10]={{1,2},{3,4},{5,6},{7,8},{9,10}};
int *p=a[3];
int result=(*p+2)*a[4][1]+(++*p)+(*p+7);
printf("%d",result);
return 0;
}

Output: 113

6]

#include <stdio.h>

void main(){
    int n=21;
    int out=1;
    while(n>3)
    {
        n/=2;
        out*=(n/2);
        
    }
    printf("%d",n*out);
}

Output: 20

7]

#include <stdio.h>

int main()
{
    int n[]={8,1,3,9,4};
    int j, *y=n;
    for(j=0;j<5;j++)
    {
        if(j%2==0)
        *y++;
    }
    printf("%d",*y);
    return 0;
}

Output: 9

8]

#include <stdio.h>

int main()
{
    int x=10;
    int y=20;
    if(!(x^y))
    printf("0");
    else
    printf("1");
    return 0;
}

Output: 1

9]

#include <stdio.h>

int main(){
int a[10][10]={{1,2},{3,4},{5,6},{7,8},{9,10}};
int *p=a[3];
int result=(*p+2)*a[4][1]+(++*p)+(*p+13);
printf("%d",result);
return 0;
}

119

10]

#include <stdio.h>

int calc(int x, int *py, int **ppz)
{
    int y,z;
    **ppz+=1;
    z=**ppz;
    *py +=**ppz;
    y=*py;
    x+=*py;
    return x+y+z;
    
}
void main(){
    int c,*b,**a;
    c=5;
    b=&c;
    a=&b;
    printf("%d",calc(c,b,a));
}

Output: 35

Leave a Reply

Your email address will not be published. Required fields are marked *

WhatsApp Icon Join For Job Alerts