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 interview questions and answers

1
Initialization of arrays in C:
In an integer array of 10 elements, if only first two elements are initialized, then what will happen to rest of the elements?
  1. Rest of the elements will be assigned with garbage values if it is local.
  2. Rest of the elements will be assigned with 0's
  3. compile time error.
  4. option 2 is correct only for global variables.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
5
Array sample program in C:

What is the value of arr[0] & arr[1]in below C program? Is there any mistake with it?
   int arr[3] = {0};
   int cnt = 0;
   arr[cnt] = cnt++;
  1. arr[0] val is 0, arr[1] val is 1, no mistake.
  2. arr[0] val is 1, arr[1] val is 0, no mistake.
  3. arr[0], arr[1] value can't be predicted. its machine dependent. More over this is wrong way of writing code, where same 'cnt' value is being changed more than once in same expression, which would lead to undesired or erroneous outputs.
  4. arr[0] val is 1, arr[1] val is 1, no mistake.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Read more papers :