Mar 1, 2018 at 4:03am UTC
1. All of the following options below are valid arithmetic operations that can be performed on pointers EXCEPT:
A.
Add one pointer to another pointer (ptr1 + ptr2)
B.
Add an integer to a pointer (ptr + i)
C.
Subtract an integer from a pointer (ptr – i)
D.
Subtract one pointer from another pointer (ptr1 – ptr2)
2. Logically (i.e., as a concept), objects consist of _
Physically (i.e., in memory), objects consist of _
A.
Only member variables
Both member variables and member functions
B.
Only member variables
Only member variables
C.
Both member variables and member functions
Only member variables
D.
Both member variables and member functions
Both member variables and member functions
3. The unary operator _ determines the size of any data type
This operator returns the number of _ that the data type takes up in memory
A.
1. sizeof
2. bits
B.
1-. sizeof
2-. bytes
C.
1. size
2. bytes
D.
1. size
2. bits
4. What is the relationship between throw, try, and catch?
A.
Throw signals that an exception has occurred
Try handles an exception
Catch contains code that could possibly cause an exception
B.
Throw signals that an exception has occurred
Try contains code that could possibly cause an exception
Catch handles an exception
C.
Throw handles an exception
Try contains code that could possibly cause an exception
Catch signals that an exception has occurred
D.
Throw handles an exception
Try signals that an exception has occurred
Catch contains code that could possibly cause an exception
5. int x = 7;
int * const ptr = &x;
Which of the options below accurately describes ptr?
A.
Nonconstant pointer to nonconstant data
B.
Constant pointer to constant data
C.
Nonconstant pointer to constant data
D.
Constant pointer to nonconstant data
Can anyone tell me the correct answers and why?? please
Last edited on Mar 1, 2018 at 4:05am UTC
Mar 1, 2018 at 5:06am UTC
Last edited on Mar 1, 2018 at 5:07am UTC
Mar 1, 2018 at 5:35am UTC
no, it helps a lot, thank you so much. btw, I didn't see where said B is correct :(..
is that because they are not the same type?
Last edited on Mar 1, 2018 at 5:37am UTC
Mar 1, 2018 at 5:53am UTC
Yeah it doesn't exactly say B is incorrect but it does say the other ones are correct tho. doesnt directly say B is incorrect.
Mar 2, 2018 at 6:01am UTC
Peter is def right, idk how I put B last night. From what i remember concluding the answer was A.