LearnFrenzy
Sign in Take a free test

Complicated Declarations · Exercise 1 of 4

Complicated Declarations Complicated Declarations MCQ

  • 12 questions
  • Page 1 of 2
  • Answers explained
0Attempted
0Correct
0Wrong
Directions

Twelve multiple-choice questions: decode declarations with pointers, arrays and functions, const placement and typedef. Pick an option to check your answer instantly.

Question 1 Easy

What does int *p[10]; declare?

A A pointer to an array of 10 int
B An array of 10 pointers to int
C A pointer to a function returning int
D A function returning a pointer to int
Question page & discussion
Question 2 Easy

What does int (*p)[10]; declare?

A An array of 10 pointers to int
B A pointer to an array of 10 integers
C A pointer to 10 functions
D An invalid declaration
Question page & discussion
Question 3 Easy

What does int *f(void); declare?

A A pointer to a function returning int
B A function taking no arguments and returning a pointer to int
C An array of int pointers
D A pointer to void
Question page & discussion
Question 4 Medium

Which declares an array of 4 pointers to functions that take a double and return a double?

A double *f[4](double);
B double (*f[4])(double);
C double (*f)(double)[4];
D double (f*[4])(double);
Question page & discussion
Question 5 Medium

What is fp in char *(*fp)(const char *);?

A A function returning a pointer to char
B A pointer to a function that takes a const char * and returns a char *
C An array of char pointers
D A pointer to a pointer to char
Question page & discussion
Question 6 Hard

Which declares get as a function taking an int and returning a pointer to a function (void) returning int?

A int (*get)(int)(void);
B int (*get(int))(void);
C int *get(int)(void);
D int get(int)(*)(void);
Question page & discussion
Question 7 Hard

What does void (*signal(int sig, void (*func)(int)))(int); declare?

A A pointer to a function taking two arguments
B A function taking an int and a pointer to a function (int) returning void, and returning a pointer to a function (int) returning void
C An array of signal handlers
D A function returning void
Question page & discussion
Question 8 Medium

With int *const p = &x;, which statement is allowed?

A p = &y;
B *p = 5;
C Both
D Neither
Question page & discussion
Question 9 Medium

Which pair of declarations means the same thing?

A const char *p and char *const p
B const char *p and char const *p
C char const *p and char *const p
D None of them
Question page & discussion
Question 10 Medium

Which declaration is not allowed in C?

A int (*f(void))[3];
B int f(void)[3];
C int *f(void);
D int (*f)(void);
Question page & discussion

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Search LearnFrenzy

Esc

Quick links