Pointers into Arrays

1

What is the output of this program?

1.
   #include 
2.   
   using namespace std;
3.   
   int main()
4.   
   {
5.   
        int arr[] = {4, 5, 6, 7};
6.        
        int *p = (arr + 1);
7.        
        cout << *arr + 9;
8.        
        return 0;
9.        
   }
A. 12
B. 5
C. 13
D. error

2

What is the output of this program?

1.
   #include 
2.   
   using namespace std;
3.   
   int main ()
4.   
   {
5.   
       int numbers[5];
6.       
       int * p;
7.       
       p = numbers;  *p = 10;
8.       
       p++;  *p = 20;
9.       
       p = &numbers[2];  *p = 30;
10.       
       p = numbers + 3;  *p = 40;
11.       
       p = numbers;  *(p + 4) = 50;
12.       
       for (int n = 0; n < 5; n++)
13.       
           cout << numbers[n] << ",";
14.           
       return 0;
15.       
   }
A. 10,20,30,40,50,
B. 1020304050
C. compile error
D. runtime error

3

What is the output of this program?

1.
   #include 
2.   
   using namespace std;
3.   
   int main()
4.   
   {
5.   
       int arr[] = {4, 5, 6, 7};
6.       
       int *p = (arr + 1);
7.       
       cout << arr;
8.       
       return 0;
9.       
   }
A. 4
B. 5
C. address of arr
D. 7

4

what is the output of this program?

1.
   #include 
2.   
   using namespace std;
3.   
   int main()
4.   
   {
5.   
       int arr[] = {4, 5, 6, 7};
6.       
       int *p = (arr + 1);
7.       
       cout << *p;
8.       
       return 0;
9.       
   }
A. 4
B. 5
C. 6
D. 7

5

What is the output of this program?

1.
   #include 
2.   
   using namespace std;
3.   
   int main()
4.   
   {
5.
       int i;
6.       
       char *arr[] = {"C", "C++", "Java", "VBA"};
7.       
       char *(*ptr)[4] = &arr;
8.       
       cout << ++(*ptr)[2];
9.       
       return 0;
10.       
   }
A. ava
B. java
C. c++
D. compile time error