Exam 7: Namespaces, the Class String, and User-Defined Simple Data Types

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Consider the declaration:​ enum sports {BASKETBALL, FOOTBALL, HOCKEY, BASEBALL, SOCCER}; ​ Which of the following statements is true? ​

Free
(Multiple Choice)
4.8/5
(74)
Correct Answer:
Verified

D

Suppose str = "ABCDEFGHI".The output of the statement cout << str.length() << endl; Is ____.

Free
(Multiple Choice)
4.8/5
(84)
Correct Answer:
Verified

C

In C++, namespace is a reserved word.

Free
(True/False)
4.7/5
(83)
Correct Answer:
Verified

True

Suppose that you have the following declaration. enum cars {FORD, GM, TOYOTA, HONDA}; Cars domesticCars = FORD; The statement:domesticCars = static_cast<cars>(domesticCars + 1); Sets the value of domesticCars to ____.

(Multiple Choice)
4.9/5
(72)

Which of the following statements creates an anonymous type?

(Multiple Choice)
4.8/5
(82)

Which of the following statements declares the studentGrade variable?

(Multiple Choice)
4.8/5
(84)

Considering the statement string str = "Gone with the wind";, the output of the statement cout << str.find("the") << endl; is ____.

(Multiple Choice)
4.9/5
(78)

Suppose str = "xyzw";.After the statement str[2] = 'Y'; The value of str is "____".

(Multiple Choice)
5.0/5
(86)

The general syntax for accessing a namespace member is: namespace_name->identifier.

(True/False)
4.9/5
(74)

An enumeration type can be passed as a parameter to a function only by value.

(True/False)
4.9/5
(60)

A data type wherein you directly specify values in the variable declaration with no type name is called a(n) ____________________type.

(Short Answer)
4.9/5
(86)

Consider the following statements:string str = "ABCDEFD"; string::size_type position; After the statement position = str.find('D'); executes, the value of position is ____.

(Multiple Choice)
4.9/5
(77)

The values in the domain of an enumeration type are called ____________________.

(Short Answer)
4.7/5
(74)

The ____ function is used to interchange the contents of two string variables.

(Multiple Choice)
4.7/5
(74)

Before using the data type string, the program must include the header file ____.

(Multiple Choice)
4.9/5
(80)

If a global identifier in a program has the same name as one of the global identifiers in the header file, the compiler generates a(n) ____________________ error.

(Short Answer)
4.9/5
(87)

The following is a legal C++ enumeration type:enum colorType {BLUE, GREEN, PINK, YELLOW, RED};

(True/False)
4.9/5
(76)

The following statement creates an anonymous type:enum {1ST, 2ND, 3RD, 4TH} places;

(True/False)
4.8/5
(84)

Which of the following statements is used to simplify the accessing of all globalType namespace members?

(Multiple Choice)
4.8/5
(67)

The data type string has a named constant, ____, associated with it.

(Multiple Choice)
4.7/5
(80)
Showing 1 - 20 of 40
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)