Pls help to check if my answer is correct or not.
Q.1
Given the following definiton:
char s[10], *p = s;
Which of the following statement is valid and legal:
(a) p = s + 5 ;
(b) s = [ p + s ];
(c) s[2] = p[12];
(d) *p = s
MY ANSWER IS : D
Q2.
Given the following code segment:
char str[] = "Hello";
char *ptr;
ptr = &str[1];
After executed the above codes, what is the value of
*( ptr + 3 )?
(a) 'o'
(b) '\0'
(c) indeterminate
(d) address of 'o'
MY ANSWER IS : D
Q3.
Given the prototype for the constructor for a student class is
Student ( const int idNum = 0,
const double height = 1.7 );
The definition
Student Joshua(3); is to...
(a) define a student with idNum 0 and height 1.7
(b) define a student with idNum 3 and height 1.7
(c) define a student with idNum 0 and height 3
(d) is illegal
MY ANSWER IS : B