Language c++:    1. Given string str is "Great", which choice has all matching expressions? Group of answer choices a. str == "Great" b. str == "Great", str == "great" c. str == "Great", str == "Great!" d. str == "Great", str == "great", str == "Great!"   2. What is the ending value of userString? (Note the question asks about userString, not about x). userString = "FaceBook"; x = tolower(userString.at(4));   a.  "Facebook" b. "FaceBook" c. "Faceook" d. "b"   3. Which expression evaluates to true if the corresponding characters of strings s1 and s2 are equal independent of case? Ex: "C" and "c" should be considered equal. Group of answer choices a. str1.at(i) == str2.at(i) b. str1.at((tolower(i)) == str2.at(tolower(i)) c. str1.at(i) == toupper(str2.at(i)) d. toupper(str1.at(i)) == toupper(str2.at(i))   4. Given string str1 and string str2, which expression is true? str1 = "Hi"; str2 = "Hello";   Group of answer choices a. str1 < str2 b. str1 > str2 c. str1 <= str2 d. (Comparison not possible)

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 1GZ
icon
Related questions
Question

Language c++: 

 

1. Given string str is "Great", which choice has all matching expressions?

Group of answer choices
a. str == "Great"
b. str == "Great", str == "great"
c. str == "Great", str == "Great!"
d. str == "Great", str == "great", str == "Great!"
 
2.

What is the ending value of userString? (Note the question asks about userString, not about x).

userString = "FaceBook";
x = tolower(userString.at(4));
 
a.  "Facebook"
b. "FaceBook"
c. "Faceook"
d. "b"
 

3. Which expression evaluates to true if the corresponding characters of strings s1 and s2 are equal independent of case? Ex: "C" and "c" should be considered equal.

Group of answer choices
a. str1.at(i) == str2.at(i)
b. str1.at((tolower(i)) == str2.at(tolower(i))
c. str1.at(i) == toupper(str2.at(i))
d. toupper(str1.at(i)) == toupper(str2.at(i))
 

4. Given string str1 and string str2, which expression is true?

str1 = "Hi";
str2 = "Hello";
 
Group of answer choices
a. str1 < str2
b. str1 > str2
c. str1 <= str2
d. (Comparison not possible)
 
 
5. Which expression for XXX causes the code to output the strings in alphabetical order? (Assume the strings are lowercase)
if (XXX) {
cout << firstStr << " " << secondStr << endl;
}
else {
cout << secondStr << " " << firstStr << endl;
}
 
Group of answer choices
a. firstStr == secondStr
b. firstStr < secondStr
c. firstStr > secondStr
d. firstStr != secondStr
 

6. For the string "on time", what character is at index 3?

Group of answer choices
a. (Space)
b. t
c. i
d. m
 

7. Given str = "Cat", what is the result of this statement?

str.at(1) = "ab";
 
Group of answer choices
a. str is "abt"
b. str is "Catab"
c. str is "Cab"
d. Error: Assigning a character with a string is not allowed
 
 

8. What is the relation between a string's length and the string's last index?

Group of answer choices
a. lastIndex == length
b. lastIndex == length - 1
c. lastIndex == length + 1
d. lastIndex == length + 2
 
 
 

9. Given string s is "Sunday", what is the ending value of char myChar?

myChar = s.at(s.size() - 1);
 
Group of answer choices
a. a
b. y
c. "
d. No such character
 

10. Given userStr = "Doghouse", what is the ending value of char x?

x = tolower(userStr.at(2));
 
Group of answer choices
a. G
b. g
c. (Space)
d. Error: Compiler complains about converting an already-lowercase letter
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 4 images

Blurred answer
Knowledge Booster
Header Files
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT