Unlock access to all the studying documents.
View Full Document
Copyright Cengage Learning. Powered by Cognero.
1. The following is a legal C++ enumeration type:
enum colorType {BLUE, GREEN, PINK, YELLOW, RED};
2. The following is a valid C++ enumeration type:
enum places {1ST, 2ND, 3RD, 4TH};.
3. No arithmetic operations are allowed on the enumeration type.
4. A function cannot return the value of an enumeration type.
Copyright Cengage Learning. Powered by Cognero.
19. In C++, ____ is called the scope resolution operator.
20. The scope of a namespace member is local to the ____.
21. Given the following code
namespace globalType
{
void printResult();
}
which of the following statements is needed to access printResult?
globalType.printResult();
globalType::printResult();
globalType:printResult();
Copyright Cengage Learning. Powered by Cognero.
25. Suppose str = “xyzw”;. After the statement str[2] = ‘Y’; The value of str is “____”.
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;
27. The data type string has a named constant, ____, associated with it.
28. Suppose str = “ABCDEFGHI”. The output of the statement
cout << str.length() << endl;
is ____.
Copyright Cengage Learning. Powered by Cognero.
29. The length of the string “Hello There. “ is ____.
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 ____.
31. Considering the statement string str = “Gone with the wind”;, the output of the statement cout <<
str.find(“the”) << endl; is ____.
Copyright Cengage Learning. Powered by Cognero.
40. The string expression strVar.____________________ starts at index pos, replaces the next n characters of
strVar with all the characters of str.
strVar.replace(pos, n, str);