2nd step to ZOHO - Technical Aptitude - June 16th 2016
TECHNICAL
APTITUDE
1)Predict the
output
#include
main()
{
char s[]={'a','b','c','\n','c','\0'};
char *p,*str,*str1;
p=&s[3];
str=p;
str1=s;
printf("%d",++*p + ++*str1-32);
}
#include
main()
{
char s[]={'a','b','c','\n','c','\0'};
char *p,*str,*str1;
p=&s[3];
str=p;
str1=s;
printf("%d",++*p + ++*str1-32);
}
2) Predict the
output
#include
main()
{
struct xx
{
int x=3;
char name[]="hello";
};
struct xx *s;
printf("%d",s->x);
printf("%s",s->name);
}
3)Predict the
output
#include
#define a 10
main()
{
#define a 50
printf("%d",a);
}
4)Predict the
output
main()
{
char *p;
p="Hello";
printf("%c\n",*&*p);
}
5)Predict the
output:
void main()
{
int i=5;
printf("%d",i+++++i);
}
6)Predict the
output:
int main()
{
int x = 032;
printf("%d", x);
return 0;
}
7) Predict the output:
Note:
starting address - 1000
int - 4 bytes
# include
int main( )
{
static int a[] = {10, 20, 30, 40, 50};
static int *p[] = {a, a+3, a+4, a+1, a+2};
int **ptr = p;
ptr++;
printf("%d%d", ptr-p, **ptr};
}
8) Predict the
output:
#include
int fun(int arr[]) {
arr = arr+1;
printf("%d ", arr[0]);
}
int main(void) {
int arr[2] = {10, 20};
fun(arr);
printf("%d", arr[0]);
return 0;
}
9) Predict the
output:
#include
int main()
{
int x = 10;
static int y = x;
if(x == y)
printf("Equal");
else if(x > y)
printf("Greater");
else
printf("Less");
return 0;
}
10) What will be output if
you will compile and execute the following c code?
int * call();
void main(){
int *ptr;
ptr=call();
clrscr();
printf("%d",*ptr);
}
int * call(){
int a=25;
a++;
return &a;
}
11) What is error in
following declaration?
struct outer{
int a;
struct inner{
char c;
};
};
12) What will be output if
you will compile and execute the following c code?
void main(){
int array[]={10,20,30,40};
printf("%d",-2[array]);
}
13) What will be output if
you will compile and execute the following c code?
Note: double - 8 bytes
void main(){
double far* p,q;
printf("%d",sizeof(p)+sizeof q);
}
14) What will be output if
you will compile and execute the following c code?
#include "stdio.h"
#include "string.h"
void main(){
char c='\0';
printf("%d",c);
}
15) What will be output if
you will compile and execute the following c code?
#define call(x,y) x##y
void main(){
int x=5,y=10,xy=20;
printf("%d",xy+call(x,y));
}
Comments
Post a Comment