| Other C Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| Write an implementation of “float stringToFloat(char *str).”
The code should be simple, and not require more than the
basic operators (if, for, math operators, etc.).
• Assumptions
• Don’t worry about overflow or underflow
• Stop at the 1st invalid character and return the number
you have converted till then, if the 1st character is
invalid return 0
• Don’t worry about exponential (e.g. 1e10), instead you
should treat ‘e’ as an invalid character
• Write it like real code, e.g. do error checking
• Go though the string only once
• Examples
• “1.23” should return 1.23
• “1a” should return 1
• “a”should return 0
| Qualcomm | 5 |
| #ifdef TRUE
int I=0;
#endif
main()
{
int j=0;
printf("%d %d\n",i,j);
}
| ADITI | 2 |
| Predict the output or error(s) for the following:
25. main()
{
printf("%p",main);
}
| ME | 3 |
| What's the best way to declare and define global variables? | | 5 |
| WRITE A C PROGRAM TO FIND SECOND BIGGEST VALUE FROM THE
GIVEN VALUES | | 1 |
| what is disadvantage of pointer in C | Tech-Mahindra | 5 |
| Explain in detail how strset (string handling function
works )pls explain it with an example. | | 1 |
| what is pointer ? | Kernex-Micro-Systems | 7 |
| what are brk, sbrk?
| Oracle | 1 |
| what will happen if you free a pointer twice after
allocating memory dynamically ? | Novell | 2 |
| What's wrong with "char *p; *p = malloc(10);"? | | 5 |
| write a program to check whether a given integer is a strong
number or not?
[Hint:
145=1!+4!+5!
=1+24+120
=145]
| | 4 |
| 6. Which of the Following is not defined in string.h?
A)strspn()
B)strerror()
C)memchr()
D)strod()
| Accenture | 1 |
| What is the difference between big endian form and little
endian form? write a code to convert big endian form to
little endian and vice versa.. | Aricent | 4 |
| write a C code To reverse a linked list | Motorola | 2 |
| Write a program for deleting duplicate elements in an array | Subex | 3 |
| Given an array of characters which form a sentence of
words, give an efficient algorithm to reverse the order of
the words (not characters) in it? | | 3 |
| DIFFERNCE BETWEEN THE C++ AND C LANGUAGE? | Wipro | 1 |
| Can we access RAM?
How? Whats the range of access?
Similarly What are other hardware we can access? | | 1 |
| How we add our function in liabrary as liabrary function.
Exp. we want use our int factorical(int); function as int
pow(int,int); function working in math header file. | | 1 |
| |
| For more C Interview Questions Click Here |