Exam 9: Pointers and Dynamic Arrays

arrow
  • Select Tags
search iconSearch Question
  • Select Tags

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?

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

A

The size of a dynamic array is defined at ___________

Free
(Short Answer)
4.9/5
(40)
Correct Answer:
Verified

run-time

If p1 is an integer pointer variable,with the value of 1000,p1++ changes P1 to point to the memory location 1001.

Free
(True/False)
4.9/5
(42)
Correct Answer:
Verified

False

In which case would you consider using a dynamic array?

(Multiple Choice)
4.9/5
(37)

Which of the following statements correctly returns the memory from the dynamic array pointer to by p1 to the freestore?

(Multiple Choice)
4.8/5
(39)

If p1 and p2 are both pointers that point to integers in memory,the condition p1==p2 will be true if the values that are in those memory locations are the same.

(True/False)
4.8/5
(39)

What is the output of the following code fragment? Int v1=2,v2=-1,*p1,*p2; P1 = & v1; P2= & v2; P2=p1; Cout << *p2 << endl;

(Multiple Choice)
4.8/5
(40)

In the following statement,all the variables are pointers. int* p1,p2;

(True/False)
4.7/5
(38)

Given that p1 is a pointer variable of the string class,which of the following are legal statements?

(Multiple Choice)
4.8/5
(38)

Dynamically created variables have no name.

(True/False)
4.8/5
(42)

You can assign an array to a pointer variable.

(True/False)
4.8/5
(32)

Which of the following correctly declares a user-defined data type that defines a pointer to a float?

(Multiple Choice)
4.8/5
(30)

What is the output of the following code fragment? Float *p1; P1 = new float3); Cout << *p1;

(Multiple Choice)
5.0/5
(27)

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.9/5
(31)

Write the code to return the dynamic memory pointed to by p1 to the freestore.

(Short Answer)
4.8/5
(34)

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

(Multiple Choice)
4.9/5
(25)

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.

(Short Answer)
5.0/5
(40)

Dynamic variables are created at __________

(Short Answer)
4.8/5
(42)

If two pointer variables point to the same memory location,what happens when one of the pointers is freed?

(Multiple Choice)
4.7/5
(30)

The & operator is called the _______________

(Short Answer)
4.8/5
(36)
Showing 1 - 20 of 40
close modal

Filters

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