| Other C Code Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| main()
{
int x=5;
for(;x!=0;x--) {
printf("x=%d\n", x--);
}
}
a. 5, 4, 3, 2,1
b. 4, 3, 2, 1, 0
c. 5, 3, 1
d. none of the above | HCL | 1 |
| main()
{
int i=0;
for(;i++;printf("%d",i)) ;
printf("%d",i);
} | | 1 |
| 1
o 1
1 0 1
0 1 0 1
1 0 1 0 1
how to design this function format in c-language ? | | 1 |
| Program to find the largest sum of contiguous integers in
the array. O(n) | | 7 |
| Is the following code legal?
typedef struct a aType;
struct a
{
int x;
aType *b;
}; | | 1 |
| What are the files which are automatically opened when a C
file is executed? | | 1 |
| main()
{
int i=4,j=7;
j = j || i++ && printf("YOU CAN");
printf("%d %d", i, j);
} | | 1 |
| main()
{
int y;
scanf("%d",&y); // input given is 2000
if( (y%4==0 && y%100 != 0) || y%100 == 0 )
printf("%d is a leap year");
else
printf("%d is not a leap year");
} | | 1 |
| how can u draw a rectangle in C | Wipro | 31 |
| How can u say that a given point is in a triangle?
1. with the co-ordinates of the 3 vertices specified.
2. with only the co-ordinates of the top vertex given. | | 1 |
| #define prod(a,b) a*b
main()
{
int x=3,y=4;
printf("%d",prod(x+2,y-1));
} | | 1 |
| Write a C function to search a number in the given list of
numbers. donot use printf and scanf | Honeywell | 4 |
| main()
{
int i, n;
char *x = “girl”;
n = strlen(x);
*x = x[n];
for(i=0; i<n; ++i)
{
printf(“%s\n”,x);
x++;
}
} | | 1 |
| #define int char
main()
{
int i=65;
printf("sizeof(i)=%d",sizeof(i));
} | | 1 |
| main()
{
int i = 258;
int *iPtr = &i;
printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) );
} | | 1 |
| main(){
unsigned int i;
for(i=1;i>-2;i--)
printf("c aptitude");
} | | 1 |
| main()
{
unsigned int i=10;
while(i-->=0)
printf("%u ",i);
} | | 1 |
| Is the following code legal?
typedef struct a
{
int x;
aType *b;
}aType | | 1 |
| void main()
{
int k=ret(sizeof(float));
printf("\n here value is %d",++k);
}
int ret(int ret)
{
ret += 2.5;
return(ret);
} | | 1 |
| int swap(int *a,int *b)
{
*a=*a+*b;*b=*a-*b;*a=*a-*b;
}
main()
{
int x=10,y=20;
swap(&x,&y);
printf("x= %d y = %d\n",x,y);
} | | 1 |
| |
| For more C Code Interview Questions Click Here |