| Other C Code Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| int i;
main(){
int t;
for ( t=4;scanf("%d",&i)-t;printf("%d\n",i))
printf("%d--",t--);
}
// If the inputs are 0,1,2,3 find the o/p | | 1 |
| main()
{
char string[]="Hello World";
display(string);
}
void display(char *string)
{
printf("%s",string);
} | | 1 |
| #define FALSE -1
#define TRUE 1
#define NULL 0
main() {
if(NULL)
puts("NULL");
else if(FALSE)
puts("TRUE");
else
puts("FALSE");
} | | 1 |
| main(){
int a= 0;int b = 20;char x =1;char y =10;
if(a,b,x,y)
printf("hello");
} | | 1 |
| String reverse with time complexity of n/2 with out using
temporary variable. | NetApp | 8 |
| to remove the repeated cahracter from the given caracter
array.
i.e..,
if the input is SSAD
output should of
SAD | Synergy | 6 |
| Write a function to find the depth of a binary tree. | Adobe | 8 |
| void main()
{
int i=10, j=2;
int *ip= &i, *jp = &j;
int k = *ip/*jp;
printf(“%d”,k);
} | | 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 |
| main()
{
int i=10,j=20;
j = i, j?(i,j)?i:j:j;
printf("%d %d",i,j);
} | | 1 |
| char *someFun()
{
char *temp = “string constant";
return temp;
}
int main()
{
puts(someFun());
} | | 1 |
| void pascal f(int i,int j,int k)
{
printf(“%d %d %d”,i, j, k);
}
void cdecl f(int i,int j,int k)
{
printf(“%d %d %d”,i, j, k);
}
main()
{
int i=10;
f(i++,i++,i++);
printf(" %d\n",i);
i=10;
f(i++,i++,i++);
printf(" %d",i);
} | | 1 |
| #define square(x) x*x
main()
{
int i;
i = 64/square(4);
printf("%d",i);
} | | 1 |
| What are the files which are automatically opened when a C
file is executed? | | 1 |
| main()
{
char *p;
p="%d\n";
p++;
p++;
printf(p-2,300);
} | | 1 |
| What is the subtle error in the following code segment?
void fun(int n, int arr[])
{
int *p=0;
int i=0;
while(i++<n)
p = &arr[i];
*p = 0;
} | | 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 |
| 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, n;
char *x = “girl”;
n = strlen(x);
*x = x[n];
for(i=0; i<n; ++i)
{
printf(“%s\n”,x);
x++;
}
} | | 1 |
| |
| For more C Code Interview Questions Click Here |