Exam 10: Pointers

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

To dereference a structure pointer and simultaneously access a member of the structure, the appropriate operator to use is

Free
(Multiple Choice)
4.9/5
(35)
Correct Answer:
Verified

C

The ampersand (&) is used to dereference a pointer variable in C++.

Free
(True/False)
4.8/5
(44)
Correct Answer:
Verified

False

If s is a structure variable and p, a pointer, is a member of the structure, the statement cout << *s.p; will

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

A

A reason for passing a pointer to a function is

(Multiple Choice)
4.8/5
(48)

The expression s->m has the same meaning as (*s).m.

(True/False)
4.9/5
(37)

A pointer with the value 0 (zero) is called the NULL pointer.

(True/False)
4.9/5
(32)

Which of the following statements is not valid C++ code?

(Multiple Choice)
4.9/5
(41)

A pointer can be passed as an argument to a function.

(True/False)
4.8/5
(37)

With pointer variables you can access, but you cannot modify, data in other variables.

(True/False)
5.0/5
(33)

A function may return a pointer, but the programmer must ensure that the pointer

(Multiple Choice)
4.7/5
(34)

Suppose that a function dynamically allocates a block of memory with a local pointer variable p pointing to the allocated block. Suppose further that there are no other pointers referencing that block of memory, and the function returns without doing a delete on p. Then

(Multiple Choice)
4.7/5
(32)

Which arithmetic operations can be performed on pointers?

(Multiple Choice)
5.0/5
(35)

The statement int *ptr; means

(Multiple Choice)
4.7/5
(36)

C++ does not perform array bounds checking.

(True/False)
4.8/5
(30)

An array name is a pointer constant because the address it represents cannot be changed during run-time.

(True/False)
4.8/5
(38)

A statement that displays the address of the variable num1 is

(Multiple Choice)
4.8/5
(29)

The expression *s->p; is only meaningful if s is a pointer to a structure and p is a pointer that is a member of that structure.

(True/False)
4.9/5
(30)

A pointer variable may be initialized with

(Multiple Choice)
4.9/5
(35)

Which of the following statements correctly deletes a dynamically-allocated array pointed to by p?

(Multiple Choice)
4.8/5
(35)

The code segment int *ptr; has the same meaning as

(Multiple Choice)
4.9/5
(38)
Showing 1 - 20 of 62
close modal

Filters

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