| Other C Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| When is an interface "good"?
| | 1 |
| Switch (i)
i=1;
case 1
i++;
case 2
++i;
break;
case 3
--i;
Output of i after executing the program
| Mascot | 4 |
| Write a program for deleting duplicate elements in an array | Subex | 3 |
| how to copy a string without using c function | | 5 |
| O,T,T,F,F,S,S,E,N,?,?,?,T,F,F,S,S,E,N | ADP | 9 |
| How to avoid structure padding in C? | Tech-Mahindra | 4 |
| What will be the result of the following program?
main()
{
char p[]="String";
int x=0;
if(p=="String")
{
printf("Pass 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
else
{
printf("Fail 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
}
a) Pass 1, Pass 2
b) Fail 1, Fail 2
c) Pass 1, Fail 2
d) Fail 1, Pass 2
e) syntax error during compilation
| IBM | 10 |
| There is a 100-story building and you are given two eggs.
The eggs (and the building) have an interesting property
that if you throw the egg from a floor number less than X,
it will not break. And it will always brake if the floor
number is equal or greater than X. Assuming that you can
reuse the eggs which didn't broke; you got to find X in a
minimal number of throws. Give an algorithm to find X in
minimal number of throws. | | 2 |
| enum day = { jan = 1 ,feb=4, april, may}
what is the value of may?
a)4 b)5 c)6 d)11
e)none of the above
| HCL | 2 |
| How does C++ help with the tradeoff of safety vs. usability?
| | 1 |
| 4.weight conversion:
Write a program that will read weight in pounds and convert
it into grams.print both the original weight and the
converted value.There are 454 grams in a pound.design and
carry out a test plan for this program.
| Wipro | 1 |
| In the following code segment what will be the result of the
function,
value of x , value of y
{
unsigned int x=-1;
int y;
y = ~0;
if(x == y)
printf("same");
else
printf("not same");
}
a) same, MAXINT, -1
b) not same, MAXINT, -MAXINT
c) same , MAXUNIT, -1
d) same, MAXUNIT, MAXUNIT
e) not same, MAXINT, MAXUNIT
| IBM | 1 |
| Implement a function that returns the 5th element from the
end in a singly linked list of integers in one pass. | Microsoft | 6 |
| write a 'c' program to sum the number of integer values | | 5 |
| which type of question asked from c / c++ in interview. | | 2 |
| How would you find a cycle in a linked list?
| | 2 |
| write a program for even numbers? | | 8 |
| differentiate between
const char *a;
char *const a; and
char const *a;
| HCL | 1 |
| Study the Following Points:
a.One Cannot Take the address of a Bit Field
b.bit fields cannot be arrayed
c.Bit-Fields are machine Dependant
d.Bit-fields cannot be declared as static
1. Which of the Following Statements are true w.r.t Bit-
Fields
A)a,b&c B)Only a & b C)Only c D)All
| Accenture | 2 |
| what is the difference between const volatile int i
& volatile const int j; | HCL | 2 |
| |
| For more C Interview Questions Click Here |