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

1)int *ptr; int val = 1; ptr = val; The second statement in the above code will

ID: 3662129 • Letter: 1

Question

1)int *ptr; int val = 1; ptr = val; The second statement in the above code will assign the value 1 to the pointer. True/False

2)char chrVal[ ] = “Good Morning”;

The above statement will result a compilation error True/False

3)

const int maxVal=50;

Value of maxVal can not be changed elsewhere in the program True/False

4)

int a[5]; int *ptr;

ptr = a;

a. the second statement will assign the address of the first element in the array

        b. the statements will cause a compilation time error

      

c. the statements will cause the program to stop running

           

d. none of the above

5)

char val[50] = “Hello ”

   a. will result a run/execution time error

   b. will result a compilation time error

     c. will not result any error

   d. none

   a. will result a run/execution time error

   b. will result a compilation time error

     c. will not result any error

   d. none

Explanation / Answer

1)

int *ptr;

int val = 1;

ptr = val;

The second statement in the above code will assign the value 1 to the pointer.

Answer: False

2)char chrVal[ ] = "Good Morning";

The above statement will result a compilation error True/False

Answer: True

3)

const int maxVal=50;

Value of maxVal can not be changed elsewhere in the program True/False

Answer; True

4)

int a[5]; int *ptr;

ptr = a;

Answer:( a). the second statement will assign the address of the first element in the array

a. the second statement will assign the address of the first element in the array

5)

char val[50] = "Hello "

Answer:   (b). will result a compilation time error