Question:

Which of the following statements are correct, about pointers and arrays in C++? A. Arrays are contiguous memory blocks. B. A pointer can hold the address of an array element. C. \(int *P = arr;\) is valid if arr is an array. D. Function pointers cannot be used to call functions dynamically. E. Pointer arithmetic depends on data type size.

Show Hint

Array name gives the base address of the array. Pointer arithmetic always moves according to the size of the data type.
Updated On: May 18, 2026
  • A, B, D and E only
  • A, B, C and E only
  • B, C and D only
  • B, D and E only
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

Concept:
In C++, arrays and pointers are closely related. The name of an array usually represents the address of its first element.

Step 1: Check statement A.

Arrays store elements in contiguous memory locations. \[ A \text{ is correct} \]

Step 2: Check statement B.

A pointer stores the address of a variable. Therefore, it can store the address of an array element. \[ B \text{ is correct} \]

Step 3: Check statement C.

If \(arr\) is an integer array, then: \[ int *P = arr; \] is valid because \(arr\) represents the address of the first element of the array. \[ C \text{ is correct} \]

Step 4: Check statement D.

Function pointers can be used to call functions dynamically. Therefore, the statement saying they cannot be used is incorrect. \[ D \text{ is incorrect} \]

Step 5: Check statement E.

Pointer arithmetic depends on the size of the data type. For example, if an integer takes 4 bytes, then incrementing an integer pointer moves it by 4 bytes. \[ E \text{ is correct} \] Thus, the correct statements are: \[ A, B, C \text{ and } E \] \[ \therefore \text{Correct Answer is (B)} \]
Was this answer helpful?
0
0