| Other C Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| difference of two no's with out using - operator | | 4 |
| What will be result of the following program?
void myalloc(char *x, int n)
{
x= (char *)malloc(n*sizeof(char));
memset(x,\0,n*sizeof(char));
}
main()
{
char *g="String";
myalloc(g,20);
strcpy(g,"Oldstring");
printf("The string is %s",g);
}
a) The string is : String
b) Run time error/Core dump
c) The string is : Oldstring
d) Syntax error during compilation
e) None of these
| IBM | 2 |
| void main()
{
int i=5;
printf("%d",i+++++i);
}
| ME | 12 |
| Which is not valid in C?
1) class aClass{public:int x;}
2) /* A comment */
3) char x=12;
| | 4 |
| what is the advantage of software development | | 1 |
| the factorial of non-negative integer n is written n! and
is defined as follows:
n!=n*(n-1)*(n-2)........1(for values of n greater than or
equal to 1 and
n!=1(for n=0)
Perform the following
1.write a c program that reads a non-negative integer and
computes and prints its factorial.
2. write a C program that estimates the value of the
mathematical constant e by using the formula:
e=1+1/!+1/2!+1/3!+....
3. write a c program the computes the value ex by using the
formula
ex=1+x/1!+xsquare/2!+xcube/3!+....
| Ignou | 1 |
| pgm to reverse string using arrays i.e god is love becomes
love is god)
(assumption:only space is used for seperation of words)
no addtional memory used.i.e no temporary arrays can used. | Persistent | 2 |
| fun(int x)
{
if(x > 0)
fun(x/2);
printf("%d", x);
}
above function is called as:
fun(10);
what will it print?
} | NDS | 12 |
| what is the differnce between AF_INET and PF_INET? | Wipro | 1 |
| what is difference between ++(*p) and (*p)++ | Accenture | 12 |
| what is the function of void main()? | | 4 |
| fn f(x)
{ if(x<=0)
return;
else f(x-1)+x;
}
| HCL | 3 |
| without a terminator how can we print a message in a printf
() function. | NIIT | 3 |
| In scanf h is used for | BFL | 2 |
| How would you print out the data in a binary tree, level by
level, starting at the top? | | 3 |
| How the processor registers can be used in C ? | HP | 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 use of using linked list and array? | Infosys | 8 |
| how many error occurs in C language ? | Wipro | 9 |
| What is memmove? | Oracle | 1 |
| |
| For more C Interview Questions Click Here |