Quiz 3 - Chapter 8 Pointers and Dynamic Arrays TRUE/FALSE 1 You can assign an array to a pointer variable ANSWER TRUE 2 The size of dynamic arrays

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 8 - Pointers and Dynamic Arrays TRUE/FALSE 1. You can assign an array to a pointer variable. ANSWER: TRUE 2. The size of dynamic arrays must be declared at compile time. ANSWER: FALSE 3. int *p1; declares a static variable. ANSWER: FALSE 4. Dynamically created variables have no name. ANSWER: TRUE 5. In the following statement, all the variables are pointers. int* p1, p2; ANSWER: FALSE 6. A pointer can be stored in an integer variable. ANSWER: FALSE Short Answer 1. A ___________ is the memory address of a variable. ANSWER: pointer 2. Declare a pointer variable named ptr to an integer. ANSWER: int *ptr; 3. In the statement cout << *p1;, the * is called the ________________ ANSWER: dereferencing operator 4. ANSWER: address of operator 5. Write the code that assigns to p1 (an integer pointer variable) the pointer to a dynamically created integer. ANSWER: p1 = new int; 6. Dynamic variables are created at __________ ANSWER: run-time 7. Dynamic variables are created from the ___________. ANSWER: freestore or heap. 8. Write the code to return the dynamic memory pointed to by p1 to the freestore. ANSWER: delete p1; 9. The size of a dynamic array is defined at ___________ ANSWER: run-time 10. Write the code to declare a dynamic array of strings (use the string pointer variable p1) that has as many elements as the variable arraySize. ANSWER: p1 = new string[arraySize];
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/02/2012 for the course CSC CSC 175 taught by Professor Kraft during the Winter '12 term at Michigan Flint.

Page1 / 5

Quiz 3 - Chapter 8 Pointers and Dynamic Arrays TRUE/FALSE 1 You can assign an array to a pointer variable ANSWER TRUE 2 The size of dynamic arrays

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online