C Interview Questions
- 0of 0 votes
Answerswhere is volatile variables stored in memory layout ?
- sumeet4linux April 16, 2010| Report Duplicate | Flag | PURGE
Qualcomm Software Engineer / Developer C - 0of 0 votes
AnswersHow can you lock a portion of a file and how to use it ?
- ak April 08, 2010| Report Duplicate | Flag | PURGE
C C++ - 0of 0 votes
AnswersYou have a string which stores a number with commas. For example, a string that has the number 345,000,000. How will you manipulate this string in-place [without using any extra memory] so that the output is the original string without any commas in O(n) ?
- Bandicoot April 02, 2010| Report Duplicate | Flag | PURGE
Bloomberg LP Financial Software Developer Algorithm Arrays C Coding String Manipulation - 0of 0 votes
Answerswhat is difference between SystemC and C.
- Anonymous March 24, 2010| Report Duplicate | Flag | PURGE
C - 0of 0 votes
AnswersGiven a node in an SSL, delete it..
- dnivra March 23, 2010| Report Duplicate | Flag | PURGE
Cisco Systems Software Engineer / Developer C - 0of 0 votes
AnswersThere are 3 files in a program.
- Bandicoot March 23, 2010
// File: foo.c
static int var;
void foo()
{
var++;
}
// end of file foo.c
// File bar.c:
static int var;
void bar()
{
var++;
}
// end of file bar.c
// file main.c
static int var;
void main()
{
foo();
bar();
printf("%d", var);
}
// end of file main.c
Question: Will the above program compile ? If so what will be the result ?| Report Duplicate | Flag | PURGE
Bloomberg LP Financial Software Developer C - 0of 0 votes
Answerswrite the prototype for strcat function in C
- foobar March 22, 2010| Report Duplicate | Flag | PURGE
Bloomberg LP Financial Software Developer C - 0of 0 votes
AnswersGiven a string which may contain one or multiple spaces in between the word characters. If there are multiple whitespaces, replace all with single whitespace.
- Roshan March 09, 2010
Constraint -
1. Do not use any extra char string or array
e.g.
char *string = "Test-String----to-be--displayed-";
The string should be replaced like
'Test-String-to-be-displayed-'
Consider '-' as whitespace.| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test C - 0of 0 votes
Answerswhat does the volatile keyword in C mean. where is it used
- dd March 06, 2010| Report Duplicate | Flag | PURGE
Qualcomm Software Engineer / Developer C - 0of 0 votes
AnswersHi all, I had MS interview today on campus. He asked me to implement a function readone().and also gave me an input file with lot of lines. This function readone() should read the file(just one line from the file) whenever it is called.for example, if readone() is called first time - it ll read first line, if readone() is called second time, it will read second line. Though the qn seems simple, I baffled there!:(
- Anonymous March 02, 2010| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer C C++ Coding - 0of 0 votes
AnswersGiven 5 prices of a share for 5 days i.e. from Monday-Friday share prices for a perticular share are $1, $4, $5, $2, $3. Find the max profit you could make in a given week. You are not allowd to do multiple trading in a day and its not mandatory to do trading on each day. Write a C code for this.
- guest March 02, 2010| Report Duplicate | Flag | PURGE
Bloomberg LP Financial Software Developer C - 0of 0 votes
Answersint *p;
- most unluckiest February 15, 2010
char *q;
printf("%d",p+1-p); --->1st
printf("%d",q+1-q); --->2nd
Lets say p is pointing to the variable address in 1000 and q is pointing to the char variable in the address 2000.
Then he asked me to explain those printf statements...and the next question is why the 1st printf is not printing 4 but it prints 1.| Report Duplicate | Flag | PURGE
Qualcomm Software Engineer / Developer C - 0of 0 votes
AnswersHow to write our own rand() function ?
- Rajesh Manem February 12, 2010| Report Duplicate | Flag | PURGE
Software Engineer / Developer C - 0of 0 votes
AnswersWhat is a reentrant function? how do you make a function non-reentrant?
- most unluckiest February 09, 2010| Report Duplicate | Flag | PURGE
Qualcomm Software Engineer / Developer C - 0of 0 votes
Answers#include<stdio.h>
- Rats February 03, 2010
int main()
{
int a=10;
switch(a)
{
case '1':
printf("ONE\n");
break;
case '2':
printf("TWO\n");
break;
defa1ut:
printf("NONE\n");
}
return 0;
}
What will be the output and why ??| Report Duplicate | Flag | PURGE
Software Engineer / Developer C - 0of 0 votes
AnswersIn a clock, calculate the angle between hour and minute handle
- myanything February 02, 2010| Report Duplicate | Flag | PURGE
Amazon EFI Software Engineer / Developer Math & Computation C - 0of 0 votes
Answers#include<stdio.h>
- Anonymous January 25, 2010
#define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0]))
int array[] = {23,34,12,17,204,99,16};
int main()
{
int d;
for(d=-1;d <= (TOTAL_ELEMENTS-2);d++)
printf("%d\n",array[d+1]);
return 0;
}
what is wrong ??| Report Duplicate | Flag | PURGE
Software Engineer / Developer C - 0of 0 votes
AnswersHow will you dynamically allocate 2D array? Use 2 malloc and then do the same thing using only 1 malloc.
- spsneo January 25, 2010| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer C - 0of 0 votes
AnswersWrite a code to clear nth bit in an integer.
- gsl January 22, 2010| Report Duplicate | Flag | PURGE
Qualcomm C - 0of 0 votes
Answersscope of x,y,p,q and where respective variables are stored.
- gsl January 22, 2010
static int x;
int y;
void foo()
{
static int p;
int q;
}| Report Duplicate | Flag | PURGE
Qualcomm C - 0of 0 votes
AnswersWhat is the use of volatile keyword in C?Gave a standard answer,asked to elaborate more.Don't know how.
- gsl January 22, 2010| Report Duplicate | Flag | PURGE
Qualcomm C - 0of 0 votes
AnswersImplement Memcpy
- AM January 15, 2010| Report Duplicate | Flag | PURGE
Cisco Systems Software Engineer / Developer C - 0of 0 votes
Answersimplementation of malloc()
- gnu January 14, 2010| Report Duplicate | Flag | PURGE
VMWare Inc Software Engineer / Developer C - 0of 0 votes
Answershow free() knows, how much memory it has to deallocate?
- gnu January 14, 2010| Report Duplicate | Flag | PURGE
VMWare Inc Software Engineer / Developer C - 0of 0 votes
AnswersWrite C Code for Fibonacci Series. Write both the Iterative and Recursive implementation.
- CPPDEVELOPER January 11, 2010| Report Duplicate | Flag | PURGE
Bloomberg LP Software Engineer / Developer C - 1of 1 vote
Answers50 char *b, q, *r;
- Thomas January 03, 2010
200 b = getbuf ();
201 q = *b;
212 R = anotherfunction (b);
213-2003 /* we want to use 'q' and 'r' here */
2000 char * getbuf ()
2001 {
2002 char buff [8];
2003-2050 /* unspecified buff defined here */
2051 return (char*) buff;
2052 }
1. What will be in variable 'q' after line 201 is executed? Under
what conditions might this not be so?
2. Is there an alternative, but equivalent, way to write line
2000? If so, what is it?
3. Is getbuf() a reasonable function?
4. Will getbuf() execute at all?
5. Please comment on line 2051.
6. Is getbuf() good practice, and why?
7. What line not given should be provided for compilation?
8. How, exactly, could one get a second 'char*' to use back from
this function? Be specific in terms of the exact syntax needed. (That
is, provide code.) Another way to state this question is how can this
function be modified to return a 'char*' (that is, it maintains the
same return type) from the function, and an additional 'char *' value
in one function call. Please make sure that your answer will work even
if the size of the char * desired is not known in the outside calling
function. Avoid (do no use) C++ syntax. Include statement in called and
calling functions. Use food programming practice.| Report Duplicate | Flag | PURGE
Software Engineer / Developer C - 0of 0 votes
AnswersWhat is the difference between functors, call back functions and function pointers?
- CK December 09, 2009| Report Duplicate | Flag | PURGE
Yahoo Software Engineer / Developer C C++