C Interview Questions
- 0of 0 votes
AnswersExplain what you understand by static in C.
- Steve August 24, 2010
Ans. I told him about static variables, static functions. Then he asked me the difference between static class vars and static defined in header file.| Report Duplicate | Flag | PURGE
Bloomberg LP Financial Software Developer C - 1of 1 vote
Answersimplement your own malloc and free for application x, which should control the heap memory usage of the application x.
- geek August 18, 2010| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer C - 1of 1 vote
Answersbool foo(int y) { int x; x = y - 1; return ((x&y) == 0) }
what is the function of doing? To check if the y is power of 2 or not
- Vishal August 03, 2010| Report Duplicate | Flag | PURGE
Qualcomm Software Engineer / Developer C - 0of 0 votes
Answersint x = -20; unsigned int y = 6; z = x + y;
what is the value of z?
- Vishal August 03, 2010| Report Duplicate | Flag | PURGE
Qualcomm Software Engineer / Developer C - 0of 0 votes
AnswersAsked what is the difference between *p and p*?
- Vishal August 03, 2010| Report Duplicate | Flag | PURGE
Qualcomm Software Engineer / Developer C - 0of 0 votes
AnswersAsked to declare a 3-dimensional array
- Vishal August 03, 2010| Report Duplicate | Flag | PURGE
Qualcomm Software Engineer / Developer C - 0of 0 votes
AnswersGiven a sentence, reverse each and every word in the sentence. I was asked to show all the validations in this prgm. I mean what if there is special character in between the two words. This is exactly what the interviewer was expecting.
- Vishal August 03, 2010| Report Duplicate | Flag | PURGE
Qualcomm Software Engineer / Developer C - 0of 0 votes
AnswersFind the size of the array ..... He continued to ask about the sizeof() operator
- Vishal August 03, 2010| Report Duplicate | Flag | PURGE
Qualcomm Software Engineer / Developer C - 0of 0 votes
Answerswrite a prgm for string copy......
- Vishal August 03, 2010| Report Duplicate | Flag | PURGE
Qualcomm Software Engineer / Developer C - 0of 0 votes
Answerswrite a code of fibonacci series.
- sonali August 03, 2010| Report Duplicate | Flag | PURGE
Epic Systems Analyst C - 1of 1 vote
Answersmemset is sometimes used to initialize data in a constructor like the example below. What is the benefit of initializing this way? Does it work in this example? Does it work in general ? Is it a good idea in general?
- Anonymous July 31, 2010
class A {
public:
A();
private:
int a;
float f;
char str[35];
long *lp;
};
A::A()
{
memset(this, 0, sizeof(*this));
}| Report Duplicate | Flag | PURGE
Interactive Brokers C Coding - 0of 0 votes
Answers
- Anonymous July 28, 2010char *xyz() { char str[32]; strcpy(str,"Hello there!"); return(str); } void main() { printf("%s",xyz()); }
| Report Duplicate | Flag | PURGE
FlexTrade Software Engineer / Developer C - 0of 0 votes
AnswersIs something wrong in the following code:
- fiddler.g July 25, 2010
int cast(int*=NULL) { return 0; }| Report Duplicate | Flag | PURGE
Software Engineer / Developer C C++ - 0of 0 votes
Answersfind the maximum of three integers using conditional operator ?
- vijay July 24, 2010| Report Duplicate | Flag | PURGE
Adobe Development Support Engineer C - 0of 0 votes
Answersfind the output of the following code:
- Anonymous July 16, 2010
//assume all header files are declared..
#define concatinate(a,b) a##b
#define same1(a) #a
#define same2(a) same1(a)
int main(){
printf("%s\n",same2(concatinate(1,2)));
printf("%s\n",same1(concatinate(1,2)));
}| Report Duplicate | Flag | PURGE
Amazon C - 0of 0 votes
Answerschar* NewLine(char* s)
- Rahul July 10, 2010
{
char buffer[1024];
l = strlen(s);
strcpy(s,buffer);
s[l]='\n'; // Add a new line character to s;
return s;
}
What is the output? What is the problem with the code if any?| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer C - 0of 0 votes
AnswersHow to find no. of times each character is repeated with less time complexity..
- naganathan June 29, 2010| Report Duplicate | Flag | PURGE
Software Engineer / Developer C - -1of 1 vote
Answersmain()
- Anonymous June 25, 2010
{
int x=40;
{
int x=20;
printf("%d",x);
}
printf("%d",x);
}
What is the output??| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer C - 0of 0 votes
Answersgiven a structure,
- pavitra June 07, 2010
struct {int a, float b, char c } x,y;
what are the 4 ways to copy contents of x into y?| Report Duplicate | Flag | PURGE
NVIDIA C - 0of 0 votes
AnswersConsider 2 integer Arrays A and B. The elements in both arrays are arranged in ascending order. One of the arrays has exact sufficient space at the end to accommodate the other. Write a function to merge both arrays in ascending order and place it in the largest array.
- Babu Hemanth Kumar May 29, 2010| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test C - 0of 0 votes
AnswersConsider a right angled Triangle ABC, right angled at B. Lenght of side A (side opposite to angle A)is given. Write a function to find the lengths of side B and side C. The function should take the inputs ( Length of side A and one acute angle either B or C in radians).
- Babu Hemanth Kumar May 29, 2010
1. Write all test cases.
2. Avoid division by zero.
3. Give different ways to implement cosine and sine functions. which one is best and why.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test C - 0of 0 votes
Answerschar * copy(char *p)
- Sambit Sarkar May 27, 2010
{
char buf[1000] = {0};
//copy algo[I skipped code here]
return buf;
}
what is bug in this code? correct it.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer C - 0of 0 votes
AnswersGiven a very very long linked list with 'n' nodes.
- Abhinav May 19, 2010
Also given a positive integer 't'>1.
Delete every 't'th node. In the resultant linked list, again delete 't'th node. Repeat this till only t-1 nodes remains.
Find the node.
Eg:
Linked list : 10->20->30->40->50->60->70
n = 7
t = 3
Phase 1:
10->20->40->50->70
Phase-2:
10->20->50->70
Phase-3:
10->20->70
Phase-4:
10->20
Simple solution with many traversals is obvious.
Is there a solution with one traversal or O(n)?
b) Similar for circular linked list.
Keep deleting 't'th node till 1 node remains.
Note here not till 't-1' nodes but till 1 node remains.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm C Coding - 0of 0 votes
Answershow to know if OS stack is growing up or down in plain C.
- guest May 13, 2010| Report Duplicate | Flag | PURGE
VMWare Inc Software Engineer / Developer C - 0of 0 votes
Answersmain() { unsigned int a = 10; int b = -19; puts((a+b)>0? "Positive":"Negative"); }
The output answer is "Positive"
- Denny May 09, 2010
Does anyone know why the sum will typecast to "unsigned int"??| Report Duplicate | Flag | PURGE
Cisco Systems Software Engineer / Developer C - 0of 0 votes
AnswersUse only single variable to print the binary format of that number....just use single variable thats all....
- Chintalapudi Rajasekhar April 20, 2010
For example if u read the value to variable N as 10 then through out the program use only variable 'N'..not use any more .....| Report Duplicate | Flag | PURGE
Amazon C