Filters
Question type

Study Flashcards

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


A) iterator
B) traverse
C) swap
D) change

E) A) and D)
F) A) and C)

Correct Answer

verifed

verified

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

E) C) and D)
F) B) and D)

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

Which of the following statements declares the studentGrade variable?


A) enum studentGrade {A, B, C, D, F};
B) enum int {A, B, C, D, F} studentGrade;
C) enum studentGrade {A, B, C, D, F} grades;
D) enum grades {A, B, C, D, F} studentGrade;

E) A) and D)
F) C) and D)

Correct Answer

verifed

verified

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


A) enum
B) iostream
C) string
D) std

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

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 ____.


A) FORD
B) GM
C) TOYOTA
D) HONDA

E) A) and D)
F) A) and B)

Correct Answer

verifed

verified

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.

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

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

Correct Answer

verifed

verified

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


A) string::size
B) string::size_type
C) string::pos
D) string::npos

E) None of the above
F) All of the above

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

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

Correct Answer

verifed

verified

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

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

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


A) xyzw
B) xYzw
C) xyYw
D) xzYw

E) A) and B)
F) B) and C)

Correct Answer

verifed

verified

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


A) using globalType;
B) using namespace globalType:all;
C) using namespace globalType::all;
D) using namespace globalType;

E) None of the above
F) All of the above

Correct Answer

verifed

verified

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


A) SOCCER-- = BASEBALL
B) BASEBALL++ = SOCCER
C) HOCKEY + FOOTBALL < SOCCER
D) FOOTBALL <= SOCCER

E) All of the above
F) A) and D)

Correct Answer

verifed

verified

D

In C++, namespace is a reserved word.

A) True
B) False

Correct Answer

verifed

verified

True

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

A) True
B) False

Correct Answer

verifed

verified

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


A) 7
B) 8
C) 9
D) 10

E) A) and D)
F) B) and C)

Correct Answer

verifed

verified

C

Which of the following statements creates an anonymous type?


A) enum grades {A, B, C, D, F};
B) enum grades {};
C) enum {};
D) enum {A, B, C, D, F} grades;

E) A) and C)
F) All of the above

Correct Answer

verifed

verified

Showing 1 - 20 of 40

Related Exams

Show Answer