| Other C Code Interview Questions |
| | | Question | Asked @ | Answers | | | | main()
{
extern out;
printf("%d", out);
}
int out=100; | | 1 | | How to access command-line arguments? | | 4 | | What is the problem with the following code segment?
while ((fgets(receiving array,50,file_ptr)) != EOF)
; | | 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()
{
char a[4]="HELLO";
printf("%s",a);
} | | 1 | | struct point
{
int x;
int y;
};
struct point origin,*pp;
main()
{
pp=&origin;
printf("origin is(%d%d)\n",(*pp).x,(*pp).y);
printf("origin is (%d%d)\n",pp->x,pp->y);
} | | 1 | | main()
{
extern int i;
i=20;
printf("%d",sizeof(i));
} | | 1 | | main()
{
main();
} | | 1 | | main( )
{
static int a[ ] = {0,1,2,3,4};
int *p[ ] = {a,a+1,a+2,a+3,a+4};
int **ptr = p;
ptr++;
printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
*ptr++;
printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
*++ptr;
printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
++*ptr;
printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
} | | 1 | | How we print the table of 3 using for loop in c
programing? | | 3 | | write a program to count the number the same
(letter/character foreg: 's') in a given sentence. | | 1 | | int i=10;
main()
{
extern int i;
{
int i=20;
{
const volatile unsigned i=30;
printf("%d",i);
}
printf("%d",i);
}
printf("%d",i);
} | | 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 | | #define f(g,g2) g##g2
main()
{
int var12=100;
printf("%d",f(var,12));
} | | 1 | | What are segment and offset addresses? | Infosys | 1 | | main()
{
int i=10,j=20;
j = i, j?(i,j)?i:j:j;
printf("%d %d",i,j);
} | | 1 | | void main()
{
int const * p=5;
printf("%d",++(*p));
} | | 1 | | main()
{
while (strcmp(“some”,”some\0”))
printf(“Strings are not equal\n”);
} | | 1 | | main()
{
int i =10, j = 20;
clrscr();
printf("%d, %d, ", j-- , --i);
printf("%d, %d ", j++ , ++i);
}
a. 20, 10, 20, 10
b. 20, 9, 20, 10
c. 20, 9, 19, 10
d. 19, 9, 20, 10 | HCL | 1 | | main()
{
char *a = "Hello ";
char *b = "World";
clrscr();
printf("%s", strcpy(a,b));
}
a. “Hello”
b. “Hello World”
c. “HelloWorld”
d. None of the above | HCL | 1 | | | | For more C Code Interview Questions Click Here |
|