Tuesday, November 11, 2008

You want to declare a pointer to an array of 20 elements containing double values.

Which one of the following statements do you use to declare a pointer to an array of 20 elements containing double values?

Choice a : push(double *array, [20]);
Choice b : double **array[20];
Choice c : double (*array)[20];
Choice d : void pointer = *array[20];
Choice e : double array = *array[20];

Monday, November 10, 2008

You make a change to a C program and run the binary. When the binary is run, it produces the same results as before the change.

It seems like the change has not been honored.
Given the scenario described above, how do you fix the problem?

Choice a: Recompile the program.
Choice b: Clear the program cache and run the binary again.
Choice c: Run ./configure to reconfigure the program.
Choice d: Restart the resident set and run the program again.
Choice e: Touch the Makefile.

Sunday, November 2, 2008

What is the output of following programme ?

main() {
int x=10, y=20;
if(!!!!x||2&&x)
printf("x=%d", x);
else
printf("y=%d",y);
}

a. Y=20
b. X=10
c. X=-10
d. X=0
e. Error

Wednesday, October 29, 2008

What will happen when the program below is compiled and executed?

int i;
int increment( int *i )
{
return ++i;
}

int main()
{
  for( i = 0; i < 10; increment(i) ) 
   {} 

   printf("i=%d", i); 
 return 0;
} 

Choice a: It will not compile
Choice b: It will print out i=9 
Choice c: It will print out i=10 
Choice d: It will print out i=11
Choice e: It will loop indefinitely

Tuesday, October 21, 2008

What will be printed when the sample code above is executed?

int x = 0;
for ( ; ; )
{
if (x++ == 4)
break;
continue;
}
printf("x=%d\n", x);

Choice a: x=0
Choice b: x=1
Choice c: x=4
Choice d: x=5
Choice e: x=6