C Interview Questions
- 1of 1 vote
AnswersPush all the zero's of a given array to the end of the array. In place only. Ex 1,2,0,4,0,0,8 becomes 1,2,4,8,0,0,0
- CheckThisResume.com March 09, 2012 in United States| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Algorithm Arrays C Coding - 0of 0 votes
AnswersPredict the out put of the following code
#include<stdio.h> int g = 0; int Add(int i) { static int s=0; s =s+i; g=g+i; return s; } int main() { int s=0;int g=0,j; for(int i=1;i<=11;i++) { g=0;s=0; j = add(i); } printf("%d,%d",j,g); return 0; }
Predict the output
- soundararajanaravind March 06, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer C - 1of 1 vote
AnswersWrite Program to find longest common contiguous intersection from 2 lists provided to the function.
- aaz February 29, 2012 in United States for Intern
Example: list1: abcrfghwetf
list2: abrfghwwetxyab
Longest common intersection here is: fghw
Need Effecient Algorithm to implement this in Java or C, not using arrays.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm C Data Structures Ideas - 0of 0 votes
AnswersUsually first round consists of phone interviews.Try to finish your programming problems asap as the interviewer expects you to solve atleast 3-4
- rohit.athavale89 February 28, 2012 in United States for platform engineering intern| Report Duplicate | Flag | PURGE
Arista Networks C - 0of 0 votes
AnswersPerform multiplication of two bytes without * operator!!!
- rohit.athavale89 February 28, 2012 in United States for platform engineering intern
Use shift operations| Report Duplicate | Flag | PURGE
Arista Networks C - 0of 0 votes
AnswersPerform right rotate operation in C
- rohit.athavale89 February 28, 2012 in United States for platform engineering intern
unsigned char rotate(unsigned char c,int m)
Basically rotate m time the bits of char c| Report Duplicate | Flag | PURGE
Arista Networks C - 0of 0 votes
AnswersPerform right rotate operation in C
- rohit.athavale89 February 28, 2012 in United States for platform engineering intern
unsigned char rotate(unsigned char c,int m)
Basically rotate m time the bits of char c| Report Duplicate | Flag | PURGE
Arista Networks C - 0of 0 votes
AnswersUsually first round consists of phone interviews.Try to finish your programming problems asap as the interviewer expects you to solve atleast 3-4
- rohit.athavale89 February 28, 2012 in United States for platform engineering intern| Report Duplicate | Flag | PURGE
Arista Networks C - 0of 0 votes
AnswersPerform multiplication of two bytes without * operator!!!
- rohit.athavale89 February 28, 2012 in United States for platform engineering intern
Use shift operations| Report Duplicate | Flag | PURGE
Arista Networks C - 0of 0 votes
AnswersPerform right rotate operation in C
- rohit.athavale89 February 28, 2012 in United States for platform engineering intern
unsigned char rotate(unsigned char c,int m)
Basically rotate m time the bits of char c| Report Duplicate | Flag | PURGE
Arista Networks C - 0of 0 votes
AnswersPerform multiplication of two bytes without * operator!!!
- rohit.athavale89 February 28, 2012 in United States for platform engineering intern
Use shift operations| Report Duplicate | Flag | PURGE
Arista Networks C - 0of 0 votes
AnswersPerform multiplication of two bytes without * operator!!!
- rohit.athavale89 February 28, 2012 in United States for platform engineering intern
Use shift operations| Report Duplicate | Flag | PURGE
Arista Networks C - 0of 0 votes
AnswerPerform right rotate operation in C
- rohit.athavale89 February 28, 2012 in United States for platform engineering intern
unsigned char rotate(unsigned char c,int m)
Basically rotate m time the bits of char c| Report Duplicate | Flag | PURGE
Arista Networks C - 0of 0 votes
AnswersYesterday, I had an interview. There they asked me when the code optimization happens? Say,
- rasmiranjanbabu February 04, 2012 in India
int abc;//Global variable
abc = 3;
if(abc == 3)
{
printf("abc will be always 3");
}
else
{
printf("This will never executed");
}
Now the question is when the optimization happens? A... At Run time B... At compile time. I answered at compile time... To me I thought, compiler checks for volatile keyword at compile time. If the variable is not declared as volatile then it optimizes the code. But, when the compiler comes to know that, this variable is never ever going to be other than 3? If it is at run-time, then when compiler comes to know that variable is never ever going to be other than 3? Because if the variable is going to be changed after this part of the code executed. Please clear my doubt| Report Duplicate | Flag | PURGE
Continental Software Engineer / Developer C - 0of 0 votes
AnswersFind number of children at every level in n-ary tree.So root must able to identify number of children node at each level
- Arpith February 01, 2012 in United States| Report Duplicate | Flag | PURGE
C - 0of 2 votes
AnswersOut put ?
- Hmmm January 29, 2012 in United States
#define SQUARE(x) x*x
main() {
int s;
s = 64/SQUARE(4);
print ("%d", s);
}
A. 4 B. 64 C. 16 D. 128
Ans: Answer is 64 -> 64/4*4| Report Duplicate | Flag | PURGE
Adobe Testing / Quality Assurance C - 0of 0 votes
AnswersQuestion on &&, || and ++ operator. Give an expression with combination of these operators and asked to choose evaluated output.
- Hmmm January 29, 2012 in United States| Report Duplicate | Flag | PURGE
Adobe Testing / Quality Assurance C - 0of 0 votes
Answersmain() {
- Hmmm January 29, 2012 in United States
int *p;
print ("%u %u", *&p, &*p);
}
A. Address Address B. Value Address
C. Address Value D. Compilation Error| Report Duplicate | Flag | PURGE
Adobe Testing / Quality Assurance C - 0of 0 votes
AnswersOutput ?
- Hmmm January 29, 2012 in United States
main() {
int x = 2;
switch(x) {
case 1.5: print ("One");
case 2.5: print ("Two");
default: print ("Zero");
}
}
A. One B. Two C. Zero D. None| Report Duplicate | Flag | PURGE
Adobe Testing / Quality Assurance C - 0of 0 votes
AnswersWhich of the following cannot be checked in switch - case statement ?
- Hmmm January 29, 2012 in United States
A. Char B. Int C. Float D. enum
Ans: I verified, answer is C (float).| Report Duplicate | Flag | PURGE
Adobe Testing / Quality Assurance C - 0of 0 votes
AnswersCalculate how many IP addresses are available in IPv6 address.
- Hmmm January 28, 2012 in United States| Report Duplicate | Flag | PURGE
Adobe Testing / Quality Assurance C - 0of 0 votes
AnswersExplain stic key word while function declaration.
- Hmmm January 28, 2012 in United States| Report Duplicate | Flag | PURGE
Adobe Testing / Quality Assurance C - 0of 0 votes
AnswersGiven Infix expression and asked find postfix exp.
- Hmmm January 28, 2012 in United States| Report Duplicate | Flag | PURGE
Adobe Testing / Quality Assurance C - 0of 0 votes
AnswersProgram to count leaf nodes in binary tree.
- Hmmm January 28, 2012 in United States| Report Duplicate | Flag | PURGE
Adobe Testing / Quality Assurance C - 0of 0 votes
AnswersWrite program to find 2-nd largest element in an array with single loop.
- Hmmm January 28, 2012 in United States| Report Duplicate | Flag | PURGE
Adobe Testing / Quality Assurance C - 0of 0 votes
Answersout put
- Hmmm January 28, 2012 in United States
main() {
unsigned int x;
int y;
x=3;
y=-2;
if(x>y)
pf ("x is greater");
else pf("Y is greater");
}| Report Duplicate | Flag | PURGE
Adobe Testing / Quality Assurance C - 0of 0 votes
AnswersO/P of the program
- Hmmm January 28, 2012 in United States
main() {
int *inptr, temp;
temp=10;
intptr=&temp;
char *chptr;
*chptr=*intptr
print "%d %d", sizeof(inptr), sizeof(chptr);
}| Report Duplicate | Flag | PURGE
Adobe Testing / Quality Assurance C - 0of 0 votes
AnswersChar ch='Z'; ch is stored as
- Hmmm January 28, 2012 in United States
A. Z
B. ASCII value of Z
C Z with single quotes
D. A&B| Report Duplicate | Flag | PURGE
Adobe Testing / Quality Assurance C - 0of 0 votes
AnswersFind O/P
- Hmmm January 28, 2012 in United States
#define prod(x,y) x+y*x-y
main() {
print ("%d", prod(3,4));
}| Report Duplicate | Flag | PURGE
Adobe Testing / Quality Assurance C