CDA 30865

subject Type Homework Help
subject Pages 11
subject Words 849
subject Authors Harvey Deitel, Paul Deitel

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
Which of the following statements is false?
a. Variables or functions listed after the public access specifier (and before the next
access specifier, if there is one) are "available to the public." They can be used by other
functions in the program, and by member functions of other classes.
b. By default, everything in a class is private, unless you specify otherwise.
c. You must list an access specifier for every member.
d. Declaring data members private is known as data hiding. private data members are
encapsulated (hidden) in an object and can be accessed only by member functions of
the object's class.
A string array is commonly used for:
a. Command-line arguments.
b. Storing an extremely long string.
c. Storing multiple copies of the same string.
d. Displaying floating-point numbers to the screen.
page-pf2
A main function can "drive" an object by calling its member functionswithout knowing
how the class is implemented. In this sense, main is referred to as a(n) ________
program.
a. manipulator
b. driver
c. controller
d. operator
Which of the following statements is true?
a. The compiler knows about fundamental types that are "built into" C++.
b. A new type that you create is known as a user-defined type.
c. New classes, when packaged properly, can be reused by other programmers.
d. All of the above are true.
Which of the following operations has the highest precedence?
a. Postincrement.
b. Multiplication.
page-pf3
c. Addition.
d. Assignment.
Which of the following statements is false?
a. Object-oriented programming is today's key programming methodology.
b. C++ is one of today's most popular software development languages.
c. Software commands computer hardware to perform tasks.
d. In use today are more than a trillion general-purpose computers and trillions more
cellphones, smartphones and other handheld devices.
Which of the following for headers is not valid?
a. for (int i{0}; i < 10; i++)
b. int i{0}; for (; i < 10; i++)
c. for (int i{0}; int j{5}; ; i++)
page-pf4
d. All of the above.
The ________ object enables a program to read data from the user.
a. std::cout.
b. std::cin.
c. std::cread.
d. std::cget.
Which of the following data types can be used to represent integers?
a. char
b. long
c. short
d. All of the above.
page-pf5
________ is a graphical language that allows people who design software systems to
use an industry standard notation to represent them.
a. The Unified Graphical Language
b. The Unified Design Language
c. The Unified Modeling Language
d. None of the above
Which of the following expressions returns the trigonometric sine of x?
a. sin(x).
b. sine(x).
c. trig_sin(x).
d. trig_sine(x).
page-pf6
Which of the following is true?
a. Assigning a double value to an int does not lose any data.
b. For fundamental-type variables, list-initialization syntax prevents narrowing
conversions that could result in data loss.
c. For fundamental-type variables, list-initialization syntax allows narrowing
conversions that could result in data loss.
d. None of the above.
The creates object code and stores it on disk.
a. Interpreter.
b. Compiler.
c. Preprocessor.
d. Loader.
A reference parameter:
a. Is an alias for its corresponding argument.
page-pf7
b. Is declared by following the parameter's type in the function prototype by an
ampersand (&).
c. Cannot be modified.
d. Both (a) and (b).
Which of the following statements is false?
a. A constructor that specifies a single parameter should be declared implicit.
b. A constructor does not specify a return type, because constructors cannot return
values.
c. Constructors cannot be declared const (because initializing an object modifies it).
d. None of the above statements is false.
What will the following program segment do?
int counter{1};
do
{
page-pf8
cout << counter << " ";
} while (++counter <= 10);
a. Print the numbers 1 through 11.
b. Print the numbers 1 through 10.
c. Print the numbers 1 through 9.
d. Cause a syntax error.
C++ Standard Library function getline, from the <string> header, reads characters up to,
but not including, a(n)________ (which is discarded), then places the characters in a
string.
a. tab
b. period
c. newline
d. \
What happens when two blocks, one nested inside of the other, both declare variables
with the same identifier? (Assume that the outer block declares its variable before the
opening left-brace of the inner block.)
page-pf9
a. A syntax error occurs.
b. The "outer" variable is hidden while the "inner" variable is in scope.
c. The "outer" variable is irretrievably lost when the "inner" variable is declared.
d. The "inner" declaration is ignored and the "outer" variable has scope even inside the
inner block.
Which of the following statements is false?
a. Cloud computing allows you to use software, hardware and information stored in the
"cloud"i.e., accessed on remote computers via the Internet and available on
demandrather than having it stored on your personal computer.
b. Cloud computing services allow you to increase or decrease resources to meet your
needs at any given time, so they can be more cost effective than purchasing expensive
hardware to ensure that you have enough storage and processing power to meet your
needs at their peak levels.
c. Businesses using cloud computing services must still manage the applications, which
can be costly.
d. Both (a) and (c).
page-pfa
Recursion is memory-intensive because:
a. Recursive functions tend to declare many local variables.
b. Previous function calls are still open when the function calls itself and the activation
records 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.
Using square brackets ([]) to retrieve vector elements __________ perform bounds
checking; using member function at to retrieve vector elements __________ perform
bounds checking.
a. Does not, does not.
b. Does not, does.
c. Does, does not.
d. Does, does.
page-pfb
Which of the following is a poor programming practice?
a. Indenting the statements in the body of each control structure.
b. Using floating-point values for counters in counter-controlled iteration.
c. Nesting multiple iteration structures.
d. Placing vertical spacing above and below control structures.
Files ending in .cpp are known as ________ files.
a. executable
b. secure C++
c. source-code
d. class
In order to calculate the __________ of an array of values, the array values must first be
summed.
a. Average.
b. Minimum.
page-pfc
c. Maximum.
d. Distribution.
If x initially contains the value 3, which of the following sets x to 7?
a. x ++ 4;
b. x += 4;
c. x =+ 4;
d. x + 4 = x;
The & operator can be applied to:
a. constants.
b. string literals.
c. lvalues.
d. rvalues.
page-pfd
Which of the following statements is false?
a. The keyword private is an access specifier.
b. Access specifiers are always followed by a semicolon (;).
c. A private data member is accessible only to its class's member functions.
d. Most data-member declarations appear after the private access specifier.
Call-by-reference can achieve the security of call-by-value when:
a. The value being passed is small.
b. A large argument is passed in order to improve performance.
c. A pointer to the argument is used.
d. The const qualifier is used.
page-pfe
What value does function mystery return when called with a value of 4?
int mystery (int number)
{
if (number <= 1) {
return 1;
}
else {
return number * mystery(number " 1);
}
}
a. 0.
b. 1.
c. 4.
d. 24.
Which of the following statements about the Boost Libraries is false?
a. They are free.
b. They are open source.
c. They are peer reviewed and portable.
d. They are automatically included in the latest C++ Standard Library.
page-pff
Which of the following is not a key organization in the open-source community?
a. Apache.
b. SourceForge.
c. Firefox.
d. Eclipse.
Which of the following statements is false?
a. The impressive functions performed by computers involve only the simplest
manipulations of 1s and 2s.
b. ASCII is a popular subset of Unicode.
c. Fields are composed of characters or bytes.
d. On some operating systems, a file is viewed simply as a sequence of bytes.
page-pf10
Of the following, which is not a logic error?
a. Not placing curly braces around the body of an if that contains two statements.
b. Using == to assign a value to a variable.
c. Failing to initialize counter and total variables before the body of a loop.
d. Using commas instead of the two required semicolons in a for header.
The rand function generates a data value of the type:
a. unsigned int.
b. int.
c. long int.
d. short int.
page-pf11
Which of the following statements creates a uniform_int_distribution object for
producing values in the range -10 to 20?
a. uniform_int_distribution<unsigned int> randomInt{20, -10};
b. uniform_int_distribution<unsigned int> randomInt{-10, 20};
c. uniform_int_distribution<int> randomInt{20, -10};
d. uniform_int_distribution<int> randomInt{-10, 20};

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.