CDA 86355

subject Type Homework Help
subject Pages 10
subject Words 1818
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
The OR (||) operator
(a) has higher precedence than the AND (&&) operator
(b) stops evaluation upon finding one condition to be true
(c) associates from right to left
(d) is a ternary operator
A node can only be inserted __________ in a binary search tree.
a) as the root node
b) as a leaf node
c) as a parent node
d) as an ancestor node
An array is not ________.
(a) a consecutive group of memory locations
(b) indexed by integers
(c) pointer-based
page-pf2
(d) a dynamic entity
Q1: Nontype parameters are:
a. Unable to have default arguments.
b. Specified before the angle-bracket-enclosed type-parameter list.
c. Constants.
d. Required for class templates.
Lists, queues, stacks and trees are __________ data structures that may grow and shrink
as programs execute.
a) flexible
b) automatic
c) dynamic
d) static
page-pf3
a * ( b + c ) may also be written in C as
a) ab + ac
b) (a * b ) + c
c) a * b + c
d) a * b + a * c
Q1: To reset the format state of the output stream:
a. Call the reset member function.
b. Call the flags member function with the ios_base::fmtflags constant as the argument.
c. Save a copy of the fmtflags value returned by calling member function flags before
making any format changes, and then call flags again with that fmtflags value as the
argument.
d. You must manually apply each individual format change member function or stream
manipulator to restore the default format state.
page-pf4
Which statement is false?
a) It's necessary to include names of pointer arguments in function prototypes.
b) A function receiving an address as an argument must define a pointer parameter to
receive the address.
c) The compiler does not distinguish between a function that receives a pointer and a
function that receives a single-subscripted array.
d) The function must "know" whether it is receiving a single-subscripted array or
simply a single variable for which it is to perform simulated call by reference.
Q1: The other classes or functions that use a certain class are referred to as its:
a. Clients.
b.Data members.
c.Member functions.
d.Methods.
page-pf5
In bitwise manipulations, a mask is typically __________.
a) A floating point value with specific bits set to 1.
b) An integer value with specific bits set to 1.
c) An integer value with specific bits set to 0.
d) A floating point value with specific bits set to 0.
Which character handling library function returns true if its argument is a printing
character?
a) ispchar
b) isprintablechar
c) isprint
d) isprintchar
Q2: A constructor can specify the return type:
a. int.
b. string.
page-pf6
c. void.
d. A constructor cannot specify a return type.
________ iteration is sometimes called indefinite iteration.
(a) counter-controlled
(b) sentinel-controlled
(c) variable-controlled
(d) none of these
Which of the following does not initialize all of the array elements to 0?
(a)
int b[2][2];
b[0][0] = b[0][1] = b[1][0] = b[1][1] = 0;
(b) int b[2][2] = {0};
(c)
int b[2][2];
page-pf7
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < 2; ++j) {
b[i][j] = 0;
}
}
(d) all of the above initialize all of their elements to 0.
Which of the following statements is true?
(a) If the return value of function scanf matches the number of items that should have
been input, then all the inputs are valid.
(b) Even if a scanf operates successfully, the values read might still be invalid.
(c) When a program expects to receive input values in a specific range, you should
peform range checking on the inputs to ensure that the values received are indeed in
that range (e.g., in a program that expects grades in the range 0-100, you should check
that every grade is in that range).
(d)Both (b) and (c).
page-pf8
Which of the following statements is false?
(a) Dereferencing NULL pointers typically causes programs to crash.
(b) If a function parameter points to a value that will not be changed by the function,
const should be used to indicate that the data is constant.
(c) Attackers cannot execute code by dereferencing a NULL pointer.
(d)None of the above.
Recursion is memory-intensive because ________.
(a) it must occur numerous times before it terminates
(b) previous function calls are still open when the function calls itself and the arguments
of these previous calls still occupy space on the call stack
(c) many copies of the function code are created
(d) it requires large data values
Which statement about pointers is false?
a) They can be defined to point to objects of any data type.
b) The indirection operator * distributes to all comma-separated variable names in a
page-pf9
definition.
c) The letters Ptr in a pointer variable name are optional.
d) A pointer may be initialized to 0, NULL or an address.
A floating-point value always contains a __________.
a) decimal point
b) comma
c) plus sign
d) e or E
The unary * and __________ are complements of one another.
a) /
b) ^
c) &
d) |
page-pfa
The statement
printf( "%*.*f", 7, 2, 98.736 );
uses _______ for the precision, __________ for the field width and outputs the value
98.74 __________.
a) 7, 2, left justified
b) 2, 7, left justified
c) 2, 7, right justified
d) 7, 2, right justified
Passing a pointer to a pointer is called __________.
a) double direction
b) pointer passing
c) double indirection
d) indirection
page-pfb
Which statement about the standard streams is true?
a) The standard input stream must be connected to the keyboard.
b) The standard output stream must be connected to the screen.
c) The standard error stream is connected to the screen by default.
d) Streams may not be redirected.
Q2: Which of the following is not a kind of inheritance in C++?
a. public.
b. private.
c. static.
d. protected.
A recursive function is a function that ________.
page-pfc
(a) returns a double
(b) takes 3 arguments
(c) calls itself
(d) is inside of another function
Indentation in the if selection statement is ________.
(a) always mandatory
(b) always optional
(c) only mandatory if there is more than one statement following the if statement
(d) only optional if there is more than one statement following the if statement
Which statement about the i and d integer conversion specifiers is false?
a) They display a signed decimal integer (when used with printf).
b) They are identical when used with printf.
c) They are identical when used with scanf.
page-pfd
d) They display numbers without a decimal point.
memcmp would return ___________ for the call
memcmp("Hi, how are you?", "Hi, how are things?", 6);
(a) -1
(b) a negative number.
(c) zero.
(d) a positive number.
Which statement is true?
a) fseek searches for a record by its record key.
b) fseek sets the file position pointer to a specific byte location in the file.
c) fseek moves the read-write head on the disk to the location on disk that corresponds
to a specific location in a file.
d) fseek must immediately follow each call to fread or fwrite.
page-pfe
Q1: Which statement about operator overloading is false?
a. Operator overloading is the process of enabling C++'s operators to work with class
objects.
b. C++ overloads the addition operator (+) and the subtraction operator (-) to perform
differently, depending on their context in integer, floating-point and pointer arithmetic
with data of fundamental types.
c. You can overload all C++ operators to be used with class objects.
d. When you overload operators to be used with class objects, the compiler generates
the appropriate code based on the types of the operands.
Which statement about predefined symbolic constants is false?
a) The predefined symbolic constants and the defined identifier cannot be used in
#define or #undef directives.
b) __DATE__ is replaced by the date the source file is compiled.
c) __LINE__is used to specify the range of line numbers in the source file.
d) The identifiers for each of the predefined symbolic constants begin and end with two
underscores.
page-pff
The definition
int *count;
a) is a syntax error because only pointers can be defined with * notation.
b) is a compile-time error.
c) is a logic error.
d) is a correct definition of integer pointer count.
Which statement is false?
a) The brackets used to enclose the subscript of an array are not an operator in C.
b) To refer to a particular element in an array, we specify the name of the array and the
position number of the element in the array.
c) The position number within an array is more formally called a subscript.
d) "Array element seven" and the 'seventh element of an array" do not mean the same
thing. This is a frequent source of off-by-one errors.
page-pf10
Which of the following statements is false?
a) C is case sensitive.
b) Uppercase and lowercase letters are different in C.
c) identifier and IdEnTiFiEr are identical identifiers in C.
d) Identifiers can be of any length
Q3: Which statement about operator overloading is false?
a. New operators can never be created.
b. Certain overloaded operators can change the number of arguments they take.
c. The precedence of an operator cannot be changed by overloading.
d. Overloading cannot change how an operator works on built-in types.

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.