CAPP 73876

subject Type Homework Help
subject Pages 9
subject Words 278
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
Pointers cannot be used to
(a) find the address of a variable in memory.
(b) reference values directly.
(c) simulate call-by-reference.
(d) manipulate dynamic data structures.
Q2: Which of the following is false about the following function prototype?
void functionA( void );
a. It does not receive any arguments.
b. It could have been written void functionA( );.
c. It does not return a value.
d. It could have been written functionA( void );.
Which statement prints "hi" on the screen?
(a) puts("hi");
(b) put "hi";
page-pf2
(c) puts "hi";
(d) none of the above
. const variables are preferred to symbolic constants (from #define) because
(a) constvariables take up less memory.
(b) symbolic constants can be changed.
(c) const variable names are visible to the compiler
(d) const variables do not have to be of a specific data type.
. Which of the following is not a valid operation on a structure?
a) Assigning structure variables to structure variables of the same type.
b) Taking the address of a structure variable.
c) Using the sizeof operator to determine the size of a structure variable.
d) Comparing structures of the same type with relational operators.
page-pf3
Programs that directly execute high-level language programs without compiling are
called __________.
(a) assemblers
(b) interpreters
(c) compilers
(d) translators
Q1: What will be output by the following statements?
double x = .0012345;
cout << fixed << x << endl;
cout << scientific << x << endl;
a. 1.234500e-003
0.001235
b. 1.23450e-003
0.00123450
c. .001235
1.234500e-003
page-pf4
d. 0.00123450
1.23450e-003
When a called function completes its task, it normally
a) terminates program execution normally
b) aborts program execution
c) logs its results
d) returns to the calling function
Which statement is true?
a) || is the bitwise or operator,
b) | is the logical or operator
c) Operators || and | are interchangeable.
d) || and | are each binary operators.
page-pf5
What is wrong with the following loop?
While (sum <= 1000) {
sum = sum + 30;
}
(a) The parenthesis should be braces.
(b) The braces around sum = sum +30; should be removed.
(c) While should be while.
(d) There should be a semicolon after While (sum <=1000).
Which operator sets the bits in the result to 1 only when the corresponding bits in the
two operands are both 1?
a) bitwise AND
b) bitwise inclusive OR
c) bitwise exclusive OR
d) bitwise complement
page-pf6
. The two key attributes of an algorithm are:
a) actions and start activity
b) flow and order of flow
c) actions and order of actions
d) flow and start activity
Q1: What mistake prevents the following class declaration from functioning properly as
an abstract class?
class Shape
{
public:
virtual double print() const;
double area() const { return base * height; }
private:
double base;
double height;
};
a. There are no pure virtual functions.
page-pf7
b. There is a non-virtual function.
c. private variables are being accessed by a public function.
d. Nothing, it functions fine as an abstract class.
An ancestor of today's Internet was _____________.
(a) ARPAnet
(b) e-mail
(c) PHP
(d) TCP/IP
Which statement is true?
a) Unless directed otherwise, the computer automatically executes C statements one
before the other.
b) The sequence structure is essentially built into C.
c) A flowchart is a pseudocode representation of an algorithm or a portion of an
algorithm.
page-pf8
d) Like pseudocode, flowcharts are useful for developing and representing algorithms,
although flowcharts are preferred by most programmers.
Q1: The line:
virtual double functionX() const = 0;
in a class definition indicates that the class is probably a:
a. Base class.
b. Derived class.
c. Protected class.
d. Library class.
. The expression aptr->suit is equivalent to __________.
a) aptr.suit
b) *aptr.suit
c) (*aptr).suit
d) *aptr.(suit)
page-pf9
Which statement is true?
a) Arrays are automatically initialized to zero.
b) To initialize all array elements to zeros, the array definition must explicitly initialize
each element to zero.
c) Array elements can be initialized to zero by the array definition only at compile time.
d) Definitions for automatic arrays initialize the arrays at execution time.
Q3: Member function definitions:
a. Always require the scope resolution operator (::).
b. Require the scope resolution operator only when being defined outside of the
definition of their class.
c. Can use the scope resolution operator anywhere, but become public functions.
d. Must use the scope resolution operator in their function prototype.
page-pfa
When used with integer conversion specifiers, the letters h and l ("el") are called
__________.
a) height modifiers
b) length modifiers
c) complements
d) adjustors
Q1: Suppose the unary ! operator is an overloaded member function of class String. For
a String object s, which function call is generated by the compiler when it finds the
expression !s?
a. s.operator!()
b. s.operator!( default_value1, default_value2,)
c. operator!( s )
d. A compiler error results because no arguments are given.
page-pfb
If a dowhile statement is used,
(a) an infinite loop will not take place
(b) the counter must be preincremented if it's also the condition
(c) the body of the loop will execute at least once
(d) an off-by-one error will not occur
Queues are linear data structures with the property that queue nodes are inserted only at
the tail of the queue and removed only from the head of the queue. For this reason,
queues are referred to as __________ data structures.
a) first-in, first-out
b) first-in, last-out
c) last-in, first-out
d) first-come, first-served
Which statement is false?
a) Cast expressions cannot be evaluated in preprocessor directives.
b) Arithmetic expressions cannot be evaluated in preprocessor directives.
page-pfc
c) sizeof expressions cannot be evaluated in preprocessor directives.
d) Enumeration constants cannot be evaluated in preprocessor directives.
Q2: Assuming that all four of the following functions are defined, which one will be
called by the function call square( 23. )?
a. template< typename T >
T square( T num )
b. template< typename T1, typename T2 >
T1 square( T1 num1, T2 num2 )
c. int square( int num )
d. double square( double num )
Q1: Exception handling may allow a program to:
a. Terminate in a controlled manner.
b. Be more robust and fault-tolerant.
c. Continue executing as if no problem was encountered.
page-pfd
d. All of the above.
The functions of the character-handling library typically manipulate characters as
___________.
(a) ints.
(b) floats.
(c) longs.
(d) bits.
Which of the following is most closely associated with Moore's Law?
(a) Every year or two, the price of computers has approximately doubled.
(b) Object-oriented programming uses less memory than previous
software-development methodologies.
(c) Demand for communications bandwidth is decreasing dramatically each year.
(d) Every year or two, the capacities of computers have approximately doubled without
any increase in price.
page-pfe
Q2: Which of the following is true about using inheritance in software engineering?
a. Common attributes and behaviors should be factored out of closely related classes
and placed into a base class from which the original classes can now inherit.
b. It is best to create a huge class library to make it easy for a client to find the most
appropriate class for his or her needs.
c. A class produced through inheritance should be as large as possible to fully
encompass all of the functionality it should offer.
d. The standard C++ libraries that are shipped with C++ compilers are usually enough
to accomplish anything an application might need to do.
Which statement about comments is false?
a) Comments begin and end with /* and */, respectively.
b) Programmers insert comments to document programs and improve program
readability.
c) Comments do not cause any machine language object code to be generated.
d) Lengthy comments can cause poor execution-time performance.
page-pff
Global variables and function names are of storage class __________ by default.
a) register
b) extern
c) static
d) auto

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.