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

1. You are given the following variable declarations: int x, y; char ch; What va

ID: 3623390 • Letter: 1

Question

1. You are given the following variable declarations:

int x, y;
char ch;

What value (if any) is assigned to x, y, and ch after each of the following executes, given the input shown below?

5 28 36

a. cin >> x >> y >> ch;
b. cin >> ch >> x >> y;
c. cin >> x >> ch >> y;
d. cin >> x >> y;
cin.get (ch);

2. You are given the following variable declarations:

int x, y;
char ch;

What value (if any) is assigned to x, y, and ch after each of the following executes, given the input shown below?

13 28 D
14 E 98
A B 56

a. cin >> x >> y;
cin.ignore (50, ‘ ’);
cin >> ch;

b. cin >> x;
cin.ignore (50, ‘ ’);
cin >> y;
cin.ignore (50, ‘ ’);
cin.get (ch);

c. cin >> y;
cin.ignore (50, ‘ ’);
cin >> x >> ch;

d. cin.get (ch);
cin.ignore (50, ‘ ’);
cin >> x;
cin.ignore (50, ‘E’);
cin >> y;

3. You are given the following variable declarations:

int age;
char ch;
string name;

and the following input statements:

cin >> age;
cin.get (ch);
getline (cin, name);

What value (if any) is assigned to age, ch, and name when the input statements are executed, given the following input?

a. 35 Mickey Mantle
b. 35
Mickey Mantle

Explanation / Answer

Dear, 1) a) x = 5, y = 28, ch =3 b) x = 28, y = 36, ch = 5 c) x = 5, y = 8, ch = 2 d) x = 5, y = 28 ch is assigned a value associated with blank space i.e., ‘ ’ . 2) a. x = 13, y = 28, ch = 1 b. x = 13, y = 14, ch = A c. x = 14, y = 13, ch = E d. x = 14, y = 98, ch = 1 3) a. age =35, name = Mickey Balto b. age = 35, name = Mickey Balto Hope this will help you