| Other C Code Interview Questions |
| | | Question | Asked @ | Answers | | | | int i,j;
for(i=0;i<=10;i++)
{
j+=5;
assert(i<5);
} | | 1 | | Finding a number multiplication of 8 with out using
arithmetic operator | NetApp | 8 | | main()
{
char c=' ',x,convert(z);
getc(c);
if((c>='a') && (c<='z'))
x=convert(c);
printf("%c",x);
}
convert(z)
{
return z-32;
} | | 1 | | main()
{
char a[4]="HELLO";
printf("%s",a);
} | | 1 | | main()
{
extern i;
printf("%d\n",i);
{
int i=20;
printf("%d\n",i);
}
} | | 1 | | #include<stdio.h>
main()
{
int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} };
int *p,*q;
p=&a[2][2][2];
*q=***a;
printf("%d..%d",*p,*q);
} | | 1 | | How to return multiple values from a function?
| | 4 | | char inputString[100] = {0};
To get string input from the keyboard which one of the
following is better?
1) gets(inputString)
2) fgets(inputString, sizeof(inputString), fp) | | 1 | | Finding a number which was log of base 2 | NetApp | 1 | | print numbers till we want without using loops or condition
statements like specifically(for,do while, while swiches,
if etc)!
| | 7 | | main()
{
char *p;
printf("%d %d ",sizeof(*p),sizeof(p));
} | | 1 | | #include<stdio.h>
main()
{
const int i=4;
float j;
j = ++i;
printf("%d %f", i,++j);
} | | 1 | | main()
{
static int a[3][3]={1,2,3,4,5,6,7,8,9};
int i,j;
static *p[]={a,a+1,a+2};
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%d\t%d\t%d\t%d\n",*(*(p+i)+j),
*(*(j+p)+i),*(*(i+p)+j),*(*(p+j)+i));
}
} | | 1 | | main()
{
static int var = 5;
printf("%d ",var--);
if(var)
main();
} | | 1 | | main()
{
int i=4,j=7;
j = j || i++ && printf("YOU CAN");
printf("%d %d", i, j);
} | | 1 | | #define assert(cond) if(!(cond)) \
(fprintf(stderr, "assertion failed: %s, file %s,
line %d \n",#cond,\
__FILE__,__LINE__), abort())
void main()
{
int i = 10;
if(i==0)
assert(i < 100);
else
printf("This statement becomes else for if in
assert macro");
} | | 1 | | Print an integer using only putchar. Try doing it without
using extra storage. | | 1 | | #if something == 0
int some=0;
#endif
main()
{
int thing = 0;
printf("%d %d\n", some ,thing);
} | | 1 | | main()
{
int i=-1;
-i;
printf("i = %d, -i = %d \n",i,-i);
} | | 1 | | You are given any character string. Find the number of sets
of vowels that come in the order of aeiou in the given
string. For eg., let the given string be DIPLOMATIC. The
answer returned must be "The number of sets is 2" and "The
sets are "IO and AI". Vowels that form a singleton set must
be neglected. Try to post the program executable in gcc or
g++ or in java. | | 3 | | | | For more C Code Interview Questions Click Here |
|