Exam 9: Pointers and Dynamic Arrays

arrow
  • Select Tags
search iconSearch Question
  • Select Tags

Given that p1 is an integer pointer variable,and a1 is an integer array,which of the following statements are not legal code?

(Multiple Choice)
4.8/5
(34)

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

(True/False)
4.8/5
(37)

Write the code that assigns to p1 an integer pointer variable)the pointer to a dynamically created integer.

(Short Answer)
4.8/5
(39)

Which of the following statements correctly prints out the value that is in the memory address that the pointer p1 is pointing to?

(Multiple Choice)
4.8/5
(49)

Declare a pointer variable named ptr to an integer.

(Short Answer)
4.9/5
(30)

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
(45)

When you return a dynamic array to the freestore,you must include the number of elements in the array.

(True/False)
4.8/5
(40)

Which of the following is not true?

(Multiple Choice)
4.9/5
(38)

int *p1; declares a static variable.

(True/False)
4.7/5
(48)

Even though pointers point to addresses which are integers,you can not assign an integer to a pointer variable.

(True/False)
4.8/5
(39)

Given that p1 is a pointer,p1++

(Multiple Choice)
4.8/5
(39)

In the statement cout << *p1;,the * is called the ________________

(Short Answer)
4.8/5
(28)

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
(45)

A pointer can be stored in an integer variable.

(True/False)
4.9/5
(36)

What is wrong with the following code fragment? Int *p1,*p2; P1 = new int; P2 = new int; *p1=11; *p2=0; P2=p1; Cout << *p1 <<" " << *p2 << endl; Delete p1; Delete p2;

(Multiple Choice)
4.8/5
(37)

Dynamic variables are created from the ___________.

(Short Answer)
4.8/5
(33)

A ___________ is the memory address of a variable.

(Short Answer)
4.8/5
(42)

Which of the following correctly declare 3 integer pointers?

(Multiple Choice)
4.8/5
(36)

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

(Multiple Choice)
4.7/5
(33)

Which of the following correctly declares a dynamic array of strings?

(Multiple Choice)
4.9/5
(38)
Showing 21 - 40 of 40
close modal

Filters

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