Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please answer and explain why you pick this answer: 1. What will be output by th

ID: 3626416 • Letter: P

Question

Please answer and explain why you pick this answer:

1. What will be output by the following code fragment?
string str1 = "That’s a wrap";
cout << str1.find("t") + str1.size();

a. 12 b. 13 c. 15 d. 16 e. 17 f. 18

2. What is the value stored in the variable named y after the following code executes?
Point p = Point(5, 8);
p.move(3, -5);
double y = p.get_y();
a. 5 b. 3 c. 8 d. 2 e. 13 f. -5

3. What is the value of the following expression?
!(10 <= 10)
a. true b. false

4.What is the value of the following expression?
(true && (false || true))
a. true b. false

5. Assuming r, s, t, and u are variables of type int, which of the following expressions is
equivalent to: !((r < s) && (t != u) || (r > u))
a. (r < s) || (t != u) && (r > u) d. !(r < s) || !(t != u) && !(r > u)
b. !(r < s) && !(t != u) || !(r > u) e. (r >= s) && (t == u) || (r <= u)
c. (r > s) || (t == u) && (r < u) f. b) and e)


Explanation / Answer

1. d. 16 str.size() returns the length of the string, which is 13 characters and find() returns the position of the character, which is 3 [remember 0 based], so 13 + 3 = 16 2. d. 2 Guessing here. You haven't told us what the move() method does, so I'm assuming it just shifts the point from 5,8 to (5+3, 8-5) = (8,2) 3. false. 10