Answer the following statements 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.
3. If we execute this code in an otherwise correct and complete program:
```
n = 1;
n = (n++) + (n++);
```
the value of n is guaranteed to be 3 after the second line executes.
4. If we execute the code fragment in an otherwise complete, correct program:
```
n = 1;
cout << n++ << " " << n++ << " " << n++ << endl;
```
the output is guaranteed to be 1 2 3.
5. C++ uses only /* */ for comments.


1. False.
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.
\t is the tab escape sequence. Use \n instead.
3. False.
Some compilers may give the value 3. The result of such code is dependent
on the compiler implementation. The C++ Standard says such code is illegal, and the
Standard says the results are undefined, meaning the compiler can do anything with it
that suits the compiler writer. One of my compilers gives the value 4 to n.
4. False.
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.
5. False.
C++ uses /* */ comments and // “here to the end of the line”
comments.

Computer Science & Information Technology

You might also like to view...

When the width of the entire table is increased, the added space is divided evenly among the table columns.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

What is the Linux operating system?

What will be an ideal response?

Computer Science & Information Technology

The ____ function reads a string from the standard input stream.

A. getstr B. gets C. fgets D. puts E. fputs

Computer Science & Information Technology

When using an array in a GUI program, if array values will change based on user input, where must the array be stored?

A. It must be stored inside the method that processes the user's events. B. It must be stored inside an event handler. C. It must be stored outside the method that processes the user's events. D. It must be stored outside of the main program.

Computer Science & Information Technology