Here are the most important Multiple choice questions on Pointers in C programming.
- If p is a pointer to an integer and c is a pointer to a character then
sizeof(p)
will be- same as that of
sizeof(c)
- greater than that of
sizeof(c)
- less than that of
sizeof(c)
- None of the above
- same as that of
Show Answer
Answer: A
- Prior to using a pointer variable,
- it should be declared
- it should be initialized
- it should be both declared and initialized
- None of the above
Show Answer
Answer: C
Using a pointer variable, without initializing it, will be disastrous, as it will have a garbage value.
- Pointers are of ___________ data type
- integer
- character
- unsigned integer
- None of the above
Show Answer
Answer: D
Pointers are actually addresses. Though the address will be an integer, it is not of integer data type.
- Which of the following operators can be applied to the pointer variable(s}?
- Division
- Multiplication
- Increment
- None of the above
Show Answer
Answer: C
- A pointer variable can be
- passed to a function as an argument
- changed within a function
- returned by a function
- All of the above
Show Answer
Answer: D
- The declaration
int (*p)[5]
means- p is a one-dimensional array of size 5, of pointers to integers
- p is a pointer to a 5 element integer array
- the same as int *p[5] ;
- None of the above
Show Answer
Answer: B
- What will be the output of the following code.
- prints 9
- prints garbage value
- prints 3 * address of b
- results in an error
#include <stdio.h> int main() { int a=3, *b = &a; printf("%d",a*b); }
Show Answer
Answer: D
Since ‘a’ is an integer and ‘b’ is a pointer, they can’t be multiplied.