| Other C Code Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| void main()
{
printf(“sizeof (void *) = %d \n“, sizeof( void *));
printf(“sizeof (int *) = %d \n”, sizeof(int *));
printf(“sizeof (double *) = %d \n”, sizeof(double *));
printf(“sizeof(struct unknown *) = %d \n”, sizeof(struct
unknown *));
} | | 1 |
| Print an integer using only putchar. Try doing it without
using extra storage. | | 1 |
| how can u draw a rectangle in C | Wipro | 31 |
| 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 |
| char *someFun()
{
char *temp = “string constant";
return temp;
}
int main()
{
puts(someFun());
} | | 1 |
| Write a prog to accept a given string in any order and flash
error if any of the character is different.
For example : If abc is the input then abc, bca, cba, cab
bac are acceptable, but aac or bcd are unacceptable. | Microsoft | 5 |
| main()
{
int i=-1;
-i;
printf("i = %d, -i = %d \n",i,-i);
} | | 1 |
| main()
{
extern int i;
i=20;
printf("%d",i);
} | | 1 |
| main()
{
int *j;
{
int i=10;
j=&i;
}
printf("%d",*j);
} | | 1 |
| main()
{
int i;
clrscr();
printf("%d", &i)+1;
scanf("%d", i)-1;
}
a. Runtime error.
b. Runtime error. Access violation.
c. Compile error. Illegal syntax
d. None of the above | HCL | 1 |
| #include<stdio.h>
main()
{
const int i=4;
float j;
j = ++i;
printf("%d %f", i,++j);
} | | 1 |
| Given only putchar (no sprintf, itoa, etc.) write a routine
putlong that prints out an unsigned long in decimal. | | 5 |
| main(){
unsigned int i;
for(i=1;i>-2;i--)
printf("c aptitude");
} | | 1 |
| print numbers till we want without using loops or condition
statements like specifically(for,do while, while swiches,
if etc)!
| | 7 |
| main()
{
extern int i;
i=20;
printf("%d",sizeof(i));
} | | 1 |
| Sorting entire link list using selection sort and insertion
sort and calculating their time complexity | NetApp | 1 |
| main()
{
while (strcmp(“some”,”some\0”))
printf(“Strings are not equal\n”);
} | | 1 |
| main()
{
char *a = "Hello ";
char *b = "World";
clrscr();
printf("%s", strcat(a,b));
}
a. Hello
b. Hello World
c. HelloWorld
d. None of the above | HCL | 1 |
| #define FALSE -1
#define TRUE 1
#define NULL 0
main() {
if(NULL)
puts("NULL");
else if(FALSE)
puts("TRUE");
else
puts("FALSE");
} | | 1 |
| void ( * abc( int, void ( *def) () ) ) (); | | 1 |
| |
| For more C Code Interview Questions Click Here |