Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(1)- Which of the following is the declaration of a pointer for an integer? a: i

ID: 3703085 • Letter: #

Question

(1)- Which of the following is the declaration of a pointer for an integer?

a: int n;

b: *n;

c: char * n;

d: int *n;

(2)- %p can be used to print the value of a pointer, which is the address of a memory location.

True or False?

(3)- NULL is a special pointer value that indicates the pointer is pointing nowhere.

True or False?

(4)- Given the following code:

int arr[3] = {1,2,3};

int *p = arr;

p is now pointing to the starting address of the array.

True or False?

(5) - The arithmetic operations on pointers take into account the size of the data type that the pointer is pointing to.

True or False?

(6)- Pointer in C does not support any type of arithmetic operation.

True or False

(7)-What is the value of num at the end of the following program?

int num = 10;

num++;

int *p = #

*p = 20;

a: 10

b: 11

c: 20

d: 21

(8)- What is the value of arr[3] at the end of the following program?

double arr[5] = {1.2, 3.0, 4.9, 5.4, 2.3};

double *p = arr;

*(p + 3) = 8.8;

a: 5.4

b: 8.8

c: 4.9

d: 2.3

(9)- Pointers can be used for dynamically defining an array.

True or False

(10)- Which two of the following functions can be used to allocate memory to a pointer?

a: scanf

b: malloc()

c: printf()

d: sizeof()

Explanation / Answer

Question 1
Answer:
d: int *n;

Question 2
Answer:
False

Question 3
Answer:
True

Question 4
Answer:
True

Question 5
Answer:
True

Question 6
Answer:
False

Question 7
Answer:

c: 20
Question 8
Answer:
b: 8.8

Question 9
Answer:
True
Question 10
Answer:
b: malloc()
d: sizeof()