Part 1
Part 1
Part 1
Part 1
Part 1
100
The value in this type of local variable persists between function calls.
static
100
These types of arguments are passed to parameters automatically if no argument is provided in the function call.
default
100
void calc (int a, int& b) { int c; c = a + 2; a = a * 3; b = c + a; }******************************* What is the output of the following code fragment that invokes calc? (All variables are of type int)************************* x = 1; y = 2; z = 3; calc(x, y); cout << x << " " << y << " " << z << endl;
6
100
4. The name of an array stores the ________ of the first array element.
memory address
100
An element of a two-dimensional array is referred to by ________ followed by ________.
the row subscript of the element, the column subscript of the element
200
When writing functions that accept multi-dimensional arrays as arguments, ________ must be explicitly stated in the parameter list.
all but the first dimension
200
An array that will hold 5 names with 20 characters in the name would be declared using which statement?
char names[5][21];
200
A(n) ________ search is more efficient than a(n) ________ search
binary, linear
200
A binary search begins with the ________ element of an array.
middle
200
Array elements must be ________ before a binary search can be performed.
sorted
300
When you work with a dereferenced pointer, you are actually working with:
the actual value of the variable whose address is stored in the pointer variable
300
The contents of pointer variables may be changed with mathematical statements that perform:
addition and subtraction
300
A pointer may be initialized with
the address of an existing variable
300
When the less than ( < ) operator is used between two pointer variables, the expression is testing whether:
the address of the first variable comes before the address of the second variable in the computer's memory
300
Look at the following statement:******* sum += *array++;************ This statement:
assigns the dereferenced pointer's value, then increments the pointer's address
400
Use the delete operator only on pointers that were:
created with the new operator
400
A function may return a pointer, but the programmer must ensure that the pointer:
still points to a valid object after the function ends
400
18. Which of the following statements is not valid C++ code?************** A) int ptr = int *num1; B) int ptr = &num1; C) float num1 = &ptr2; D) All of these are valid. E) All of these are invalid.
All of these are invalid.
400
Which of the following statements deletes memory that has been dynamically allocated for an array?
delete [ ] array;
400
A pointer variable is designed to store:
a memory address
500
Which statement displays the address of the variable num1?
cout << &num1;
500
Dynamic memory allocation occurs:
when a new variable is created at runtime
500
The statement int *ptr = new int;
assigns an address to the variable named ptr
500
It is good practice to:
test the pointer for the NULL address
500
f a variable uses more than one byte of memory, for pointer purposes its address is:
the address of the first byte of storage