Select chapter



functions (3.papers)
loops (1.papers)
arrays (2.papers)
structures (3.papers)
unions (1.papers)
pointers (7.papers)
null pointers (1.papers)
strings (2.papers)
misc c concepts (1.papers)
Data structures (5.papers)
linked lists (3.papers)
trees (1.papers)
basics (5.papers)
Hide

Sponsored Links


  

c basics interview questions and answers

1
What is the scope and life time of an auto variable in c?
  1. scope - with in that block where it was declared, and life time - through out that function.
  2. scope - with in that block where it was declared, and life time - through out that file.
  3. scope - with in that block where it was declared, and life time - through out that application.
  4. scope - with in that block where it was declared, and life time - through out that block.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
9
What is the value of cnt in below C program? Is there any mistake in below piece of code?

   int cnt = 0;
   cnt = cnt++;
  1. cnt value is 0, no mistake.
  2. cnt value is 1, no mistake.
  3. cnt value can't be predicted. its machine dependent. More over this is wrong way of writing code, where same value is being changed more than once in same expression, which would lead to undesired or erroneous outputs.
  4. it gives compile time error.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
11
Where register variables are stored, in c?
  1. It will be stored always in CPU registers.
  2. it will be stored in stack.
  3. register keyword is a request to store that variable in CPU registers based on the availability.
  4. it will be stored in heap memory.
Show Answer
Share Facebook gmail Twitter
12
what is the use of register variable in c? when to use register storage specifier?
  1. for more frequently used variables, like ones used in loops.
  2. variables which takes less memory can be always stored in registers.
  3. int pointers its better to use registers.
  4. both option 1 and 2 are correct.
Show Answer
Share Facebook gmail Twitter
13
What is the scope and life time of extern variables in c?
  1. scope - is global, life time - through the program's execution.
  2. scope - is with in that file, life time - through the program's execution.
  3. scope - is with in that file, life time - dies immediately after the function exits.
  4. scope - is all the files of that application can access it, life time - will be alive if any function calls it and will be dead once that function ends.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
15
Is it possible to change constant variable's value after initialization, in c?
  1. No,
  2. Yes we can change.
  3. yes we can change through using pointers.
  4. can't say
Show Answer
Share Facebook gmail Twitter
16
when sizeof is evaluated?
  1. sizeof will be calculated at pre processing time.
  2. sizeof is a compile time operator.
  3. sizeof will be calculated at run time.
  4. all of them are true.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
19
Is it possible to declare a variable as both const and volatile in c?
  1. Either we can declare as const or volatile, but not together.
  2. we can declare as volatile const, but not in revser order.
  3. Yes, we can declare a variable as const volatile.
  4. we can declare a variable as const for constants, but there is nothing like volatile in c.
Show Answer
Share Facebook gmail Twitter
20
printf main:

What is the output of below c program?

#include  <stdio.h>

int main(void)
{
    printf("hello..%p",main);
    return 0; 
}
  1. hello..(prints address of main)
  2. infinite loop and crashes..its a recursion call. also prints hello for infinite no of times.
  3. hello.. and crashes
  4. hello..
Show Answer
Share Facebook gmail Twitter
Read more papers :