Pointers
1.

Which of the following is the proper declaration of a pointer ?

A.  

int x;

B.  

int &x;

C.  

ptr x;

D.  

 int *x;

2.

Which of the following gives the memory address of integer variable a ?

A.  

*a;

B.  

 a;

C.  

&a;

D.  

address(a);

3.

Which of the following gives the memory address of a pointer a ? 

A.  

a;

B.  

*a;

C.  

&a;

D.  

address(a)

4.

Which of the following gives the value stored at the address pointed to by the pointer a ?

A.  

a

B.  

val(a);

C.  

*a;

D.  

&a

5.

Which of the following is the proper keyword to allocate memory ?

A.  

new

B.  

malloc

C.  

create

D.  

value

6.

Which of the following is the proper keyword to deallocate memory ?

A.  

free

B.  

delete

C.  

clear

D.  

remove

7.

What does the following statement mean ?

A.  

pointer to a pointer

B.  

pointer to an array of chars

C.  

pointer to function taking a char* argument and returns an int

D.  

function taking a char* argument and returning a pointer to int

8.

The operator used for dereferencing or indirection is ____

A.  

*

B.  

&

C.  

->

D.  

–>>

9.

Choose the right option.
string* x, y;

A.  

x is a pointer to a string, y is a string

B.  

y is a pointer to a string, x is a string

C.  

both x and y are pointers to string types

D.  

y is a pointer to a string

10.

Which one of the following is not a possible state for a pointer.

A.  

hold the address of the specific object

B.  

point one past the end of an object

C.  

zero

D.  

point to a type