C Interview Questions
- 0of 0 votes
AnswersSay a function takes a pointer and allocates it some memory. How would the function 'Prototype' be?
- NVIDIA reject March 15, 2011
Ans: void memallocate (size_ size, void ** p)
they wanted to know the double pointer declaration. He also asked why we give double pointer in functions that take Linked List head etc.| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer C Linked Lists - 1of 1 vote
AnswersCount the no. of 1's in a 32 bit no. where there are mostly 0's in the number?
- NVIDIA reject March 15, 2011
Since the no. has less 1's. Dont itereate on any mask or temp. instead, do this,
if (num > 0)
{
if(num >> 2 & 1)
count ++;
number = number >> 2;
}
this would make the number diminish each time and give a optimal solution.| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer Bit Manipulation C - 1of 1 vote
AnswersHow would you handle sleeping or blocking instructions in an Interrupt Service Routine(if unavoidable) or basically if the length of ISR is long?
- NVIDIA reject March 15, 2011
Ans: Tasklets and Workqueues. PLEASE LET ME KNOW IF THERE ARE ANY OTHER.| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer C Linux Kernel - 0of 0 votes
AnswersIs sizeof() a macro or a function? I said macro... asked why not a function (leave alone the inline advantage of a macro)
- NVIDIA reject March 15, 2011
Ans: In C there is no overloading. We send various 'Types' of parameters to sizeof. Macros dont do type checking. Hence Macros!| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer C - 0of 0 votes
AnswersWhen would you use a hash table? Specific situations were asked
- NVIDIA reject March 15, 2011| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer C Data Structures General Questions and Comments - 0of 0 votes
AnswersWrite code for Strlen(char *). Write the test cases for this code.
- NVIDIA reject March 15, 2011| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer C - 0of 0 votes
Answersif(a>5) printf("greater");
- prabhat kumar March 09, 2011
else if(a<5) printf("lesser");
else if(a==5) printf("equal");
else printf("unknown");
in the following program what a value should be passed so that it print 'unknown'| Report Duplicate | Flag | PURGE
Software Engineer / Developer C - 0of 0 votes
AnswersImplement the tokenize function in C and how do you handle multiple spaces between words ?
- Ashish Daga March 09, 2011
So if the string is "abc def (2spaces)ghi" how do you separate out words in an array ??| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer C Coding - 0of 0 votes
AnswersDifference between Java and C++?
- Krish March 09, 2011| Report Duplicate | Flag | PURGE
NetApp Bloomberg LP Financial Software Developer Software Engineer / Developer C C++ Java - 0of 0 votes
AnswersImplement anagram. Eg: eitx is anagram to xite.
- Krish March 09, 2011
ie - Same letters, order changed.| Report Duplicate | Flag | PURGE
NetApp Software Engineer / Developer C String Manipulation - 0of 0 votes
AnswersImplement strcpy function.
- Krish March 09, 2011| Report Duplicate | Flag | PURGE
NetApp Software Engineer / Developer C String Manipulation - 0of 0 votes
AnswersWhen would you use a hash table? Specific situations were asked
- SK March 09, 2011| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer C Hash Table - 0of 0 votes
AnswersWrite code for any pointer function.
- SK March 09, 2011| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer C - 0of 0 votes
AnswersDo you have any experience with graphics?
- SK March 09, 2011| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer C - 0of 0 votes
AnswersHow would sleep in a kernel?
- SK March 09, 2011| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer C Linux Kernel - 0of 0 votes
AnswersDifference between semaphore and mutex.
- SK March 09, 2011| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer C Linux Kernel - 0of 0 votes
AnswersWhat is an ISR? What are the basic operations there?
- SK March 09, 2011| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer C Linux Kernel - 0of 0 votes
AnswerVarious locking mechanisms
- SK March 09, 2011| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer C - 0of 0 votes
AnswersFind the angle between min and hour hands of a clock.
- SK March 09, 2011| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer C - 0of 0 votes
AnswersMacros vs Functions
- SK March 09, 2011| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer C - 0of 0 votes
AnswersWHAT IS THE OUTPUT OF FOLLOW C PROGRAM?
- ajit March 06, 2011
#include<stdio.h>
#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;
}| Report Duplicate | Flag | PURGE
Softchoice Software Engineer / Developer C - 0of 0 votes
AnswersImplement strcat in C.
- Anonymous March 05, 2011| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer C - 0of 0 votes
AnswersIf we add a signed integer and a unsigned integer, will the result be signed or unsigned? What I guessed was signed, but after searching online for a while, looks like I was wrong. Can anybody give more detailed explanation?
- Lide February 25, 2011| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer C - 0of 0 votes
Answersfunction to generate random number without using any built in function.
- RV February 18, 2011| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm C - 0of 0 votes
Answersconvert string into integer without using any built in functions.
- RV February 18, 2011| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm C - 0of 0 votes
Answers5) Can we crash a process before entering Main() function ?
I said possible and I give following two examples
example 1:int *i = 0; int j = *i; // I think here memory access violation since pointer 'i' pointing 0th address. int main() { return 0; }
Example 2:
int i = 1 / 0; // here Float point exception or divided by zero exception. int main() { return 0; }
Today I executed , above two examples and I am getting compile time error "Line 2: error: initializer element is not constant
- siva.sai.2020 February 13, 2011
" .
Can some one please tell me why I am getting compile time error ?| Report Duplicate | Flag | PURGE
Gluster Software Engineer / Developer C