2025(graded A+)
Logical errors are mistakes that cause the program to produce
erroneous results. - True or False - answer True
The contents of a variable cannot be changed while the program is
running. - True or False - answer False
Assume that inputFile references a Scanner object that was used to
open a file. Which of the following while loops shows the correct
way to read data from the file until the end of the file is reached? -
answer while (inputFile.hasNext())
Suppose you are at an operating system command line, and you are
going to use the following command to compile a program:
javac MyClass.java
Before entering the command, you must: - answer Make sure you
are in the same directory or folder where MyClass.java is located.
Another term for programs is: - answer Software
When an object's internal data is hidden from outside code and
access to that data is restricted to the object's methods, the data is
protected from accidental corruption. - True or False - answer True
Colons are used to indicate the end of a Java statement. - True or
False - answer False
In Java, you do not use the new operator when you use a(n): -
answer initialization list
, When an array is passed to a method: - answer 1) a reference to the
array is passed
2) it is passed just as an object
3) the method has direct access to the original array
Answer: All of these
Java provides a set of simple unary operators designed just for
incrementing and decrementing variables. - True or False - answer
True
What is the value of x after the following code has been executed?
int x =75;
int y=90;
if ( x != y)
x += y; - answer x = 165
Given the declaration double r; which of the following statements is
invalid?
r = 326.75;
r = 9.4632e15;
r = 9.4632E15;
r = 2.9X106; - answer r = 2.9X106 is invalid.
When testing for character values, the switch statement does not
test for the case of the character. - True or False - answer False
This is a special language used to write computer programs. -
answer Programming language