Two questions are not clear

1 Q­7 In the piece of code, arr[ ][ ] is a 2­D array and assume that the
contents of the 2­D array are already filled up. What is stored in the
variable sum at the end of the code segment?
int arr[3][3];
int i, sum=0; i = 0; while(i<3) {
sum += * ( * (arr+i)+(i++)); }
printf(“sum:%d”, sum);

A) Sum of all elements in the matrix
B) Sum of alternate elements in the matrix
C) Sum of the elements along the principal diagonal
D) None

2Q­4 What is the problem with the following code #include<stdio.h>
int main()
{
int *ptr = (int *)malloc(sizeof(int));
ptr = NULL;
free(ptr);
}
A) Dangling Pointer
B) Memory leak
C) The program may crash as free() is called for NULL pointer.
D) Compiler Error

Hey @asaurabh_26
follow this for question 7 Q7 from pointers

For q4
the problem is memory leak because p is allocated some memory which is not freed, but the pointer is assigned as NULL. The correct sequence should be

free ( p );
p = NULL;