| Other C Code Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| main()
{
float me = 1.1;
double you = 1.1;
if(me==you)
printf("I love U");
else
printf("I hate U");
} | | 1 |
| main(){
char a[100];
a[0]='a';a[1]]='b';a[2]='c';a[4]='d';
abc(a);
}
abc(char a[]){
a++;
printf("%c",*a);
a++;
printf("%c",*a);
} | | 1 |
| main()
{
char p[ ]="%d\n";
p[1] = 'c';
printf(p,65);
} | | 1 |
| what will be the position of the file marker?
a: fseek(ptr,0,SEEK_SET);
b: fseek(ptr,0,SEEK_CUR); | | 1 |
| Write a procedure to implement highlight as a blinking
operation | | 1 |
| #define assert(cond) if(!(cond)) \
(fprintf(stderr, "assertion failed: %s, file %s,
line %d \n",#cond,\
__FILE__,__LINE__), abort())
void main()
{
int i = 10;
if(i==0)
assert(i < 100);
else
printf("This statement becomes else for if in
assert macro");
} | | 1 |
| void main()
{
int i=i++,j=j++,k=k++;
printf(“%d%d%d”,i,j,k);
} | | 1 |
| Is the following code legal?
typedef struct a
{
int x;
aType *b;
}aType | | 1 |
| #include<stdio.h>
main()
{
struct xx
{
int x=3;
char name[]="hello";
};
struct xx *s=malloc(sizeof(struct xx));
printf("%d",s->x);
printf("%s",s->name);
} | | 1 |
| union u
{
union u
{
int i;
int j;
}a[10];
int b[10];
}u;
main()
{
printf("\n%d", sizeof(u));
printf(" %d", sizeof(u.a));
// printf("%d", sizeof(u.a[4].i));
}
a. 4, 4, 4
b. 40, 4, 4
c. 1, 100, 1
d. 40 400 4 | HCL | 1 |
| main()
{
unsigned char i=0;
for(;i>=0;i++) ;
printf("%d\n",i);
} | | 1 |
| void ( * abc( int, void ( *def) () ) ) (); | | 1 |
| main()
{
char *p;
p="%d\n";
p++;
p++;
printf(p-2,300);
} | | 1 |
| What is wrong with the following code?
int *foo()
{
int *s = malloc(sizeof(int)100);
assert(s != NULL);
return s;
} | | 1 |
| main()
{
int k=1;
printf("%d==1 is ""%s",k,k==1?"TRUE":"FALSE");
} | | 1 |
| #define prod(a,b) a*b
main()
{
int x=3,y=4;
printf("%d",prod(x+2,y-1));
} | | 1 |
| Is the following code legal?
typedef struct a aType;
struct a
{
int x;
aType *b;
}; | | 1 |
| main()
{
struct date;
struct student
{
char name[30];
struct date dob;
}stud;
struct date
{
int day,month,year;
};
scanf("%s%d%d%d", stud.rollno, &student.dob.day,
&student.dob.month, &student.dob.year);
} | | 1 |
| void main()
{
unsigned giveit=-1;
int gotit;
printf("%u ",++giveit);
printf("%u \n",gotit=--giveit);
} | | 1 |
| main()
{
extern out;
printf("%d", out);
}
int out=100; | | 1 |
| |
| For more C Code Interview Questions Click Here |