Exam 9: Pointers and Dynamic Arrays

arrow
  • Select Tags
search iconSearch Question
  • Select Tags

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:
Verified

B

Which of the following is not true?

Free
(Multiple Choice)
4.8/5
(42)
Correct Answer:
Verified

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:
Verified

D

Which of the following assigns to p1 the pointer to the address of value?

(Multiple Choice)
4.9/5
(36)

Declare a pointer variable named ptr to an integer.

(Short Answer)
4.9/5
(40)

Dynamically created variables have no name.

(True/False)
4.8/5
(41)

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)

In which case would you consider using a dynamic array?

(Multiple Choice)
4.8/5
(38)

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)

The size of dynamic arrays must be declared at compile time.

(True/False)
4.9/5
(28)

If a program requires a dynamically allocate two-dimensional array, you would allocate the memory by using

(Multiple Choice)
4.8/5
(33)

The size of a dynamic array is defined at ___________

(Short Answer)
4.9/5
(35)
Showing 1 - 20 of 39
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)