Exam 9: Pointers and Dynamic Arrays
Exam 1: Introduction to Computer and C++ Programming56 Questions
Exam 2: C++ Basics57 Questions
Exam 3: More Flow of Control45 Questions
Exam 4: Procedural Abstraction and Functions That Return a Value53 Questions
Exam 5: Functions for All Sub Tasks54 Questions
Exam 6: Io Streams As an Introduction to Objects and Classes52 Questions
Exam 7: Arrays48 Questions
Exam 8: Strings and Vectors69 Questions
Exam 9: Pointers and Dynamic Arrays39 Questions
Exam 10: Defining Classes61 Questions
Exam 11: Friends, Overloaded Operators, and Arrays in Classes56 Questions
Exam 12: Separate Compilation and Namespaces41 Questions
Exam 13: Pointers and Linked Lists64 Questions
Exam 14: Recursion48 Questions
Exam 15: Inheritance53 Questions
Exam 16: Exception Handling47 Questions
Exam 17: Templates35 Questions
Exam 18: Standard Template Library59 Questions
Select questions type
Which of the following correctly declares a user-defined data type that defines a pointer to a float?
Free
(Multiple Choice)
4.8/5
(40)
Correct Answer:
B
Which of the following statements correctly prints out the value that is in the memory address that the pointer p1 is pointing to?
Free
(Multiple Choice)
4.7/5
(40)
Correct Answer:
D
Which of the following assigns to p1 the pointer to the address of value?
(Multiple Choice)
4.9/5
(36)
What is the output of the following code?
Int *p1, *p2;
P1 = new int;
P2 = new int;
*p1=11;
*p2=0;
P2=p1;
Cout << *p1 <<" " << *p2 << endl;
(Multiple Choice)
4.8/5
(39)
Even though pointers point to addresses which are integers, you can not assign an integer to a pointer variable.
(True/False)
4.8/5
(42)
Given that p1 is a pointer variable of the string class, which of the following are legal statements?
(Multiple Choice)
4.9/5
(36)
Assuming that the pointer variable p1 is of the correct type and size is an integer with some value > 1, which of the following declarations are legal?
(Multiple Choice)
4.9/5
(42)
If p1 is an integer pointer that is pointing to memory location 1001, and an integer takes 4 bytes, then p1+1) evaluates to:
(Multiple Choice)
4.8/5
(36)
When you return a dynamic array to the freestore, you must include the number of elements in the array.
(True/False)
4.9/5
(44)
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.
(Essay)
5.0/5
(33)
What is the output of the following code fragment?
Float *p1;
P1 = new float3);
Cout << *p1;
(Multiple Choice)
4.8/5
(34)
Write the code to return the dynamic memory pointed to by p1 to the freestore.
(Short Answer)
4.9/5
(27)
Given that a typedef for IntPtr defines a pointer to an integer, what would be the correct declaration for a function that expects a reference to an integer pointer?
(Multiple Choice)
5.0/5
(42)
If a program requires a dynamically allocate two-dimensional array, you would allocate the memory by using
(Multiple Choice)
4.8/5
(33)
Showing 1 - 20 of 39
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)