978-1337102087 Chapter 7

subject Type Homework Help
subject Pages 9
subject Words 464
subject Authors D. S. Malik

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
Name:
Class:
Date:
Copyright Cengage Learning. Powered by Cognero.
Page 1
1. The following is a legal C++ enumeration type:
enum colorType {BLUE, GREEN, PINK, YELLOW, RED};
a.
True
b.
False
ANSWER:
True
POINTS:
1
REFERENCES:
469
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:40 PM
DATE MODIFIED:
10/5/2016 1:40 PM
2. The following is a valid C++ enumeration type:
enum places {1ST, 2ND, 3RD, 4TH};.
a.
True
b.
False
ANSWER:
False
POINTS:
1
REFERENCES:
469
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:40 PM
DATE MODIFIED:
10/5/2016 1:40 PM
3. No arithmetic operations are allowed on the enumeration type.
a.
True
b.
False
ANSWER:
True
POINTS:
1
REFERENCES:
469
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:40 PM
DATE MODIFIED:
10/5/2016 1:40 PM
4. A function cannot return the value of an enumeration type.
a.
True
b.
False
ANSWER:
False
POINTS:
1
REFERENCES:
475
page-pf2
Name:
Class:
Date:
page-pf3
Name:
Class:
Date:
page-pf4
Name:
Class:
Date:
page-pf5
Name:
Class:
Date:
page-pf6
Name:
Class:
Date:
Copyright Cengage Learning. Powered by Cognero.
Page 6
c.
typedef int integer;
d.
typedef integer int;
ANSWER:
c
POINTS:
1
REFERENCES:
478
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:40 PM
DATE MODIFIED:
10/5/2016 1:40 PM
19. In C++, ____ is called the scope resolution operator.
a.
.
b.
?
c.
:
d.
::
ANSWER:
d
POINTS:
1
REFERENCES:
488
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:40 PM
DATE MODIFIED:
10/5/2016 1:40 PM
20. The scope of a namespace member is local to the ____.
a.
function
b.
block
c.
file
d.
namespace
ANSWER:
d
POINTS:
1
REFERENCES:
488
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:40 PM
DATE MODIFIED:
10/5/2016 1:40 PM
21. Given the following code
namespace globalType
{
void printResult();
}
which of the following statements is needed to access printResult?
a.
globalType.printResult();
b.
globalType.printResult;
c.
globalType::printResult();
d.
globalType:printResult();
ANSWER:
c
page-pf7
Name:
Class:
Date:
page-pf8
Name:
Class:
Date:
Copyright Cengage Learning. Powered by Cognero.
Page 8
25. Suppose str = "xyzw";. After the statement str[2] = 'Y'; The value of str is "____".
a.
xyzw
b.
xYzw
c.
xyYw
d.
xzYw
ANSWER:
c
POINTS:
1
REFERENCES:
493
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:40 PM
DATE MODIFIED:
10/5/2016 1:40 PM
26. Suppose that str1, str2, and str3 are string variables. After the following statements execute, the value of
str3 is "____".
str1 = "abc";
str2 = "xyz";
str3 = str1 + '-' + str2;
a.
abc
b.
xyz
c.
abc-xyz
d.
xyz-abc
ANSWER:
c
POINTS:
1
REFERENCES:
493
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:40 PM
DATE MODIFIED:
10/5/2016 1:40 PM
27. The data type string has a named constant, ____, associated with it.
a.
string::size
b.
string::size_type
c.
string::pos
d.
string::npos
ANSWER:
d
POINTS:
1
REFERENCES:
496
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:40 PM
DATE MODIFIED:
10/5/2016 1:40 PM
28. Suppose str = "ABCDEFGHI". The output of the statement
cout << str.length() << endl;
is ____.
a.
7
b.
8
page-pf9
Name:
Class:
Date:
Copyright Cengage Learning. Powered by Cognero.
Page 9
c.
9
d.
10
ANSWER:
c
POINTS:
1
REFERENCES:
498
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:40 PM
DATE MODIFIED:
10/5/2016 1:40 PM
29. The length of the string "Hello There. " is ____.
a.
11
b.
12
c.
13
d.
14
ANSWER:
c
POINTS:
1
REFERENCES:
497-498
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:40 PM
DATE MODIFIED:
10/5/2016 1:40 PM
30. Consider the following statements:
string str = "ABCDEFD";
string::size_type position;
After the statement position = str.find('D'); executes, the value of position is ____.
a.
3
b.
4
c.
6
d.
7
ANSWER:
a
POINTS:
1
REFERENCES:
500
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:40 PM
DATE MODIFIED:
10/5/2016 1:40 PM
31. Considering the statement string str = "Gone with the wind";, the output of the statement cout <<
str.find("the") << endl; is ____.
a.
9
b.
10
c.
11
d.
12
ANSWER:
b
POINTS:
1
REFERENCES:
500
page-pfa
Name:
Class:
Date:
page-pfb
Name:
Class:
Date:
page-pfc
Name:
Class:
Date:
Copyright Cengage Learning. Powered by Cognero.
Page 12
ANSWER:
insert(pos, str);
POINTS:
1
REFERENCES:
497
QUESTION TYPE:
Completion
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:40 PM
DATE MODIFIED:
10/5/2016 1:40 PM
40. The string expression strVar.____________________ starts at index pos, replaces the next n characters of
strVar with all the characters of str.
ANSWER:
strVar.replace(pos, n, str);
POINTS:
1
REFERENCES:
497
QUESTION TYPE:
Completion
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:40 PM
DATE MODIFIED:
10/5/2016 1:40 PM

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.