C Interview Questions
- 0of 0 votes
Answersint main() { int i=10; { int i=100; printf("%d", i); } }
1.what is the output ?
- siva.sai.2020 February 08, 2011
2. what signifies "{" "}" in above code .
"{" "}" will it create new "Activation Record" ( or Frame) in Stack ?| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer C - 0of 0 votes
Answers<round 3>
11. difference between Inline and macro functions.
sub question :
1) what happens if you apply inline on recursive function.
2) is there any Recursive Macro function ?
e.g#define SUM(x, y) do{ SUM(x,y); }while(0);
is there any error ?
- siva.sai.2020 February 08, 2011| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer C - 0of 0 votes
Answers<round 3>
- siva.sai.2020 February 08, 2011
10. differences between
char *str = "SIVA" and char str1[]="SIVA"
sub questions:
1) where string literal i.e "SIVA" will be stored ( heap , stack, data or code segments) in above both cases.
2) char *str = "SIVA";
str[0] = 'f' ;
any error ? compile time error or run time error ?
3) char *p = (char *) str;
p[0] = 'f' ;
any error ? compile time error or run time error ?| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer C - 0of 0 votes
AnswersMerge 2 sorted linked lists into one
- libran January 30, 2011| Report Duplicate | Flag | PURGE
Microsoft C - 0of 0 votes
AnswersWhat is the difference between malloc () and calloc ()?
- codyboy January 05, 2011| Report Duplicate | Flag | PURGE
Bloomberg LP Financial Software Developer C - 0of 0 votes
Answerssizeof(void)?
- Anonymous December 18, 2010| Report Duplicate | Flag | PURGE
One97 Software Engineer / Developer C - 0of 0 votes
AnswersDefine static, virtual destructor?
- Leave it December 03, 2010| Report Duplicate | Flag | PURGE
Apple Software Engineer / Developer C - 0of 0 votes
AnswersQuestion asked in microsoft written test :
- Anonymous November 22, 2010
Write a function which finds a substring in a string and replaces all such occurances with another string. Prototype of the function :
char* FindReplace(char* src, char* find, char* replace);| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test C - 0of 0 votes
Answerswrite a function for ftoa..similar to itoa..
- coder November 04, 2010| Report Duplicate | Flag | PURGE
Amazon Developer Program Engineer C - 0of 0 votes
Answerswhat is the output of
- narendra.gov October 31, 2010
for(;0;)
printf("\n guess");
and why?| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Brain Teasers C Coding Debugging Algorithm - 0of 0 votes
AnswerExplain the memory alignment for advancing an short array pointer cast to a void
- Anonymous October 28, 2010| Report Duplicate | Flag | PURGE
C - 0of 0 votes
AnswersHow will you delete duplicate odd numbers from a linked list? (delete only duplicates, keep one copy, list is not sorted) Interviewer was expecting O(n) answer. He didn't say anything clear about the extra space.
- Anonymous October 27, 2010| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm C Data Structures - 0of 0 votes
AnswersFind the width of a tree pointed by head
- vinay October 25, 2010| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm C Data Structures - 0of 0 votes
Answersstruct A
- Anonymous October 22, 2010
{
char c;
int i;
};
what is the size of structure? and why? And how to make compiler to allocate exact 5 bytes to the structure object?| Report Duplicate | Flag | PURGE
C Data Structures - 0of 0 votes
AnswersCompare pangrams with string and find missing letters.
- xyzz October 22, 2010| Report Duplicate | Flag | PURGE
Two Sigma Software Engineer / Developer C - 0of 0 votes
AnswersProvide animation of particles in string format.
- xyzz October 22, 2010| Report Duplicate | Flag | PURGE
Two Sigma Software Engineer / Developer C - 0of 0 votes
AnswerHow to do conditional compilation of a c program in unix
- Anonymous October 17, 2010| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer C - 0of 0 votes
Answersdouble i;
- guest October 09, 2010
main()
{
(int)(float)(char) i1;
i1 i;
printf("\n%d",sizeof(i));
}
This returns 8. How?| Report Duplicate | Flag | PURGE
Software Engineer / Developer C - 0of 0 votes
AnswersWhich one of the following function types CANNOT be overloaded?
- akshat October 03, 2010
1. The constructor function of a structure
2. The constructor function of a class
3. The destructor function of a class
4. Any constant method of a class
5. Any static method of a class”
There can be multiple answers ..| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer / Developer C - 0of 0 votes
Answersvoid func( int *p) { // Add code to print MEMORY SIZE which is pointed by pointer P. } int main() { int *p = (int *) malloc (10); f(p); }
How can we find MEMORY SIZE from memory pointer P in func() ?
- FIGHTER October 02, 2010| Report Duplicate | Flag | PURGE
NetApp Software Engineer / Developer C - 0of 0 votes
AnswersHi,
- Srivhdya September 29, 2010
I was asked to write a program to convert decimal to binary without using standard header or library function. sort of embedded situation i guess.| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer C - 0of 0 votes
AnswersInsert a node each at the begining and at the end of the linked list with same time complexity for both of them.
- Dilip September 28, 2010| Report Duplicate | Flag | PURGE
Mindtree Wireless India Software Engineer / Developer C - 0of 0 votes
Answersfunc(int* a, int b)
- jamie September 27, 2010
{
while((*a&(1 << b))==0);
}
Why is this piece of code used??| Report Duplicate | Flag | PURGE
ThoughtWorks Consultant C - 0of 0 votes
AnswersHow will you sort 1 million numbers.
- Akshat September 27, 2010
Merge sort or quick sort.
better to use c or C++. Why.| Report Duplicate | Flag | PURGE
Bloomberg LP Financial Software Developer Algorithm C C++ - 0of 0 votes
AnswersWrite a Generic Swap Macro in c
- sweetest September 15, 2010| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer C - 0of 0 votes
AnswersYou are given have a datatype, say X in C. Determine the size of the datatype,
- gullu September 12, 2010
without declaring a variable or a pointer variable of that type, and, of course without using
the sizeof operator!| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer C - 0of 0 votes
AnswersA file is given with many 0s stored in continuous way , store it in another file such that when you store try saving the space by using minimum amount of space. When you want to create the original file , you should be able to do so with the new file created. Hint was given so as to utilize the lseek function (a fuction in the Unix)
- rewis September 09, 2010
can use of sparse matrix solve the problem,pls sujjest| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer C - 0of 0 votes
AnswersWhy auto variables are not stored in heap?
- avinash September 05, 2010| Report Duplicate | Flag | PURGE
Software Engineer / Developer C - 0of 0 votes
AnswersQ. There are two linked list that are sorted. We need to merge these lists so that the obtained list is also in sorted order. You should not prepare an extra list for merging the lists.
- Anonymous August 29, 2010
The next question was to write the test cases for testing the program.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer C C++ - 0of 0 votes
Answersint main() { int i = 32242; int k = find(i); return k; } int find (int j) { if (j > 0) { j = j%10 + find(j/10); printf(" %d ", j); } return j; }
Find the output of the program?
- Anonymous August 29, 2010
Ans: 3 5 7 11 13| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer C C++