| Other C Code Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| main()
{
printf("%d, %d", sizeof('c'), sizeof(100));
}
a. 2, 2
b. 2, 100
c. 4, 100
d. 4, 4 | HCL | 3 |
| What is the output for the program given below
typedef enum errorType{warning, error,
exception,}error;
main()
{
error g1;
g1=1;
printf("%d",g1);
} | | 1 |
| Write a program that find and print how many odd numbers in
a binary tree | | 1 |
| What is the main difference between STRUCTURE and UNION? | | 6 |
| What is the problem with the following code segment?
while ((fgets(receiving array,50,file_ptr)) != EOF)
; | | 1 |
| How will you print % character?
a. printf(“\%”)
b. printf(“\\%”)
c. printf(“%%”)
d. printf(“\%%”) | HCL | 1 |
| To Write a C program to remove the repeated characters in
the entered expression or in entered characters(i.e)
removing duplicates. | Synergy | 2 |
| void main()
{
int i;
char a[]="\0";
if(printf("%s\n",a))
printf("Ok here \n");
else
printf("Forget it\n");
} | | 1 |
| void main()
{
unsigned giveit=-1;
int gotit;
printf("%u ",++giveit);
printf("%u \n",gotit=--giveit);
} | | 1 |
| main()
{
int i=400,j=300;
printf("%d..%d");
} | | 1 |
| void main()
{
char a[]="12345\0";
int i=strlen(a);
printf("here in 3 %d\n",++i);
} | | 1 |
| void main()
{
void *v;
int integer=2;
int *i=&integer;
v=i;
printf("%d",(int*)*v);
} | | 1 |
| What is the hidden bug with the following statement?
assert(val++ != 0); | | 1 |
| Extend the sutherland-hodgman clipping algorithm to clip
three-dimensional planes against a regular paralleiepiped | IBM | 1 |
| How to return multiple values from a function?
| | 4 |
| Which version do you prefer of the following two,
1) printf(“%s”,str); // or the more curt one
2) printf(str); | | 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 |
| enum colors {BLACK,BLUE,GREEN}
main()
{
printf("%d..%d..%d",BLACK,BLUE,GREEN);
return(1);
} | | 1 |
| how to return a multiple value from a function? | Wipro | 5 |
| Is the following statement a declaration/definition. Find
what does it mean?
int (*x)[10]; | | 1 |
| |
| For more C Code Interview Questions Click Here |