| Other C Code Interview Questions |
| | | Question | Asked @ | Answers | | | | main()
{
int i=4,j=7;
j = j || i++ && printf("YOU CAN");
printf("%d %d", i, j);
} | | 1 | | main()
{
char *p;
int *q;
long *r;
p=q=r=0;
p++;
q++;
r++;
printf("%p...%p...%p",p,q,r);
} | | 1 | | String copy logic in one line. | NetApp | 9 | | main()
{
char * strA;
char * strB = I am OK;
memcpy( strA, strB, 6);
}
a. Runtime error.
b. I am OK
c. Compile error
d. I am O | HCL | 2 | | main()
{
char *a = "Hello ";
char *b = "World";
clrscr();
printf("%s", strcpy(a,b));
}
a. “Hello”
b. “Hello World”
c. “HelloWorld”
d. None of the above | HCL | 1 | | main()
{
int *j;
{
int i=10;
j=&i;
}
printf("%d",*j);
} | | 1 | | Sorting entire link list using selection sort and insertion
sort and calculating their time complexity | NetApp | 1 | | What is the output for the program given below
typedef enum errorType{warning, error,
exception,}error;
main()
{
error g1;
g1=1;
printf("%d",g1);
} | | 1 | | char *someFun()
{
char *temp = “string constant";
return temp;
}
int main()
{
puts(someFun());
} | | 1 | | main()
{
extern int i;
i=20;
printf("%d",sizeof(i));
} | | 1 | | main()
{
signed int bit=512, mBit;
{
mBit = ~bit;
bit = bit & ~bit ;
printf("%d %d", bit, mBit);
}
}
a. 0, 0
b. 0, 513
c. 512, 0
d. 0, -513 | HCL | 1 | | Write a routine that prints out a 2-D array in spiral order | Microsoft | 2 | | main()
{
{
unsigned int bit=256;
printf("%d", bit);
}
{
unsigned int bit=512;
printf("%d", bit);
}
}
a. 256, 256
b. 512, 512
c. 256, 512
d. Compile error | HCL | 1 | | main(int argc, char **argv)
{
printf("enter the character");
getchar();
sum(argv[1],argv[2]);
}
sum(num1,num2)
int num1,num2;
{
return num1+num2;
} | | 1 | | main()
{
unsigned int i=10;
while(i-->=0)
printf("%u ",i);
} | | 1 | | main( )
{
int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}};
printf(“%u %u %u %d \n”,a,*a,**a,***a);
printf(“%u %u %u %d \n”,a+1,*a+1,**a+1,***a+1);
} | | 1 | | void main()
{
if(~0 == (unsigned int)-1)
printf(“You can answer this if you know how values are
represented in memory”);
} | | 1 | | main()
{
int i;
clrscr();
for(i=0;i<5;i++)
{
printf("%d\n", 1L << i);
}
}
a. 5, 4, 3, 2, 1
b. 0, 1, 2, 3, 4
c. 0, 1, 2, 4, 8
d. 1, 2, 4, 8, 16 | HCL | 1 | | Printf can be implemented by using __________ list. | | 1 | | main()
{
int i=-1;
+i;
printf("i = %d, +i = %d \n",i,+i);
} | | 1 | | | | For more C Code Interview Questions Click Here |
|