COP 86059

subject Type Homework Help
subject Pages 9
subject Words 1561
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
Q2: Which of the following preprocessor directives does not constitute part of the
preprocessor wrapper?
a. #define
b. #endif
c. #ifndef
d. #include
Q1: When composition (one object having another object as a member) is used:
a. The host object is constructed first and then the member objects are placed into it.
b. Member objects are constructed first, in the order they appear in the host
constructor's initializer list.
c. Member objects are constructed first, in the order they are declared in the host's class.
d. Member objects are destructed last, in the order they are declared in the host's class.
Which statement is false?
a) Any expression in C that produces a value can be used in the decision portion of any
control statement.
page-pf2
b) When tested for truth or falsity, an expression that produces a nonzero value is
treated as true.
c) Assignments in C produce a value, namely the value that the left-hand side of the
assignment had prior to the assignment.
d) Operator == is for comparisons; operator = is for assignment.
Q1: Which of the following would not be a member function that derived classes Fish,
Frog and Bird should inherit from base class Animal and then provide their own
definitions for, so that the function call can be performed polymorphically?
a. eat
b. sleep
c. move
d. flapWings
All functions in the math library return the data type __________.
a) float
b) int
page-pf3
c) long
d) double
Q1: Which of the following statements is not true about C++ input/output (I/O)
features?
a. C++ allows users to specify I/O for their own data types.
b. C++ automatically calls the correct I/O operations for standard types.
c. C++ has some object-oriented I/O features.
d. C++ borrowed its type safe I/O capabilities from C.
Which statement is true?
a) Connecting flowchart symbols arbitrarily always forms structured programs.
b) In a structured program, control statements can only be stacked or sequenced.
c) In the "Rules for Forming Structured Programs (and Structured Flowcharts)," the rule
that states, "Any rectangle (action) can be replaced by any control statement" is called
the "nesting rule."
d) Structured programming does not improve the program-development process.
page-pf4
Q6: A class's functions can throw exceptions, such as __________to indicate invalid
data.
a. invalid_data
b. bad_data
c. invalid_argument
d. bad_argument
__________ is not allowed.
(a) Accessing individual bits in a multi-bit bitfield.
(b) Padding a bitfield with bits that cannot be accessed
(c) Having an unnamed bitfield.
(d) Having a bitfield with a zero width.
page-pf5
Referencing a value through a pointer is called __________.
a) interdiction
b) indirection
c) intermediation
d) redirection
Which is not a capability of the preprocessor?
a) inclusion of other files in the file being compiled
b) definition of functions
c) definition of symbolic constants
d) definition of macros
The most basic unit of data on a computer is the
(a) bit.
(b) byte.
page-pf6
(c) file.
(d) int.
Pseudocode does not typically include __________.
(a) definitions
(b) input/output
(c) action statements
(d) control statements
Q2: Which of the following is not true of object-oriented design?
a. OOD takes advantage of inheritance relationships.
b.OOD encapsulates attributes and operations into objects.
c.OOD focuses on actions (verbs).
d.Each class can be used to create multiple objects.
page-pf7
If bPtr is assigned b (the name of an array), then array element b[3] can alternatively be
referenced with the pointer expression __________.
a) bPtr + 3
b) b[bPtr + 3]
c) *b [bPtr + 3]
d) *(bPtr + 3)
Which of the following statements is true?
(a) hardware controls software
(b) software commands the computer to perform actions and make decisions
(c) C is an object oriented programming language
(d)Both (b) and (c)
page-pf8
Which of the following statements is true?
(a) Function scanf does not return a value.
(b) You should never check the return value of function scanf.
(c) You should check the return value of function scanf to ensure that the value it
returns matches the number of items that should have been input.
(d)None of the above.
Which statement is true?
a) Assigning a value to a symbolic constant in an executable statement is a syntax error.
b) A symbolic constant is a variable.
c) Space is reserved for both symbolic constants and variables that hold values at
execution time.
d) Only uppercase letters can be used for symbolic constant names.
Which statement is generally false?
a) Initializing pointers is optional.
b) Dereferencing an uninitialized pointer could lead to a fatal execution time error.
page-pf9
c) Deferencing an uninitialized pointer could accidentally modify important data.
d) Derefencing an uninitialized pointer causes a syntax error.
Which of the following can have a pointer as an operand?
(a) ++
(b) *=
(c) %
(d) /
Q2: Assuming that the string object text contains the string "Hello!!! ", the "expression
text.substr( 2 , 5 ) would return a string object containing the string:
a. "llo!! ".
b. "llo! ".
c. "ello! ".
d. "ello".
page-pfa
. __________ are collections of related variablessometimes referred to as
aggregatesunder one name.
a) Members
b) Enumerations
c) Structures
d) Files
Which is not a common programming error with regard to the character and string
conversion specifiers.
a) Using %c to print a string.
b) Using %s to print a char argument
c) Using double quotes around a character string
d) Using double quotes around a character constant
page-pfb
The %e conversion specifier displays ________ values.
(a) long
(b) character
(c) integer
(d) floating-point
__________ memory allocation is the ability for a program to obtain more memory
space at execution time and to release space no longer needed.
a) Static
b) Active
c) Selective
d) Dynamic
Conversion specifiers g or G always print __________.
a) no trailing zeros
page-pfc
b) one trailing zero
c) as many trailing zeros as are in the number itself
d) a default of six trailing zeros
Which of the following is true?
a) Any bit "ANDed" with 0 yields 0.
b) Any bit "ANDed" with 1 yields 1.
c) Any bit "ANDed" with 0 yields 1.
d) Any bit "ANDed" with 1 yields 0.
Which of these is not a valid identifier?
a) a_valid_identifier
b) a1_valid_identifier
c) a_valid_identifier_
d) 1_valid_identifier
page-pfd
int square(int); is an example of a function __________.
a) datatype
b) stereotype
c) prototype
d) proceduretype
The __________ directive prints out a message.
(a) #error
(b) #pragma
(c) all of the above
(d) none of the above.
page-pfe
Q5: To prevent class objects from being copied:
a. Make the overloaded assignment operator private.
b. Make the copy constructor private.
c. Both (a) and (b).
d. None of the above.
Which statement is true?
a) Function fprintf is equivalent to printf.
b) Function fprintf is equivalent to printf except that fprintf also receives as an
argument a file pointer for the file to which the data will be written.
c) Function fprintf is equivalent to printf except that fprintf also receives as an argument
a file control block for the file to which the data will be written.
d) Function fprintf is equivalent to printf except that fprintf also disables the file
end-of-file indicator.
Q1: The purpose of stack unwinding is to:
a. Attempt to catch exceptions that are not caught in their scope.
page-pff
b. Improve catchblocks by allowing them to handle multiple exceptions.
c. Return control to the function that created the exception.
d. Aid the terminate command in shutting down the program.
Consider the following correct segment of a correct C program:
p = 2;
while (p < 2000) {
p = 2 * p;
}
What is the value of p after this while loop completes its execution?
a) 1023
b) 1024
c) 2047
d) 2048

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.