Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 4 out of 365 pages
Exam (elaborations)

Absolute C++ 6th Edition - Test Bank by Walter Savitch

Document preview thumbnail
Preview 4 out of 365 pages

This document contains the complete test bank for Absolute C++ (6th Edition) by Walter Savitch, offering a comprehensive set of multiple-choice, true/false, short-answer, and code-based questions with correct answers and explanations. All key topics are covered, including C++ syntax and structure, variables, data types, control flow, functions, arrays, pointers, classes and objects, inheritance, operator overloading, templates, exception handling, recursion, and the Standard Template Library (STL). Designed to assess both theoretical understanding and practical coding skills, this test bank is ideal for instructors and students in introductory and intermediate C++ programming courses.

Content preview

D?
VE
RO
PP
_A
IA
UV
ST

, Chapter 1 - Test Questions
These test questions are fill in the blank, multiple choice, and true-false. The multiple
choice questions may have more than one correct answer. There is one matching
question. Mark all of the correct answers for full credit.
True False questions require an explanation in addition to the true/false response, and, if
ST
false, also require a correction.

True False:
UV
Comment required.

1. OOP is an acronym that means Object Oriented Programming.
Answer: True.
IA
Explanation: OOP is currently popular and is a powerful programming technique for a
large class of problems.
_A
2. C++ not only supports OOP but also supports other programming styles.
Answer: True.
Explanation: C++ supports OOP and traditional procedure oriented programming.
PP
3. The namespace facility is a tool used that assists in the study of genealogy.
Answer: False.
Explanation: The namespace facility helps prevent the libraries from “preempting all the
RO
good names,” and allows us to use names we want whether the library has used them.
4. In C++ the variables Alpha, ALPHA and AlphA are the same identifier.
Answer: False.
Explanation: C++ is case sensitive, these are different identifiers.
VE
5. In C++ the compiler will infer the type intended for a variable from the context in
which the variable occurs.
Answer: False.
D
Explanation: C++ requires every identifier to be declared prior to use. The type is
?
specified in the declaration.
6. A C++ declaration introduces only an identifier's spelling and specifies its type.
Answer: True.
Explanation: A declaration introduces the spelling and type, whereas a definition is a

, Test Bank for Savitch Absolute C++ 6e Page 2


declaration that also allocates memory.
7. A C++ declaration is a definition that also allocates storage for an identifier's value
(or function's body etc.).
Answer: True.
Explanation: A declaration introduces the spelling and type, whereas a definition is a
ST
declaration that also allocates memory.
8. The range of values for an int variable is from about 0 to +2 billion.
Answer: False:
UV
Explanation: The correct range is about –2 Billion to +2 Billion.
9. The names x, y, and z are satisfactory variable names for the lengths of the legs and
hypotenuse of a triangle.
IA
Answer: False.
Explanation: Names should communicate to the human reader the meaning of the value.
_A
These identifiers do not communicate the meaning of their values..
10. In C++ you can assign an expression of type int to a variable of type double with
no problem.
PP
Answer: True.
Explanation: Assignment from an integer type to a floating point type can lose
information and should be avoided. Some compilers will warn, others may give an error
RO
message, but you should avoid this.
11. In C++ you can assign an expression of type double to a variable of type int with
no problem.
Answer: False.
VE
Explanation: In general assigning a floating point value to an integer variable mostly
loses information. A warning message (or an error message) is issued by C++ compilers.
D
12. To put a character into a cstring constant that causes the output to continue on the
next line, insert the escape sequence \t into the string constant.
?
Answer: False.
Explanation: \t is the tab escape sequence. Use \n instead.
13. If we execute this code in an otherwise correct and complete program:
n = 1;


©2016 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.

, Test Bank for Savitch Absolute C++ 6e Page 3

n = (n++) + (n++);
the value of n is guaranteed to be 3 after the second line executes.
Answer: False.
Explanation: Some compilers may give the value 3. The result of such code is dependent
on the compiler implementation. The C++ Standard says such code is illegal, and the
ST
Standard says the results are undefined, meaning the compiler can do anything with it
that suits the compiler writer. One of my compilers gives the value 4 to n.
14. If we execute the code fragment in an otherwise complete, correct program:
UV
n = 1;
cout << n++ << " " << n++ << " " << n++ << endl;
the output is guaranteed to be 1 2 3.
IA
Answer: False.
Explanation: The code is illegal because its execution depends on the order of evaluation
_A
of arguments. Various compilers give different answers. One compiler this writer uses
gives 3 2 1.
15. C++ uses only /* */ for comments.
PP
Answer: False.
Explanation: C++ uses /* */ comments and // “here to the end of the line”
comments.
RO
16. A program’s comments should connect the program code to the problem being
solved.
Answer: True.
Explanation: The purpose of comments in a program is to help the human reader of the
VE
code to connect the program to the problem being solved. Comments are so important
there is an aphorism, often quoted by expert programmers: “If the comments and the code
disagree, then both are probably wrong.
D
17. A program should have a comment on every line.
?
Answer: False.
Explanation: This would be satisfactory only on a very complicated assembly language
program for an inexperienced programmer.
18. Comments have no value whatsoever and do not belong in a program.


©2016 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.

Document information

Uploaded on
July 27, 2025
Number of pages
365
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$20.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Libgen
4.1
(36)
Sold
422
Followers
239
Items
1538
Last sold
1 week ago


Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions