| Other C Code Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| #include<stdio.h>
main()
{
struct xx
{
int x=3;
char name[]="hello";
};
struct xx *s;
printf("%d",s->x);
printf("%s",s->name);
} | | 1 |
| main()
{
while (strcmp(some,some\0))
printf(Strings are not equal\n);
} | | 1 |
| write a program to count the number the same
(letter/character foreg: 's') in a given sentence. | | 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.
| Microsoft | 7 |
| #include<stdio.h>
main()
{
struct xx
{
int x=3;
char name[]="hello";
};
struct xx *s=malloc(sizeof(struct xx));
printf("%d",s->x);
printf("%s",s->name);
} | | 1 |
| #include<stdio.h>
main()
{
char s[]={'a','b','c','\n','c','\0'};
char *p,*str,*str1;
p=&s[3];
str=p;
str1=s;
printf("%d",++*p + ++*str1-32);
} | | 1 |
| 1)
int i=5;
j=i++ + i++ + i++;
printf("%d",j);This code gives the answer 15.But if we
replace the value of the j then anser is different?why?
2)int i=5;
printf("%d",i++ + i++ + i++);
this givs 18. | Infosys | 6 |
| 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 |
| main()
{
struct date;
struct student
{
char name[30];
struct date dob;
}stud;
struct date
{
int day,month,year;
};
scanf("%s%d%d%d", stud.rollno, &student.dob.day,
&student.dob.month, &student.dob.year);
} | | 1 |
| main()
{
if ((1||0) && (0||1))
{
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 *p;
p="Hello";
printf("%c\n",*&*p);
} | | 1 |
| Write a function to find the depth of a binary tree. | Adobe | 8 |
| Printf can be implemented by using __________ list. | | 1 |
| How will you print % character?
a. printf(\%)
b. printf(\\%)
c. printf(%%)
d. printf(\%%) | HCL | 1 |
| void main()
{
int const * p=5;
printf("%d",++(*p));
} | | 1 |
| void pascal f(int i,int j,int k)
{
printf(%d %d %d,i, j, k);
}
void cdecl f(int i,int j,int k)
{
printf(%d %d %d,i, j, k);
}
main()
{
int i=10;
f(i++,i++,i++);
printf(" %d\n",i);
i=10;
f(i++,i++,i++);
printf(" %d",i);
} | | 1 |
| main()
{
char *p;
p="%d\n";
p++;
p++;
printf(p-2,300);
} | | 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 |
| main()
{
show();
}
void show()
{
printf("I'm the greatest");
} | | 1 |
| String reverse with time complexity of n/2 with out using
temporary variable. | NetApp | 8 |
| |
| For more C Code Interview Questions Click Here |