CS 46708

subject Type Homework Help
subject Pages 9
subject Words 998
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 false?
a) Structures are derived data types.
b) Each structure definition must end with a semicolon.
c) A structure can contain an instance of itself.
d) Structures may not be compared using operators == and !=.
Which statement is false?
a) The assignment operator associates from left to right.
b) The arithmetic operators associate from left to right.
c) The equality operators associate from left to right.
d) The relational operators associate from left to right.
Which statement is false?
a) in the statement
sum = integer1 + integer2;
both = and + are binary operators.
page-pf2
b) The statement in part a) is an example of an assignment statement.
c) The spaces around each of the binary operators in the statement of part a) are
required.
d) In part a), the = operator's two operands are sum and the value of the expression
integer1 + integer2.
Operator ##
a) concatenates two tokens in a macro definition.
b) is a relational operator.
c) is the conditional-compilation operator.
d) is the symbolic-constant operator.
A programmer writes a for statement to count from 1 to 10 and explicitly mentions the
1 and the 10 in the for "header." Which relational operator would probably be used in
the loop-continuation test?
a) >
b) >=
page-pf3
c) <
d) <=
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) int * const a
The only identifiers that can be reused elsewhere in a program without any ambiguity
are
(a) global variables
(b) static local variables
(c) those in the parameter list of a function prototype
(d) those in the parameter list of a function definition
page-pf4
Q2: C++ is a:
a.Typeless language.
b.Hybrid object-oriented language.
c.Subset of the C Language.
d.Pure object-oriented language.
Which of the following is not an indication that a function may be too complex?
(a) it has a large size
(b) it has a large parameter list
(c) its name is a clear reflection of its function
(d) it performs multiple tasks
page-pf5
The function atexit takes as an argument
(a) the line number of where the program should exit
(b) a function that is executed when the program is exited unsuccessfully
(c) a function to be called when the program ends successfully
(d) normally the symbolic constant EXIT_SUCCESS or EXIT_FAILURE
Having a loop within a loop is known as
(a) recursion
(b) doubling up
(c) nesting
(d) a redundancy
Which of the following is not included in <math.h>?
(a) pow
(b) floor
(c) ln
page-pf6
(d) log10
Q2: Abstract classes:
a. Contain at most one pure virtual function.
b. Can have objects instantiated from them if the proper permissions are set.
c. Cannot have abstract derived classes.
d. Are defined, but the programmer never intends to instantiate any objects from them.
What is produced by a for statement with a correct body and with the following header
for (i = 20; i >= 2; i += 2)
a) a syntax error
b) a divide-by-zero error
c) an infinite loop
d) the even values of i from 20 down to 2.
page-pf7
Variable names actually correspond to __________.
(a) locations in the computer's memory
(b) operators
(c) integers
(d) data types
Q2: When compiling a class's source code file (which does not contain a main
function), the information in the class's header file is used for all of the following,
except:
a. Ensuring that the header of each member function matches its prototype.
b. Ensuring that each member function knows about the class's data members and other
member functions.
c. Determining the correct amount of memory to allocate for each object of the class.
d. All of the above are uses that the compiler has for the header file information.
page-pf8
An example of a unary operator is
(a) a relational operator
(b) an assignment operator
(c) an increment operator
(d) a logical operator
Q1: Attributes of a class are also known as:
a. Constructors.
b. Local variables.
c. Data members.
d. Classes.
The preprocessor directive
page-pf9
#pragmatokens
a) prints only the tokens specified in the message.
b) prints the word pragma followed by the tokens specified in the message.
c) causes an implementation-defined action.
d) prints an implementation-defined message including the tokens specified in the
directive.
.4 Q1: If objects of all the classes derived from the same base class all need to draw
themselves, the draw function would most likely be declared:
a. private
b. virtual
c. protected
d. friend
.3 Q1: Downcasting enables:
a. A derived-class object to be treated as a base-class object.
b. A base-class object to be treated as a derived-class object.
page-pfa
c. Making a base-class pointer into a derived-class pointer.
d. Making a derived-class pointer into a base -class pointer.
An unnamed bit field with a zero width is used to __________.
a) purge a bit from a bit field
b) initialize a bit field to 0.
c) concatenate two bit fields.
d) align the next bit field on a new storage unit boundary.
The bitwise operators can be used to manipulate the bits of variables of type
__________.
a) float
b) double
c) long
d) long double
page-pfb
Which statement is true?
a) The type of every parameter in a function parameter list must be included.
b) The type of every argument in a function call must be included.
c) It is not incorrect to use the same names for the arguments passed to a function and
the corresponding parameters in the function definition.
d) Defining a function parameter again as a local variable within the function is a logic
error.
The maximum number of comparisons needed for the binary search of a 2000 element
array is
(a) 9
(b) 15
(c) 11
(d) 14
page-pfc
A shorthand for #if !defined is
a) #ifndef
b) #ifnotdef
c) #ifnotdefined
d) #ifndf
Q1: To execute multiple statements when an if statement's condition is true, enclose
those statements in a pair of:
a. Parentheses, ( ).
b. Square Brackets, [ ].
c. Braces, { }.
d. Angle brackets, < >.
Q1: Member access specifiers (public and private) can appear:
a. In any order and multiple times.
page-pfd
b. In any order (public first or private first) but not multiple times.
c. In any order and multiple times, if they have brackets separating each type.
d. Outside a class definition.
Macros have the disadvantage, when compared to functions, of
(a) having the overhead of a function call.
(b) increasing program size (if the macros are called from many places in the program).
(c) having to fit the macro definition on a single line.
(d) taking only one argument.
The least access privilege is granted by a __________ pointer to __________ data.
a) non-constant, non-constant
b) non-constant, constant
c) constant, non-constant
d) constant, constant

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.