Pointers in C
MCQ problems on C Pointers.
1. |
Which operator is used to access data members of a structure, with a variable that is pointer to that structure ? |
A. |
-> |
B. |
& |
C. |
. |
D. |
* |
2. |
Take a look at following code:
What does it depicts ? |
A. |
It represents a NULL pointer |
B. |
Syntax Error |
C. |
It represents a void pointer |
D. |
None of the options |
3. |
Which of the following header file(s) contain definition for NULL macro ? |
A. |
Only stdio.h |
B. |
Only math.h |
C. |
Only stdio.h and stddef.h |
D. |
None of the options |
4. |
What is the size of a pointer variable on Linux ? |
A. |
1 byte |
B. |
2 byte |
C. |
4 byte |
D. |
8 byte |
5. |
How do you access value at position arr[i][j][k][l] using pointer ? |
A. |
((arr+i)+j+k+l) |
B. |
(((arr+i)+j)+k+l) |
C. |
*(*(*(*(arr+i)+j)+k)+l) |
D. |
((((arr+i)+j)+k)+l) |
6. |
Which operator is used with pointer to access value at the address to which pointer points ? |
A. |
& |
B. |
* |
C. |
-> |
D. |
&& |
7. |
Which of the following is correct about pointers ? |
A. |
It is a keyword to declare special types of variable |
B. |
It is a variable that stores address of any variable |
C. |
It allocates memory for any variable |
D. |
All of the options |
8. |
Take a look the following piece of code:
Which of the following piece of code is equivalent to it ? |
A. |
|
B. |
|
C. |
|
D. |
|
9. |
What should be the output of following code:
|
A. |
earning |
B. |
oder |
C. |
ackersfriend |
D. |
None of the options |
10. |
What would be output of the following code:
|
A. |
4 |
B. |
5 |
C. |
64 |
D. |
72 |
Join the community of 1 Lakh+ Developers
Create a free account and get access to tutorials, jobs, hackathons, developer events and neatly written articles.
Create a free account