| Other C Code Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| void main()
{
static int i;
while(i<=10)
(i>2)?i++:i--;
printf(“%d”, i);
} | | 1 |
| How to return multiple values from a function?
| | 4 |
| #include <stdio.h>
#define a 10
main()
{
#define a 50
printf("%d",a);
} | | 1 |
| int i,j;
for(i=0;i<=10;i++)
{
j+=5;
assert(i<5);
} | | 1 |
| main()
{
int i=0;
while(+(+i--)!=0)
i-=i++;
printf("%d",i);
} | | 1 |
| Printf can be implemented by using __________ list. | | 1 |
| main()
{
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 |
| # include <stdio.h>
int one_d[]={1,2,3};
main()
{
int *ptr;
ptr=one_d;
ptr+=3;
printf("%d",*ptr);
} | | 1 |
| 1. const char *a;
2. char* const a;
3. char const *a;
-Differentiate the above declarations. | | 2 |
| #define clrscr() 100
main()
{
clrscr();
printf("%d\n",clrscr());
} | | 1 |
| main()
{
int i=10;
i=!i>14;
Printf ("i=%d",i);
} | | 1 |
| void main()
{
char far *farther,*farthest;
printf("%d..%d",sizeof(farther),sizeof(farthest));
} | | 1 |
| main()
{
unsigned int i=65000;
while(i++!=0);
printf("%d",i);
} | | 1 |
| Is the following code legal?
void main()
{
typedef struct a aType;
aType someVariable;
struct a
{
int x;
aType *b;
};
} | | 1 |
| main()
{
int i;
clrscr();
for(i=0;i<5;i++)
{
printf("%d\n", 1L << i);
}
}
a. 5, 4, 3, 2, 1
b. 0, 1, 2, 3, 4
c. 0, 1, 2, 4, 8
d. 1, 2, 4, 8, 16 | HCL | 1 |
| Program to Delete an element from a doubly linked list.
| Infosys | 4 |
| void main()
{
int i=5;
printf("%d",i++ + ++i);
} | | 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 |
| How to swap two variables, without using third variable ? | HCL | 46 |
| Given n nodes. Find the number of different structural
binary trees that can be formed using the nodes. | Aricent | 7 |
| |
| For more C Code Interview Questions Click Here |