| Other C Code Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| How do you write a program which produces its own source
code as its output?
| | 7 |
| main()
{
float i=1.5;
switch(i)
{
case 1: printf("1");
case 2: printf("2");
default : printf("0");
}
} | | 1 |
| How to return multiple values from a function?
| | 4 |
| main()
{
extern out;
printf("%d", out);
}
int out=100; | | 1 |
| main()
{
char *p;
p="Hello";
printf("%c\n",*&*p);
} | | 1 |
| What is the output for the following program
main()
{
int arr2D[3][3];
printf("%d\n", ((arr2D==* arr2D)&&(* arr2D ==
arr2D[0])) );
} | | 1 |
| How do you sort a Linked List (singly connected) in O(n)
please mail to pawan.10k@gmail.com if u can find an
anser...i m desperate to knw... | Oracle | 3 |
| main()
{
int i=0;
while(+(+i--)!=0)
i-=i++;
printf("%d",i);
} | | 1 |
| main()
{
printf("%d, %d", sizeof('c'), sizeof(100));
}
a. 2, 2
b. 2, 100
c. 4, 100
d. 4, 4 | HCL | 3 |
| Given a list of numbers ( fixed list) Now given any other
list, how can you efficiently find out if there is any
element in the second list that is an element of the
first list (fixed list) | Disney | 3 |
| main()
{
int i=10;
i=!i>14;
Printf ("i=%d",i);
} | | 1 |
| main()
{
static int var = 5;
printf("%d ",var--);
if(var)
main();
} | | 1 |
| main()
{
char s[ ]="man";
int i;
for(i=0;s[ i ];i++)
printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);
} | | 1 |
| What is the problem with the following code segment?
while ((fgets(receiving array,50,file_ptr)) != EOF)
; | | 1 |
| main()
{
int i=1;
while (i<=5)
{
printf("%d",i);
if (i>2)
goto here;
i++;
}
}
fun()
{
here:
printf("PP");
} | | 1 |
| #include<stdio.h>
main()
{
int i=1,j=2;
switch(i)
{
case 1: printf("GOOD");
break;
case j: printf("BAD");
break;
}
} | | 1 |
| main()
{
printf("\nab");
printf("\bsi");
printf("\rha");
} | | 1 |
| main()
{
char c=' ',x,convert(z);
getc(c);
if((c>='a') && (c<='z'))
x=convert(c);
printf("%c",x);
}
convert(z)
{
return z-32;
} | | 1 |
| main(int argc, char *argv[])
{
(main && argc) ? main(argc-1, NULL) : return 0;
}
a. Runtime error.
b. Compile error. Illegal syntax
c. Gets into Infinite loop
d. None of the above | HCL | 1 |
| main()
{
int a[10];
printf("%d",*a+1-*a+3);
} | | 1 |
| |
| For more C Code Interview Questions Click Here |