| Other C Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| #define MAX(x,y) (x) > (y) ? (x) : (y)
main()
{
int i = 10, j = 5, k = 0;
k = MAX(i++, ++j);
printf("%d %d %d", i,j,k);
}
what will the values of i , j and k?
}
| NDS | 9 |
| value = 0xabcd;
for (loop = 1; (value >> 1) & 1 | loop & 1; loop++) {
foo();
if (loop & 1)
value >>= 1;
}
how many times is foo() executed? | Google | 5 |
| struct ptr
{
int a;
char b;
int *p;
}abc;
what is d sizeof structure without using "sizeof" operator?? | Verifone | 8 |
| 4.A function 'q' that accepts a pointer to a character as
argument and returns a pointer to an array of integer can
be declared as:
A)int (*q(char*)) []
B)int *q(char*) []
C)int(*q)(char*) []
D)None of the Above
| Accenture | 4 |
| main is a predefined or user define function
if user defined why?
if predefined whay? | TCS | 2 |
| When you call malloc() to allocate memory for a local
pointer, do you have to explicitly free() it? | | 2 |
| Write a program or provide a pseudo code to flip the 2nd bit
of the 32 bit number ! (Phone Screen) | NetApp | 1 |
| main()
{int a=200*200/100;
printf("%d",a);
} | TCS | 7 |
| 52.write a “Hello World” program in “c” without using a
semicolon?
53.Give a method to count the number of ones in a 32 bit number?
54.write a program that print itself even if the source file
is deleted?
55.Given an unsigned integer, find if the number is power of 2? | | 5 |
| What does extern mean in a function declaration? | | 2 |
| Which of the following about automatic variables within a
function is correct ?
a.its type must be declared before using the variable
b.they are local
c.they are not initialised to zero
d.they are global.
| TCS | 3 |
| write the function int countchtr(char string[],int
ch);which returns the number of timesthe character ch
appears in the string. for example the call countchtr("she
lives in Newyork",'e') would return 3. | | 4 |
| What is the value of y in the following code?
x=7;y=0;
if(x=6)
y=7;
else
y=1;
| TCS | 10 |
| Write a program to accept a character & display its
corrosponding ASCII value & vice versa? | | 4 |
| What does a run-time "null pointer assignment" error mean? | | 2 |
| write the program for maximum of the following numbers?
122,198,290,71,143,325,98 | | 4 |
| Describe advantages and disadvantages of the various stock
sorting algorithms | Microsoft | 1 |
| What is a class? | | 2 |
| WRITE A PROGRAM IN C TO MULTIPLY TWO 2-D ARRAYS | | 4 |
| a=0;
while(a<5)
printf("%d\n",a++);
how many times does the loop occurs?
a.infinite
b.5
c.4
d.6
| TCS | 5 |
| |
| For more C Interview Questions Click Here |