| Other C Code Interview Questions |
| | | Question | Asked @ | Answers | | | | union u
{
union u
{
int i;
int j;
}a[10];
int b[10];
}u;
main()
{
printf("\n%d", sizeof(u));
printf(" %d", sizeof(u.a));
// printf("%d", sizeof(u.a[4].i));
}
a. 4, 4, 4
b. 40, 4, 4
c. 1, 100, 1
d. 40 400 4 | HCL | 1 | | main()
{
clrscr();
}
clrscr(); | | 1 | | program to find the roots of a quadratic equation | HP | 3 | | main()
{
signed int bit=512, i=5;
for(;i;i--)
{
printf("%d\n", bit = (bit >> (i - (i -1))));
}
}
a. 512, 256, 128, 64, 32
b. 256, 128, 64, 32, 16
c. 128, 64, 32, 16, 8
d. 64, 32, 16, 8, 4 | HCL | 1 | | main()
{
signed int bit=512, i=5;
for(;i;i--)
{
printf("%d\n", bit >> (i - (i -1)));
}
}
a. 512, 256, 0, 0, 0
b. 256, 256, 0, 0, 0
c. 512, 512, 512, 512, 512
d. 256, 256, 256, 256, 256 | HCL | 1 | | main()
{
int i;
clrscr();
for(i=0;i<5;i++)
{
printf("%d\n", 1L << i);
}
}
a. 5, 4, 3, 2, 1
b. 0, 1, 2, 3, 4
c. 0, 1, 2, 4, 8
d. 1, 2, 4, 8, 16 | HCL | 1 | | Extend the sutherland-hodgman clipping algorithm to clip
three-dimensional planes against a regular paralleiepiped | IBM | 1 | | void main()
{
static int i=i++, j=j++, k=k++;
printf(i = %d j = %d k = %d, i, j, k);
} | | 1 | | main()
{
if (!(1&&0))
{
printf("OK I am done.");
}
else
{
printf("OK I am gone.");
}
}
a. OK I am done
b. OK I am gone
c. compile error
d. none of the above | HCL | 1 | | main()
{
char str1[] = {s,o,m,e};
char str2[] = {s,o,m,e,\0};
while (strcmp(str1,str2))
printf(Strings are not equal\n);
} | | 1 | | void main()
{
static int i;
while(i<=10)
(i>2)?i++:i--;
printf(%d, i);
} | | 1 | | main()
{
int c=- -2;
printf("c=%d",c);
} | | 1 | | #define FALSE -1
#define TRUE 1
#define NULL 0
main() {
if(NULL)
puts("NULL");
else if(FALSE)
puts("TRUE");
else
puts("FALSE");
} | | 1 | | Give a very good method to count the number of ones in a 32
bit number.
(caution: looping through testing each bit is not a solution) | Microsoft | 5 | | How to reverse a String without using C functions ? | Wipro | 14 | | How to read a directory in a C program?
| | 4 | | 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 program that find and print how many odd numbers in
a binary tree | | 1 | | #include"math.h"
void main()
{
printf("Hi everybody");
}
if <stdio.h> will be included then this program will must
compile, but as we know that when we include a header file
in "" then any system defined function find its defination
from all the directrives. So is this code of segment will
compile? If no then why? | | 2 | | #include <stdio.h>
main()
{
char * str = "hello";
char * ptr = str;
char least = 127;
while (*ptr++)
least = (*ptr<least ) ?*ptr :least;
printf("%d",least);
} | | 1 | | | | For more C Code Interview Questions Click Here |
|