Question: 1. How is * used to create pointers? Give an example to justify your answer. How is * used to dereference pointers? Give an example

1.

How is * used to create pointers? Give an example to justify your answer.

How is * used to dereference pointers? Give an example to justify your answer.

 

2. Consider the following statement:

int* p, q;

This statement could lead to what type of misrepresentation?

3. Suppose that you have the declaration int *numPtr;. What is the difference between the expressions: *numPtr and &numPtr?

4. Suppose that numPtr is a pointer of type int and gpaPtr is a pointer of type double. Further suppose that numPtr = 1050 and gpaPtr = 2000. Also suppose that the size of the memory allocated for an int value is 4 bytes and the size of the memory allocated for a double value is 8 bytes. What are the values of numPtr and gpaPtr after the statements numPtr = numPtr + 2; and gpaPtr = gpaPtr + 3; execute?

5.

What does the operator new do?

What does the operator delete do?

6. Explain why you cannot use a range-based for loop on dynamic arrays.

7. Explain the difference between a shallow copy and a deep copy of data.

8.

What is the purpose of the copy constructor?

Name two situations in which a copy constructor executes.

9. Name three things that you should do for classes with pointer member variables.

10. What is the difference between compile-time binding and run-time binding?

11. Is it legal to have an abstract class with all member functions pure virtual?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!