CSCE 111: Final T/F
An array automatically expands in size to accomodate the items stored in it.
False
An array can hold multiple values of several different data types simultaneously
False
An instance of a class has to exist in order for values to be stored in a class's static fields
False
Being Immutable means that no more methods can be added to the class, and the existing ones cannot be changed.
False
Both character literals and String Literals can be assigned to a char variable
False
Data, in computers, is stored in binary form, as series of 0's 1's and 2's.
False
If a non-letter argument is passed to the toLowerCase or toUpperCasde method, the boolean value false is returned
False
If a[] and b[] are two integer arrays, the expression a == b compares the array elements.
False
If the compiler encounters a statement that uses a variable before the variable is declared, the virtual machine will create it internally.
False
If the variable sum is declared in a method calculate, statements outside that method can only access that variable using calculate.sum
False
In java, if variable cost is declared as "final int cost = 5;", the assignment expression "cost += 5;" will do nothing because the cost is not greater than 5.
False
In the following code, JVM removes 3 elements from the original 10 element array int[] d = new int[10]; d = new int[7]
False
In the for loop, the control variable cannot be tested against a constant value
False
In the method header the static method modifier means the method can be called on an instance of the class
False
In the method header the static method modifier means the method is only available to other methods declared in the class
False
In the method header, the method modifier private means that the method must be invoked through an existing object.
False
Instance methods are used by the JOptionPane class for input/output
False
The following statement correctly creates a StringBuilder object StringBuilder str = "Thanksgiving!";
False
When an object is passed as an argument to a method the objects instance variables values are passed to receiving parameters.
False
When the break statement is encountered in a loop, all the statements in the body of the loop that appear after it are ignored, and the loop proceeds to the next iteration
False
When two Strings are compared using the equals method, the cases of the two strings are not considered
False
When you pass the name of a file to the PrintWriter constructor, and the file already exists, it will be erased and an error will occur
False
You can change the contents of a String object, but you cannot change the contents of a StringBuilder object.
False
if-else-if statements are nested code used to handle a two-choice programming problem
False
the arithmetic operator with the highest precedence is binary "-"
False
(double) (sum/number) is a valid expression assuming the variables are defined and initialized
True
A class is not an object, but a description of an object
True
A single copy of a class's static field is shared by all instances of the class
True
A substring must always consist of a subset of continuous characters from a larger String
True
A value returning method can return a reference to an object
True
An object is created from a class that defines the objects data holding capabilities
True
Because the || operator performs short circuit evaluation, your boolean expression will generally be evaluated faster if the subexpression that is most likely to be true is on the left.
True
Constants, variables, and the values of expressions may be passed as arguments to a method.
True
If a class has a method named finalize, it is called automatically just before an instance of the class is destroyed by the garbage collector
True
Java provides unary operators which are designed for incrementing variables
True
Java will automatically perform a widening operation if an argument's data type is lower than the parameters data type
True
On computers with different types of CPU's, we have to use a different virtual machine to run the same piece of java bytecode.
True
System.out.print,nextInt in the Scanner class, and main are all "methods"
True
The Java virtual machine is a program that reads java byte code instructions and executes them as they are read
True
The key word this can be used by an object to refer to itself
True
The public access specifier for a field indicates that the attribute may be accessed by statements outside the class
True
When an object reference is passed to a method, the method may change the values in the object.
True
When you open a file with the PrintWriter class, the class can potentially throw an IOException
True
encapsulation refers to the combining of data and code into a single object
True
logical errors are not caught by the compiler
True