Answer the following questions true (T) or false (F)
1. In C++ you can assign an expression of type double to a variable of type int with no problem.
2. To put a character into a cstring constant that causes the output to continue on the next line, insert the escape sequence \t into the string constant.
1. False
Explanation: In general assigning a floating point value to an integer variable mostly loses information. A warning message (or an error message) is issued by C++ compilers.
2. False
Explanation: \t is the tab escape sequence. Use \n instead.
Explanation: The code is illegal because its execution depends on the order of evaluation of arguments. Various compilers give different answers. One compiler this writer uses gives 3 2 1.
You might also like to view...
Answer the following statements true (T) or false (F)
1. The term software refers to all the physical devices, or components, that a computer is made of. 2. A syntax error does not prevent a program from being compiled and executed. 3. IDEs are specialized software packages that help programmers write programs. 4. Interpreted programs always execute faster than compiled programs.
Which of the following statements about arrays are true?
A. An array is a group of variables that all have the same type. B. Elements are located by index or subscript. C. The length of an array c is determined by the expression c.Length. D. The zeroth element of array c is specified by c[0]. a) A, C, D. b) A, B, D. c) C, D. d) A, B, C, D.