Question: This program is for Problems 17 - 20. #include #include using namespace std; int main() { char s1, s2; int i1, i2; int i3; cout
This program is for Problems 17 - 20.
#include
#include
using namespace std;
int main()
{
char s1, s2;
int i1, i2;
int i3;
cout << "Please enter two words: ";
cin >> s1 >> s2;
cout << "Please enter two numbers: ";
cin >> i1 >> i2;
i3= i1 + i2;
cout << s2 << i2 << s1 << i1 << endl; // output for question 17
cout << "line2: " << 3 + i1 * i2 << " is the answer "; // for question 18
cout << i3; // for question 19
return 0;
}
17. _____Which of the following user inputs will work correctly in a program, when the user is asked,
"Please enter two words: " in a cout statement and then given the cin prompt?
A. a b B. 5 2
C. # *
D. abcdefghijklmnopqrst
E. Answers A, B, and C will all work correctly.
18. ______Which of the following user inputs will work correctly in a program, when the user is asked,
"Please enter two numbers: " in a cout statement--- and then given the cin prompt?A. five ten B. 5.5 10.2
C. 5 10 D. 5,10
E. Answers B, C, and D will all work correctly.
19. _______When the program is run and the user enters the input shown below in bold, what will the program output on the next line? (The one with the comment saying it's for question 17)
Please enter two words: h w
Please enter two numbers: 7 80
A. w 80 h 7
B. h780
C. s2 i2 s1 i1 endl
D. w80h7
E. None of the above, or an error will occur.
20. _______If the program is run again and the user enters the following two numbers, what would be output on line 2? (The one with the comment saying it's for question 18)
Please enter two numbers: 2 4
A. line2: 20 is the answer
B. line2: 11 is the answer
C. line2: 3 + 2 * 4 is the answer
D. line2: 11 is the answer
E. line2: 3 + 2 * 4 is the answer
21. ______Continuing from question 20, after the user has entered 2 and 4, what would be the value of i3 as it's output at the end of the program?
A. 6 B. 8
C. 3 D. 0
E. Since i1 and i2 were uninitialized when i3 was calculated, i3's value is undefined. It could be any integer.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
