Deck 18: Class String and String Stream Processing
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/26
العب
ملء الشاشة (f)
Deck 18: Class String and String Stream Processing
1
Which of the following is false?
A) If a string is converted to a C-style array using data, modifying the string could cause the pointer previously returned by data to become invalid.
B) Converting a string containing one or more null characters to a C-style string can cause logic errors.
C) c_str returns a character array of the same length as the string object it is called on.
D) copy implicitly converts a string to a non-null terminated character array.
A) If a string is converted to a C-style array using data, modifying the string could cause the pointer previously returned by data to become invalid.
B) Converting a string containing one or more null characters to a C-style string can cause logic errors.
C) c_str returns a character array of the same length as the string object it is called on.
D) copy implicitly converts a string to a non-null terminated character array.
C
2
Which of the following is not overloaded for strings?
A) -=
B) >>
C) +=
D) getline)
A) -=
B) >>
C) +=
D) getline)
A
3
Which of the following returns a bool?
A) length
B) empty
C) capacity
D) resize
A) length
B) empty
C) capacity
D) resize
B
4
The arguments passed to replace do not include:
A) The subscript of the element where the replace operation ends.
B) The subscript of the element where the replace operation begins.
C) A replacement character string from which a substring is used to replace characters.
D) The element in the replacement character string where the replacement substring begins.
A) The subscript of the element where the replace operation ends.
B) The subscript of the element where the replace operation begins.
C) A replacement character string from which a substring is used to replace characters.
D) The element in the replacement character string where the replacement substring begins.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
5
If string s1 has the value "computer" and string s2 has the value "promise", which call to insert will produce the string "compromise"?
A) s1.insert 4, s2, 0, string::npos );
B) s1.insert string::npos, s2, 0, 4 );
C) s2.insert 0, s1, 0, 3 );
D) s2.insert 3, s1, 0, 3 );
A) s1.insert 4, s2, 0, string::npos );
B) s1.insert string::npos, s2, 0, 4 );
C) s2.insert 0, s1, 0, 3 );
D) s2.insert 3, s1, 0, 3 );
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
6
If string s contains "antidisestablishmentarianism", then s.substr 7, 13 ) would be:
A) "establish"
B) "ishmenta"
C) "establi"
D) "establishment"
A) "establish"
B) "ishmenta"
C) "establi"
D) "establishment"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
7
What type of value is returned by the overloaded equality and relational operators for strings?
A) int
B) bool
C) double
D) null
A) int
B) bool
C) double
D) null
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
8
The function call string1.erase 5 ) will:
A) Return a copy of string1 minus the character that occupied position 5.
B) Erase all characters up to and including the character in position 5 from string1.
C) Erase all characters starting from and including the character in position 5 to the end of string1.
D) Return a copy of string1 minus every fifth character.
A) Return a copy of string1 minus the character that occupied position 5.
B) Erase all characters up to and including the character in position 5 from string1.
C) Erase all characters starting from and including the character in position 5 to the end of string1.
D) Return a copy of string1 minus every fifth character.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
9
Which of the following would not return string::npos when used on the string s which contains "rack":
A) s.find_first_not_of "crackling" );
B) s.find_first_not_of "packrat" );
C) s.rfind "car" );
D) s.find "ack" );
A) s.find_first_not_of "crackling" );
B) s.find_first_not_of "packrat" );
C) s.rfind "car" );
D) s.find "ack" );
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
10
Strings:
A) Can use the subscript operator to access individual characters.
B) Must be null-terminated.
C) Are pointers.
D) Have a first subscript of 1.
A) Can use the subscript operator to access individual characters.
B) Must be null-terminated.
C) Are pointers.
D) Have a first subscript of 1.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
11
If string s1 is lexicographically greater than string s2, then the value returned by s2.compare0, s2.size), s1) must be?
A) 0
B) -1
C) A negative number.
D) A positive number.
A) 0
B) -1
C) A negative number.
D) A positive number.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
12
Class string has member function __________ to interchange the data stored in two string objects
A) exchange
B) switch
C) swap
D) copyto
A) exchange
B) switch
C) swap
D) copyto
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
13
Which of the following cannot be used to concatenate strings?
A) +
B) +=
C) append
D) assign
A) +
B) +=
C) append
D) assign
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
14
Which of the following searches through a string object from right-to-left?
A) find
B) find_first_of
C) find_last_of
D) find_first_not_of
A) find
B) find_first_of
C) find_last_of
D) find_first_not_of
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
15
Iterators do not:
A) Allow the characters to be modified.
B) Allow backward traversal of strings.
C) Have range checking.
D) Have syntax similar to pointer operations.
A) Allow the characters to be modified.
B) Allow backward traversal of strings.
C) Have range checking.
D) Have syntax similar to pointer operations.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
16
Given the strings defined below, which statement will not return 0?
String s1 = "Mighty Mouse";
String s2 = "Mickey Mouse";
A) s1.compare 0, 3, s2, 0, 3 );
B) s1.compare 7, 5, s2, 7, 5 );
C) s1.compare 8, 12, s2, 8, 12 );
D) s1.compare 7, 11, s2, 7, 11 );
String s1 = "Mighty Mouse";
String s2 = "Mickey Mouse";
A) s1.compare 0, 3, s2, 0, 3 );
B) s1.compare 7, 5, s2, 7, 5 );
C) s1.compare 8, 12, s2, 8, 12 );
D) s1.compare 7, 11, s2, 7, 11 );
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
17
Which function changes the actual string stored in the string object i.e., is not a const member function)?
A) length
B) empty
C) capacity
D) resize
A) length
B) empty
C) capacity
D) resize
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
18
Which of the following is an invalid definition?
A) string sa = "computers";
B) string sb "computers" );
C) string sc 'c' );
D) string sd 9, 'c' );
A) string sa = "computers";
B) string sb "computers" );
C) string sc 'c' );
D) string sd 9, 'c' );
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
19
The total number of elements that can be stored in a string without increasing its current amount of allocated memory is called its:
A) Size.
B) Length.
C) Capacity.
D) Maximum size.
A) Size.
B) Length.
C) Capacity.
D) Maximum size.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
20
Which of the following is not an argument of the assign member function?
A) The start location.
B) The number of characters to copy.
C) The end location.
D) The string to copy.
A) The start location.
B) The number of characters to copy.
C) The end location.
D) The string to copy.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
21
The capabilities of inputting and outputting strings in memory are known as:
A) String i/o manipulation.
B) String stream processing.
C) Character handling.
D) Dynamic string operations.
A) String i/o manipulation.
B) String stream processing.
C) Character handling.
D) Dynamic string operations.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
22
Which of the following does not apply to an istringstream object?
A) Data is stored in the object as characters.
B) Input from the object works identically to input from any file stream.
C) Data in a string can be appended to it.
D) It is used to inputs data from a string in memory to program variables.
A) Data is stored in the object as characters.
B) Input from the object works identically to input from any file stream.
C) Data in a string can be appended to it.
D) It is used to inputs data from a string in memory to program variables.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
23
All of the following are true of an ostringstream object except that:
A) It uses a string to store output data.
B) A stream insertion operation cannot be used to append additional data to it.
C) The string data it stores is dynamically allocated.
D) The data it stores can be accessed using the function str.
A) It uses a string to store output data.
B) A stream insertion operation cannot be used to append additional data to it.
C) The string data it stores is dynamically allocated.
D) The data it stores can be accessed using the function str.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
24
What is the code for a loop that iterates from the end of a string toward the beginning?
A) string::reverse_iterator i = s.begin) while i != s.end) )
{
Cout << *i;
++i;
}
B) string::reverse_iterator i = s.rbegin) while i != s.rend) )
{
Cout << *i;
++i;
}
C) string::reverse_iterator i = s.end) while i != s.begin) )
{
Cout << *i;
--i;
}
D) string::reverse_iterator i = s.rbegin) while i != s.rend) )
{
Cout << *i;
--i;
}
A) string::reverse_iterator i = s.begin) while i != s.end) )
{
Cout << *i;
++i;
}
B) string::reverse_iterator i = s.rbegin) while i != s.rend) )
{
Cout << *i;
++i;
}
C) string::reverse_iterator i = s.end) while i != s.begin) )
{
Cout << *i;
--i;
}
D) string::reverse_iterator i = s.rbegin) while i != s.rend) )
{
Cout << *i;
--i;
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
25
Which of the following provides bounds checking?
A) at
B) iterator
C) reverse_iterator
D) [ ]
A) at
B) iterator
C) reverse_iterator
D) [ ]
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
26
String iterators:
A) Must be dereferenced in order to access the character at each location.
B) Are not range checked.
C) Come in const and non-const forms.
D) All of the above.
A) Must be dereferenced in order to access the character at each location.
B) Are not range checked.
C) Come in const and non-const forms.
D) All of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck