| Other C Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| write a program to search for an element in a given array.
If the array was found then display its position otherwise
display appropriate message in c language | | 3 |
| How to reverse a string using a recursive function, without
swapping or using an extra memory? | Motorola | 18 |
| when will be evaluated as true/
if(x==x==x)
a) x=1;
b) x=0;
c) x=-1;
d) none | HCL | 4 |
| write a own function to compare two strings with out using
stringcomparition function? | LG-Soft | 3 |
| what will be the result of the following program ?
char *gxxx()
{
static char xxx[1024];
return xxx;
}
main()
{
char *g="string";
strcpy(gxxx(),g);
g = gxxx();
strcpy(g,"oldstring");
printf("The string is :
%s",gxxx());
}
a) The string is : string
b) The string is :Oldstring
c) Run time error/Core dump
d) Syntax error during compilation
e) None of these
| IBM | 2 |
| Write a program to generate prime factors of a given integer? | | 1 |
| Can I pass constant values to functions which accept structure
arguments? | | 2 |
| what is the difference between NULL & NUL keywords in C? | | 3 |
| Which of the following data structures is on average the
fastest for retrieving data:
1) Binary Tree
2) Hash Table
3) Stack
| | 3 |
| Please list all the unary and binary operators in C. | | 1 |
| 2. What is the function of ceil(X) defined in math.h do?
A)It returns the value rounded down to the next lower
integer
B)it returns the value rounded up to the next higher integer
C)the Next Higher Value
D)the next lower value
| Accenture | 2 |
| identify the in correct expression
a.a=b=3=4;
b.a=b=c=d=0;
float a=int b=3.5;
d.int a;
float b;
a=b=3.5;
| TCS | 5 |
| Write a c code segment using a for loop that calculates and
prints the sum of the even integers from 2 to 30, inclusive? | | 2 |
| #define f(x)
main()
{
printf("\n%d",f(2+2));
} | | 3 |
| 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 | 3 |
| Given an array of characters, how would you reverse it? How
would you reverse it without using indexing in the array? | | 1 |
| In scanf h is used for | BFL | 2 |
| Which of the Following is not defined in string.h?
A)strspn()
B)strerror()
C)memchr()
D)strod()
| Accenture | 1 |
| Would you rather wait for the results of a quicksort, a
linear search, or a bubble sort on a 200000 element array?
1) Quicksort
2) Linear Search
3) Bubble Sort
| | 2 |
| main()
{
float a=3.2e40;
printf("%d",a);
} | Satyam | 5 |
| |
| For more C Interview Questions Click Here |