Loading...

C Multiple Choice Questions

Our C questions and answers focuses on all areas of C programming language covering 100+ topics in C

C Pointers-2 MCQs

C Pointers-2


1. What is wild pointer?

a) Pointer which is wild in nature
b) Pointer which has no value
c) Pointer which is not initialized
d) None



2. In order to fetch the address of the variable we write preceding _________ sign before variable name.

a) Percent(%)
b) Comma(,)
c) Ampersand(&)
d) Asterisk(*)



3. Address stored in the pointer variable is of type _______.

a) Integer
b) Float
c) Array
d) Character



4. Comment on this const int *ptr;

a) You cannot change the value pointed by ptr
b) You cannot change the pointer ptr itself
c) Both (a) and (b)
d) You can change the pointer as well as the value pointed by it



5. The operator > and < are meaningful when used with pointers, if

a) The pointers point to data of similar type
b) The pointers point to structure of similar data type
c) The pointers point to elements of the same array
d) None of these



6. What does this declaration means -
int (*p)[5];

a) p is one dimensional array of size 5, of pointers to integers
b) p is a pointer to a 5 elements integer array
c) The same as int *p[
d) None of these



7. Which of the following is the correct ways of declaring a float pointer:

a) float ptr;
b) float *ptr;
c) *float ptr;
d) None of the above



8. Find the output of the following program?
void main() {
  char *msg = "hi";
  printf(msg);
}

a) hi
b) h
c) hi followed by garbage value
d) None of Error



9. Prior to using a pointer variable it should be

a) initialized
b) Declared
c) Both A and B
d) None of the above



10. What will be the output of the program.
void main() {
  printf("%d %d", sizeof(int *), sizeof(int **));
}

a) 2, 0
b) 0, 2
c) 2, 2
d) 2, 4
e) 4, 4



- Related Topics