C Interview Questions
- 0of 0 votes
Answerswhat happens when BSS is mapped to address 0 ?
- capricornkmu January 14, 2012 in United States| Report Duplicate | Flag | PURGE
Arista Networks Software Engineer / Developer C - 0of 0 votes
Answerswhat does a structure element a[0] mean ? what is it used for ?
- capricornkmu January 14, 2012 in United States| Report Duplicate | Flag | PURGE
Arista Networks Software Engineer / Developer C - 0of 0 votes
Answerswhat does #define a ## b mean ?
- capricornkmu January 14, 2012 in United States| Report Duplicate | Flag | PURGE
Arista Networks Software Engineer / Developer C - 0of 0 votes
Answerswhat is the size of short, int, pointer in 32 bit and 64 architectures ?
- capricornkmu January 14, 2012 in United States| Report Duplicate | Flag | PURGE
Arista Networks Software Engineer / Developer C - 0of 0 votes
Answersint a[10]; a[-1] = 20;
where is 20 stored?
- Varun November 22, 2011 in India
I said this won't compile in C under normal circumstances, he agreed, and then said let's assume C allows this, what happens?? I said maybe then previous local variable of the function will get overwritten with this value.?? Nay insights?| Report Duplicate | Flag | PURGE
Hewlett Packard C - 0of 0 votes
Answerschar *p=NULL; p = (char *) malloc(10); p++; free(p)'
What happens, is there a leak?? are 10 bytes freed??
- Varun November 22, 2011 in India
I answered yes.| Report Duplicate | Flag | PURGE
Hewlett Packard C - 0of 0 votes
Answersdefine a struct imitate ip_header as it is in a packet.
- Varun November 21, 2011 in India
actually, he wanted to see how i handle things with aren't a byte long or odd number of bytes long, like flags, ihl, version and all.
what's the best struct to define a ip_header, and tcp header.| Report Duplicate | Flag | PURGE
Samsung Software Engineer / Developer C - 0of 0 votes
Answerswrite a program to convert char *mac_address to int array.
- Varun November 21, 2011 in India
eg mac_address ="ab:cd:ef:12:34:56" to
result= [ab, cd, ef, 12,34,56]
I was able to do it, but wasn't sure, how do we store hex values in int array. i mean a[0]=a, will essentially be a[0]=10, can we store hex directly in array, so that when we do memcmp or something, we can directly compare hex against hex?
Not sure if me making sense here, still let me know, if you have suggestions.| Report Duplicate | Flag | PURGE
Samsung Software Engineer / Developer C - 0of 0 votes
AnswersWrite a MergeSort for Two Different Sorted Link List.. Emphasis on TO and SO with all Error Conditions...
- hprem991 November 07, 2011 in India for SEL| Report Duplicate | Flag | PURGE
Samsung Software Engineer / Developer C - 0of 0 votes
Answers2. write sizeof operator.
I gave the code as#define sizeof(data) {data *p=0; size = abs((p+1) - (p))
He was fine with this.
- Varun November 06, 2011 in India
But then how would we extend this to find sizeof of variables???
PS: sizeof in C that we use works well for both datastruct and variable.| Report Duplicate | Flag | PURGE
Samsung Software Engineer / Developer C - 0of 0 votes
Answerswhat is the return value of the function that returns int, but isn't returning anything explicitly.
for instance output ofint fun() { printf("\ncrap"); } void main() { printf("\n return value of fun %d", fun()); }
i said, should be exit status of 0(success) or value in EPI register, but looks like i wasn't corret. He said, this has something to do with stack unwinding??
- Varun November 06, 2011 in India
Any insights?| Report Duplicate | Flag | PURGE
Samsung Software Engineer / Developer C - 0of 0 votes
Answerswhere the local,global variables are stored heap,stack,data segment,code segment??
- sasi123789 November 02, 2011 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer C - 0of 0 votes
AnswersIn a university, students can enroll in different courses. A student may enroll for more than one course. Both students and courses can be identified by IDs given to them. Design a data structure to store students, courses, and the student-course relationships. You can use arrays, lists, stacks, trees, graphs, etc. or come up with your own data structures. Give the running times, in Big O notation, for the following operations for your data structure and justify the answers: a) Return all students in a list. b) Return all courses in a list. c) Return all courses in a list for a given student. d) Return all students in a list for a given course.
- gupta5035 October 26, 2011 in India| Report Duplicate | Flag | PURGE
Amazon Developer Program Engineer C - 0of 0 votes
AnswersWrite a function which traverse the whole tree and return the linked list of nodes.Your code should also be generic enough to work on any tree exp Binary tree, General tree etc.
- gupta5035 October 26, 2011 in India| Report Duplicate | Flag | PURGE
Amazon Developer Program Engineer C - 0of 0 votes
AnswersTwo microprocessors communicating via UART channel. One microprocessor connected to a VGA based monitor output and another mircroprocessor connected to keyboard.
- einstein.goli October 25, 2011 in United States
Sreen--uP1<--uP2---Keyboard
If you key in {A,B,C,D..} on keyboard, your monitor on other end displays {A,A,A,..}
Think in about debugging process and possible errors.| Report Duplicate | Flag | PURGE
Qualcomm Software Engineer / Developer C - 0of 0 votes
Answersmain() { int i,j; j = 10; i = j++ - j++; printf("%d %d", i,j); }
The output of this is 0, 12
- learner October 05, 2011 in India
can anyone please explain me the logic| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer C - 0of 0 votes
AnswersGiven an array arr[] of n integers, construct a Product Array prod[] (of same size) such that prod[i] is equal to the product of all the elements of arr[] except arr[i]. Solve it without division operator and in O(n).
- anmolkapoormail September 17, 2011 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm C C++ - 0of 0 votes
AnswersWrite a C function to reverse a string given just two character pointers along with the input string.
- amitlangote09 September 08, 2011 in India for Morgan Stanley| Report Duplicate | Flag | PURGE
Morgan Stanley Analyst C - 0of 0 votes
AnswersWhere does constant strings resides in memory in c-programs....e.g:
- gaurav.bhu1434 September 06, 2011 in India
char *ptr="hi Jacline";| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer C - 0of 0 votes
Answerswhat is difference between union and structure ? what is padding in the context of structures
- bm August 25, 2011| Report Duplicate | Flag | PURGE
EFI Software Engineer / Developer C - 0of 0 votes
AnswersWhat is the difference between static and global variables in C.
- bm August 25, 2011| Report Duplicate | Flag | PURGE
EFI Software Engineer / Developer C - 0of 0 votes
AnswersImplement a function that performs binary addition. Input to the function is two const strings. The function returns a string that holds the result of addition.
- Jobseeker August 24, 2011
char* binaryadd(const char* a, const char* b) { }
Eg. "1001"+"101"="1110"| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Bit Manipulation C Coding String Manipulation - 1of 1 vote
Answersresult of this:
- Anonymous August 07, 2011main() { fork(); fork(); fork(); printf("hello\n"); }
| Report Duplicate | Flag | PURGE
C Operating System Threads - 0of 0 votes
AnswersHow will you implement your own garbage collector in C.
- dheeraj2311 August 06, 2011| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer C - 0of 0 votes
Answersj=(++i)+(++i)+(++i), i=2, j=? (please exlain)
- k7 July 27, 2011| Report Duplicate | Flag | PURGE
C - 0of 0 votes
AnswersLet us assume that we store integers in strings. Right an increment function in C that will increment a given integer by one.
- Newbie July 25, 2011| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer C - 0of 0 votes
Answersint x=10;
- Anonymous July 17, 2011
x++++;
print x;
what is the result?| Report Duplicate | Flag | PURGE
Bloomberg LP C