| Other C Code Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| main()
{
int i=-1;
-i;
printf("i = %d, -i = %d \n",i,-i);
} | | 1 |
| #include<stdio.h>
void fun(int);
int main()
{
int a;
a=3;
fun(a);
printf("\n");
return 0;
}
void fun(int i)
{
if(n>0)
{
fun(--n);
printf("%d",n);
fun(--n);
}
} the answer is 0 1 2 0..someone explain how the code is
executed..? | Wipro | 1 |
| main()
{
int i=0;
while(+(+i--)!=0)
i-=i++;
printf("%d",i);
} | | 1 |
| How to swap two variables, without using third variable ? | HCL | 47 |
| #include <stdio.h>
main()
{
char * str = "hello";
char * ptr = str;
char least = 127;
while (*ptr++)
least = (*ptr<least ) ?*ptr :least;
printf("%d",least);
} | | 1 |
| main()
{
int i, j;
scanf("%d %d"+scanf("%d %d", &i, &j));
printf("%d %d", i, j);
}
a. Runtime error.
b. 0, 0
c. Compile error
d. the first two values entered by the user | HCL | 1 |
| #include<stdio.h>
main()
{
const int i=4;
float j;
j = ++i;
printf("%d %f", i,++j);
} | | 1 |
| how to return a multiple value from a function? | Wipro | 5 |
| What is the problem with the following code segment?
while ((fgets(receiving array,50,file_ptr)) != EOF)
; | | 1 |
| Given an array of characters which form a sentence of words,
give an efficient algorithm to reverse the order of the words
(not characters) in it. | Wipro | 2 |
| Write a function to find the depth of a binary tree. | Adobe | 8 |
| Derive expression for converting RGB color parameters to
HSV values | | 1 |
| to remove the repeated cahracter from the given caracter
array.
i.e..,
if the input is SSAD
output should of
SAD | Synergy | 6 |
| #include<stdio.h>
main()
{
FILE *ptr;
char i;
ptr=fopen("zzz.c","r");
while((i=fgetch(ptr))!=EOF)
printf("%c",i);
} | | 1 |
| Declare an array of N pointers to functions returning
pointers to functions returning pointers to characters? | | 1 |
| Give a oneline C expression to test whether a number is a
power of 2?
| Motorola | 16 |
| main()
{
char i=0;
for(;i>=0;i++) ;
printf("%d\n",i);
} | | 1 |
| write a program in c to merge two array | | 1 |
| main()
{
unsigned int i=65000;
while(i++!=0);
printf("%d",i);
} | | 1 |
| main()
{
char *p = “ayqm”;
char c;
c = ++*p++;
printf(“%c”,c);
} | | 1 |
| |
| For more C Code Interview Questions Click Here |