COMPSCI 40173

subject Type Homework Help
subject Pages 9
subject Words 1794
subject Authors Harvey Deitel, Paul J. Deitel

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
Which statement is true of the << operator?
a) It's called the right shift operator.
b) It's called the bitwise right shift operator.
c) It shifts the bits of the second operand left by the number of bits specified by the first
operand.
d) It fills from the right with 0 bits.
Which of the following will not increment variable c by one?
(a) c + 1;
(b) c++;
(c) ++c;
(d) c += 1;
+, \ and $ are all examples of __________.
a) special characters
b) strings
page-pf2
c) operators
d) literals
Which statement is false?
a) The unary * operator is called the indirection operator or the dereferencing operator.
b) The operand of the unary * operator must be a pointer.
c) The unary * operator returns the value of its operand.
d) Placing a * operator before a pointer dereferences the pointer.
Q1: Which of the following statements restores the default fill character?
a. cout.defaultFill();
b. cout.fill();
c. cout.fill( 0 );
d. cout.fill( ' ' );
page-pf3
Which of the following does counter-controlled iteration not require?
(a) an initial value
(b) a condition that tests for the final value
(c) an increment or decrement by which the control variable is modified each time
through the loop
(d) counter controlled iteration requires all of the above
Macros
a) can help avoid the overhead of a function call.
b) execute before a program is compiled.
c) never add subtle bugs to programs.
d) cannot be used to replace a function call with inline code.
page-pf4
Which of the following is false with regard to pointers to functions?
(a) They contain the starting address of the function code.
(b) They"re dereferenced in order to call the function.
(c) They can be stored in arrays.
(d) They cannot be assigned to other function pointers
Which statement is false?
a) A recursive function is a function that calls itself either directly or indirectly through
another function.
b) A recursive function knows how to solve only one or more base cases.
c) The recursion step executes after the original call to the function terminates.
d) In order for the recursion to eventually terminate, each time the function calls itself
with a slightly simpler version of the original problem, this sequence of smaller and
smaller problems must eventually converge on a base case.
Conversion specifier s requires a(n) __________ argument.
a) pointer to char
page-pf5
b) char
c) integer
d) ASCII numeric
.2 Q1: Which of the following assignments would be a compilation error?
a. Assigning the address of a base-class object to a base-class pointer.
b. Assigning the address of a base-class object to a derived-class pointer.
c. Assigning the address of a derived-class object to a base-class pointer.
d. Assigning the address of a derived-class object to a derived-class pointer.
Q1: Problems using switch logic to deal with many objects of different types do not
include:
a. Forgetting to include an object in one of the cases.
b. Having to update the switch statement whenever a new type of object is added.
c. Having to track down every switch statement to do an update of object types.
d. Not being able to implement separate functions on different objects.
page-pf6
Q1: Returning references to non-const, private data:
a. Allows private functions to be modified.
b. Is only dangerous if the binary scope resolution operator (::) is used in the function
prototype.
c. Allows private member variables to be modified, thus "breaking encapsulation."
d. Results in a compiler error.
Which is not a motivation for "functionalizing" a program?
a) The divide-and-conquer approach makes program development more manageable.
b) Software reusabilityusing existing building blocks to create new programs.
c) Avoid repeating code.
d) Execution performancefunctionalized programs run faster.
page-pf7
Which of these is generally thought of as a high-performance technique?
a) bubble sort
b) linear search
c) binary search
d) iteration
Indefinite iteration is controlled by a
(a) counter
(b) sentinel value
(c) data value
(d) non-constant condition
Q2: For a class template, the scope resolution operator (::) is needed:
page-pf8
a. Only in the definitions of the member functions defined outside the class.
b. Both in the prototype and definition of a member function.
c. Only if multiple class-template specializations will be created from this class
template.
d. In neither the definition nor prototype of member functions.
Q2: Utility functions:
a. Are private member functions that support operations of the class's other member
functions.
b. Are part of a class's interface.
c. Are intended to be used by clients of a class.
d. Are a type of constructor.
Q1: Which of the following is not true of a constructor and destructor of the same class?
a. They both have the same name aside from the tilde (~) character.
page-pf9
b. They are both usually called once per object created.
c. They both are able to have default arguments.
d. Both are called automatically, even if they are not explicitly defined in the class.
The #undef preprocessor directive
(a) can only be used once per macro name.
(b) can only be used on symbolic constants.
(c) allows macros to be redefined with #define later in the program.
(d) must be called for all symbolic constants before the end of the file.
Q1: The inline keyword:
a. Increases function-call overhead.
b. Can reduce a function's execution time but increase program size.
c. Can decrease program size but increase the function's execution time.
d. Should be used with all frequently used functions.
page-pfa
Functions are __________ by a function call.
a) inveigled
b) invoked
c) internalized
d) inverted
Which is not always required by counter-controlled iteration?
a) The name of a control variable (or loop counter).
b) The initial value of the control variable.
c) The decrement by which the control variable is modified each time through the loop.
d) The condition that tests for the final value of the control variable (i.e., whether
looping should continue.
page-pfb
Q1: The putback member function returns to the input stream the previous character
obtained by:
a. A get from the input stream.
b. Using the stream extraction operator on the input stream.
c. Reading input from the keyboard.
d. Reading a file from disk.
The statement
y = &yPtr;
a) assigns the address of the variable y to pointer variable yPtr.
b) assigns the address of the variable yPtr to pointer variable y.
c) is a compilation error.
d) is a logic error.
Q7[C++11]: To prevent class objects from being copied or assigned, you can:
a. Declare as private the class's copy constructor and overloaded assignment operator.
page-pfc
b. Declare the class's copy constructor and overloaded assignment operator with with =
delete after the parameter list.
c. Simply do not declare a copy constructor or assignment operator in the class.
d. (a) or (b).
. Which statement is false?
a) assert is a useful debugging tool for testing if a variable has a correct value
b) If NDEBUG is defined, only the next assertion is ignored.
c) The assert macro is defined in the assert.h header file.
d) One problem with using assert is that if the assertion is false, program execution is
terminated; in some situations it is more appropriate to allow the program to continue
executing after the program has dealt with the problem.
The ___________ function allows characters of one part of a string to be copied into
another part of the string.
(a) memchr
(b) memcmp
(c) memset
page-pfd
(d) memmove
Which line has the most tokens?
(a) I like C.
(b) I like C++ better.
(c) I like C + +.
(d) I prefer Java.
Which character-handling library function returns a true value if its argument is a letter
and 0 otherwise?
a) isalphanumeric
b) isalphabetic
c) isalpha
d) isletter
page-pfe
A pointer to a function contains __________.
a) the address of the function's automatic variables
b) the address of the function on the stack
c) the address of the entry for that function in the System Function Table
d) the address of the function in memory
Which of the following is not a bitwise operator?
(a) ^
(b) &
(c) ~
(d) *

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.