| Other C Interview Questions |
| |
| Question |
Asked @ |
Answers |
| |
| Determine the code below, tell me exactly how many times is
the operation sum++ performed ?
for ( i = 0; i < 100; i++ )
for ( j = 100; j > 100 - i; j--)
sum++; |
ITCO | 5 |
| 18)struct base {int a,b;
base();
int virtual function1();
}
struct derv1:base{
int b,c,d;
derv1()
int virtual function1();
}
struct derv2 : base
{int a,e;
}
base::base()
{
a=2;b=3;
}
derv1::derv1(){
b=5;
c=10;d=11;}
base::function1()
{return(100);
}
derv1::function1()
{
return(200);
}
main()
base ba;
derv1 d1,d2;
printf("%d %d",d1.a,d1.b)
o/p is
a)a=2;b=3;
b)a=3; b=2;
c)a=5; b=10;
d)none
19) for the above program answer the following q's
main()
base da;
derv1 d1;
derv2 d2;
printf("%d %d %d",da.function1(),d1.function1(),d2.function1
());
o/p is
a)100,200,200;
b)200,100,200;
c)200,200,100;
d)none
20)struct {
int x;
int y;
}abc;
you can not access x by the following
1)abc-->x;
2)abc[0]-->x;
abc.x;
(abc)-->x;
a)1,2,3
b)2&3
c)1&2
d)1,3,4
|
| 1 |
| main()
{
int i=5;
printf("%d%d%d%d",i++,i--,i);
} |
| 10 |
| Which of the Following is not defined in string.h?
A)strspn()
B)strerror()
C)memchr()
D)strod()
|
Accenture | 2 |
| How will you allocate memory to a double pointer ? |
| 2 |
| for example user gives input as " 20 or 20.0 or rs 20.0 or
20.00 or rs20 and so .. on " and the output should be
stored as " rs.20.00 " in a variable |
| 2 |
| Tell about strtok & strstr functions |
Motorola | 2 |
| write a programe returns the number of times the character
appears in the string |
| 2 |
| In C program, at end of the program we will give as "return 0"
and "return 1", what they indicate? Is it mandatory to specify
them? |
| 5 |
| What is indirect recursion? give an example? |
| 4 |
| how to estimate the disk access time?
e.g. the time between read one byte and another byte in the
disk. |
Google | 3 |
| What is the difference between declaring a variable by
constant keyword and #define ing that variable? |
| 1 |
| |
| For more C Interview Questions Click Here |