Filters
Question type

Study Flashcards

Three of the following expressions have the same value. Which of the following expressions has a value different from the others'?


A) *&ptr
B) &*ptr
C) *ptr
D) ptr

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

Sizeof:


A) Is a binary operator.
B) Returns the total number of elements in an array.
C) Usually returns a double.
D) Returns the total number of bytes in a variable.

E) A) and D)
F) None of the above

Correct Answer

verifed

verified

Pointers cannot be used to:


A) Contain memory addresses.
B) Reference values directly.
C) Pass an argument by reference.
D) Manipulate dynamic data structures.

E) None of the above
F) A) and B)

Correct Answer

verifed

verified

A string array is commonly used for:


A) Command-line arguments.
B) Storing an extremely long string.
C) Storing multiple copies of the same string.
D) Displaying floating-point numbers to the screen.

E) A) and D)
F) None of the above

Correct Answer

verifed

verified

Which statement would be used to declare a 10-element integer array c?


A) array c = int[10];
B) c = int[10];
C) int array c[10];
D) int c[10];

E) A) and C)
F) None of the above

Correct Answer

verifed

verified

Which of the following is not a valid way to pass arguments to a function in C++?


A) By reference with reference arguments.
B) By value.
C) By reference with pointer arguments.
D) By value with pointer arguments.

E) B) and C)
F) A) and C)

Correct Answer

verifed

verified

When a compiler encounters a function parameter for a single-subscripted array of the form int a[], it converts the parameter to:


A) int a
B) int &a
C) int *a
D) No conversion is necessary.

E) All of the above
F) None of the above

Correct Answer

verifed

verified

A function that prints a string by using pointer arithmetic such as ++ptr to output each character should have a parameter that is:


A) A nonconstant pointer to nonconstant data.
B) A nonconstant pointer to constant data.
C) A constant pointer to nonconstant data.
D) A constant pointer to constant data.

E) B) and C)
F) A) and D)

Correct Answer

verifed

verified

What does the following statement declare? int *countPtr, count;


A) Two int variables.
B) One pointer to an int and one int variable.
C) Two pointers to ints.
D) The declaration is invalid.

E) A) and D)
F) B) and C)

Correct Answer

verifed

verified

Which of the following is not true of pointers to functions?


A) They contain the starting address of the function code.
B) They are dereferenced in order to call the function.
C) They can be stored in arrays.
D) They can not be assigned to other function pointers.

E) A) and D)
F) None of the above

Correct Answer

verifed

verified

What method should be used to pass an array to a function that does not modify the array and only looks at it using array subscript notation:


A) A nonconstant pointer to nonconstant data.
B) A nonconstant pointer to constant data.
C) A constant pointer to nonconstant data.
D) A constant pointer to constant data.

E) B) and D)
F) B) and C)

Correct Answer

verifed

verified

To prevent modification of a built-in array's values when you pass the built-in array to a function:


A) The built-in array must be declared static in the function.
B) The built-in array parameter can be preceded by the const qualifier.
C) A copy of the built-in array must be made inside the function.
D) The built-in array must be passed by reference.

E) All of the above
F) A) and B)

Correct Answer

verifed

verified

Showing 21 - 32 of 32

Related Exams

Show Answer