CICS 97204

subject Type Homework Help
subject Pages 9
subject Words 1175
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 about symbolic constants and/or macros is true?
a) The effects of symbolic constants and macros, once defined, cannot be modified.
b) Preprocessor directive #removedef undefines a symbolic constant or macro.
c) The scope of a symbolic constant or macro is normally from its point of definition to
the end of the file, but this can be modified with a preprocessor directive.
d) A name can always be redefined with #define.
Q3: Two adjacent parameters are separated by what symbol?
a. Dot.
b. Comma.
c. Parentheses.
d. Braces.
. A structure of arrays is automatically passed __________.
a) by value
b) by reference
page-pf2
c) by aggregate
d) by masking
Each standard library has a corresponding __________.
(a) function
(b) variable type
(c) header file
(d) cd-rom
The special conversion specifier for printing addresses is __________.
a) %a
b) %m
c) %p
d) %loc
page-pf3
Which is not a capability of the string-handling library?
a) tokenizing strings
b) comparing strings
c) searching strings
d) inputting strings
Q2: Which class indicates that an error occurred in which an arithmetic result was
larger than the largest number that can be stored in the computer?
a. invalid_argument.
b. bad_exception.
c. out_of_range.
d. overflow_error.
page-pf4
The for statement header
for (i = 1; i < 100; ++i)
performs the body of the loop for
a) values of the control variable from 1 to 100 in increments of 1.
b) values of the control variable from 1 to 99 in increments of 1.
c) values of the control variable from 0 to 100 in increments of 1.
d) values of the control variable from 0 to 99 in increments of 1.
Q2: Assuming the following is the beginning of the constructor definition for class
BasePlus-CommissionEmployee which inherits from class Point,
BasePlusCommissionEmployee::BasePlusCommissionEmployee( string first,
string last, string ssn, double sales, double rate, double salary )
: CommissionEmployee( first, last, ssn, sales, rate )
The second line:
a. Invokes the CommissionEmployee constructor with arguments.
b. Causes a compiler error.
c. Is unnecessary because the CommissionEmployee constructor is called automatically.
d. Indicates inheritance.
page-pf5
Function fputs writes a __________ to a file.
a) character
b) stream
c) line
d) standard output
.1 Q1: Employee is a base class and HourlyWorker is a derived class, with a redefined
non-virtual print function. Given the following statements, will the output of the two
print function calls be identical?
HourlyWorker h;
Employee *ePtr = &h;
ePtr->print();
ePtr->Employee::print();
a. Yes.
b. Yes, if print is a static function.
c. No.
d. It would depend on the implementation of the print function.
page-pf6
Which of the following statements is false?
(a) Pointers should not be left uninitialized.
(b) When you use free to deallocate dynamically allocated memory, the pointer passed
to free is set to NULL.
(c) Undefined behavior occurs when you attempt to use free to deallocate dynamic
memory that was already deallocated
(d)Function malloc returns NULL if it's unable to allocate the requested memory.
If the loop-continuation condition in a for statement is initially false, ________.
(a) the body portion of the loop is not performed
(b) execution proceeds with the statement following the for statement
(c) both a and b
(d) none of the above
page-pf7
Which of the following is not a stream associated with C files?
(a) stdin
(b) stdout
(c) stdchar
(d) stderr
Q1: Which of the following is a difference between the read and write functions?
a. One performs formatted I/O and the other does not.
b. They take different types of parameters.
c. write and gcount are member functions of the same class, whereas read is not.
d. The failbit is set only with read.
Macros are defined
a) in an #include preprocessor directive
b) in a #define preprocessor directive
c) in a #macro preprocessor directive
page-pf8
d) using keyword #MACRO in a C function.
Which statement is true?
a) sprintf takes its input from a character array.
b) sprintf prints its output in string format on the screen.
c) sprintf stores its output in a character array.
d) sprintf is a secure version of printf.
Q1: The correct function name for overloading the addition (+) operator is:
a. operator+
b. operator(+)
c. operator:+
d. operator_+
page-pf9
If the field width is larger than the data being printed, the data will normally be
__________ within that field.
a) truncated
b) right justified
c) centered
d) left justified
Values printed with the conversion specifiers e, E and f are output with __________
digits of precision to the right of the decimal point by default.
a) 0
b) 1
c) 5
d) 6
page-pfa
A bitfield must be defined as a __________.
(a) int or unsigned
(b) char
(c) float
(d) long
Q1: Polymorphism is implemented via:
a. Member functions.
b. virtual functions and dynamic binding.
c. inline functions.
d. Non-virtual functions.
Three of the following expressions have the same value. Which of the following's value
is different from the others?
(a) *&Ptr
(b) &*Ptr
page-pfb
(c) *Ptr
(d) Ptr
The & operator can be applied to
(a) constants
(b) variables defined with the storage class register
(c) variables defined with the storage class static
(d) rvalues
Q2: If the function int volume( int x = 1, int y = 1, int z = 1 ); is called by the
expression volume( 3 ), how many default arguments are used?
a. None.
b. One.
c. Two.
d. Three.
page-pfc
In order to calculate the __________ of an array of values, the array must be sorted.
(a) median
(b) mode
(c) mean
(d) (a), (b), and (c)
Q1: Which of the following is not a difference between hex and setbase?
a. setbase is a parameterized stream manipulator and hex is not.
b. setbase is provided by a different header file than hex.
c. setbase(16) and hex have different effects on stream output.
d. setbase takes an argument but hex does not.
page-pfd
Q1: What will be output by the following statement?
cout << showpoint << setprecision(4) << 11.0 << endl;
a. 11
b. 11.0
c. 11.00
d. 11.000
Q3: The C++ compiler makes objects take up more space in memory if they:
a. Are derived from base classes.
b. Have virtual functions.
c. Have only protected members.
d. Are referenced by pointers.
In a switch statement
(a) a breakis required after each case
(b) multiple actions do not need to be enclosed in braces
page-pfe
(c) a defaultcaseis required
(d) a breakis required after the defaultcase
Let Bit1 = Bit2 = 1. Which of the following does not have the same result as the others?
(a) Bit1 & Bit2
(b) Bit1 | Bit2
(c) Bit1^Bit2
(d) ~(~Bit2)

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.