In: Computer Science
Question 301 pts
Which of the following statements displays 123 as 00123?
Group of answer choices
cout << setw(5) << setfill('0') << 123;
cout << left << setw(5) << 123;
cout << setw(5) << 123;
None of the options displays the required output.
Flag this Question
Question 311 pts
Which of the following statements displays 123.567 as 123.57?
Group of answer choices
cout << fixed << setprecision(2) << 123.567;
None of the options displays the required output.
cout << setprecision(2) << 123.567;
cout << setw(5) << 123.567;
Flag this Question
Question 321 pts
Given the following code snippet, what is the value of the variable num1?
istringstream strm("12 MOD 2"); int num1 = 0; string operation; strm >> num1 >> operation;
Group of answer choices
12
MOD
2
0
Flag this Question
Question 331 pts
Which of the following code snippets converts the integer n to a string s?
Group of answer choices
ostringstream strm; string s; strm << n; s = strm.str();
ostringstream strm; string s; strm.str(n); str >> s;
istringstream strm; string s; strm << n; s = strm.str();
istringstream strm; string s; strm.str(n); str >> s;
1. Which of the following statements displays 123 as 00123?
cout << setw(5) << setfill('0') << 123; [ Correct Answer ]
cout << left << setw(5) << 123;
cout << setw(5) << 123;
None of the options displays the required output.
2. Which of the following statements displays 123.567 as 123.57?
**(More than one are correct)
cout << fixed << setprecision(2) << 123.567;[ Correct Answer ]
None of the options displays the required output.
cout << setprecision(2) << 123.567;[ Correct Answer ]
cout << setw(5) << 123.567;[ Correct Answer ]
3. Given the following code snippet, what is the value of the variable num1?
istringstream strm("12 MOD 2"); int num1 = 0; string operation; strm >> num1 >> operation;
Group of answer choices
12[ Correct Answer ]
MOD
2
0
4. Which of the following code snippets converts the integer n to a string s?
ostringstream strm; string s; strm << n; s = strm.str();[ Correct Answer ]
ostringstream strm; string s; strm.str(n); str >> s;
istringstream strm; string s; strm << n; s = strm.str();
istringstream strm; string s; strm.str(n); str >> s;
THANKS A LOT...