Q21: Which of the following is a valid user-defined output stream manipulator header? a. ostream& tab( ostream& output ) b. ostream tab( ostream output ) c. istream& tab( istream output ) d. void tab( ostream& output ) Q22: What will be output by the following statement? cout << showpoint << setprecision(4) << 11.0 << endl; a. 11 b. 11.0 c. 11.00 d. 11.000 Q23: Which of the following stream manipulators causes an outputted number’s sign to be left justified, its magnitude to be right justified and the center space to be filled with fill characters? a. left b. right c. internal d. showpos Q24: Which of the following statements restores the default fill character? a. cout.defaultFill(); b. cout.fill(); c. cout.fill( 0 ); d. cout.fill( ' ' ); Q25: When the showbase flag is set: a. The base of a number precedes it in brackets. b. Decimal numbers are not output any differently. c. "oct" or "hex" will be displayed in the output stream. d. Octal numbers can appear in one of two ways. Q26: What will be output by the following statements? double x = .0012345; cout << fixed << x << endl; cout << scientific << x << endl; a. 1.234500e-003 0.001235 b. 1.23450e-003 0.00123450 c. .001235 1.234500e-003 d. 0.00123450 1.23450e-003 Q27: Which of the following outputs does not guarantee that the uppercase flag has been set? a. All hexadecimal numbers appear in the form 0X87. b. All numbers written in scientific notation appear the form 6.45E+010. c. All text outputs appear in the form SAMPLE OUTPUT. d. All hexadecimal numbers appear in the form AF6. Q28: Which of the following is not true about bool values and how they're output with the output stream? a. The old style of representing true/false values used -1 to indicate false and 1 to indicate true. b. A bool value outputs as 0 or 1 by default. c. Stream manipulator boolalpha sets the output stream to display bool values as the strings "true" and "false". d. Both boolalpha and noboolalpha are “sticky” settings.
时间: 2023-12-06 18:40:26 浏览: 255
A21: a. ostream& tab( ostream& output ) is a valid user-defined output stream manipulator header.
A22: c. 11.00 will be output by the statement.
A23: c. internal is the stream manipulator that causes an outputted number’s sign to be left justified, its magnitude to be right justified and the center space to be filled with fill characters.
A24: d. cout.fill(' ') restores the default fill character, which is a space.
A25: c. "oct" or "hex" will be displayed in the output stream when the showbase flag is set.
A26: b. 1.23450e-003 and 1.23450e-003 will be output by the statements.
A27: d. All hexadecimal numbers appearing in the form AF6 does not guarantee that the uppercase flag has been set.
A28: a. The old style of representing true/false values used -1 to indicate false and 1 to indicate true is not true. False is represented by 0 and true is represented by any non-zero value.
阅读全文