Pointers Questions and Answers
Practice ModeShowing 10 of 217 questions
Q111
void display (int *list)
{printf ("element = %d\n", *(list + 3));
}
int main ( )
{
int ary [3] [3] = {{0}, {2, 3}, {4, 5, 6}};
display ((int *) ary);
return 0;
}
What will be printed when the sample code above is executed ?
Answer: Option B
Q112
#include <math.h>
static double (*funcs [] ) ( double ) =
{
sin, cos, tan, asin, acos,
atan, sinh, cosh, tanh
};
double compute Trig Function (int index, double argument)
{
return ????;
}
Referring to the sample code above, which should compute the value of a trigonometric function based on its index, what would be a replacement for the ???? to make the correct call ?
Answer: Option B
Q113
float (*f[5]()); This declaration represents
Answer: Option D
Q114
float (*f( ) ) [5]; This declaration represents
Answer: Option A
Q115
char (*(*f()[]) (); This pointer declaration represents
Answer: Option A
Q116
float (*(*[5])()[10]; This declaration represents
Answer: Option C
Q117
# include <stdio.h>
char *format = "%d";
int main ( )
{
int x; void func ( ) ;
func ( scanf, &X );
printf ("%D\n", x );
return 0;
}
Referring to the sample code above, which of the following would be a correct implementation for func ?
Answer: Option B
Q118
In the declaration int x[3][2][2] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
*(*(*(x+2) +1) +1) represents
Answer: Option A
Q119
int a = 1; b = 2; c = 3; *pointer; pointer = &c;
a = c/*pointer;
b = c;
printf ("a=%d b=%d", a,b);
What will be the output?
Answer: Option D
Q120
void fn (int *a, int *b)
{
int *t; t=a;
a = b;
b=t;
}
main ( )
{
int a = 2; void fn ( );
int b=3;
fn (&a, &b);
printf ("%d %d\n", a, b);
}
What will be the output ?
Answer: Option C