JAVA Programming Exam 3
Which of the following statements will display the maximum value that a double can hold?
System.out.println(Double.MAX_VALUE);
Which of the following statements will print the maximum value an int variable may have?
System.out.println(Integer.MAX_VALUE);
The first subscript in an array is always ___________.
0
The last subscript in an array is always __________.
1 less than the number of elements
The no-arg constructor for a StringBuilder object gives the object enough storage space to hold __________ characters.
16
What are the tokens in the following statement? StringTokenizer st = new StringTokenizer("9-14-2018"", "-"", true);
9, 14, 2018, -
The ______ section of the AAA test pattern verifies that the method operates as expected.
Assert
The __________ class is the wrapper class for the char data type.
Character
The following statement correctly creates a StringBuilder object. StringBuilder str = "Tuna sandwich";
False
True or False: The first size declarator in the declaration of a two-dimensional array represents the number of columns. The second size declarator represents the number of rows.
False
Unit testing decreases confidence in changing/ maintaining code.
False
Unit tests are usually performed manually by software developers.
False
Writing unit tests takes time and therefore should be discouraged.
False
____ is a documentation tool which which can generate HTML files to view the documentation from a web browser.
Javadoc
Comments in the main documentation tool for Java must ____
begin with a slash and two stars
The term __________ is commonly used to refer to a string that is part of another string.
substring
Typically a JAR file contains __________ associated with applets and applications.
the class files and auxiliary resources
Which of the two statements is true? Telemetry is typically oriented around the internal structure of the application. Logging is oriented around reflecting real-world customer usage.
the first is false, the second is false
A series of words or other items of data, separated by spaces or other characters, is known as a __________.
token
The ________ character appears at the end (the right side) of a string, after the non-space characters.
trailing whitespace
The __________ method returns a copy of the calling String object with all leading and trailing whitespace characters deleted.
trim
The String class's __________ method accepts a value of any primitive data type as its argument and returns a string representation of the value.
valueOf
Array bounds checking happens __________.
when the program runs
When initializing a two-dimensional array, you enclose each row's initialization list in ___________.
braces
The StringBuilder class's insert method allows you to insert a(n) __________ into the calling object's string.
char array String object primitive type
The term used for the character that separates tokens is __________.
delimiter
What is the value of str after the following code has been executed? String str; String sourceStr = """Hey diddle"," diddle"," the cat and the fiddle"""; str = sourceStr.substring(12","17);
diddl
Which logging priority order generates most log messages?
error
If str is declared as: String str = "ABCDEFGHI"; What will be returned from the following statement? Character.toLowerCase(str.charAt(5));
f
Which of the following statements will convert the string str = "285" to an int?
int x = Integer.parseInt(str);
To create a jar file, use the following command
jar -cvf app1.jar package1/RunMe.class
This array field holds the number of elements that the array has.
length
The main components of Log4J are____
logger, appenders, layout
Any ___________ argument passed to the Character class's toLowerCase method or toUpperCase method is returned as it is.
nonletter
Unit of test usually has ________ input(s) and usually _______ output(s).
one or a few , a single
Log4J can be configured to write log messages
only to a file or files only to a console window to a file, to a console window and to be sent over the network at the same time
To delete an item from an ArrayList object, you use this method.
remove
This search algorithm steps through an array, comparing each item with the search value.
sequential search
To determine the number of items stored in an ArrayList object, you use this method.
size
In an array declaration, this indicates the number of elements that the array will have.
size declarator
The __________ method of the String class can be used to tokenize a string.
split
Each element of an array is accessed by a number known as a(n) __________.
subscript
Telemetry should be used to generate aggregate data, not to collect individual customer data.
True
The wrapper classes in Java are immutable, which means that once you create an object, you cannot change the object's value.
True
True or False: A two-dimensional array has multiple length fields.
True
True or False: An ArrayList automatically expands in size to accommodate the items stored in it.
True
True or False: Both of the following declarations are legal and equivalent: int[] numbers; int numbers[];
True
True or False: Java does not allow a statement to use a subscript that is outside the range of valid subscripts for an array.
True
True or False: The Java compiler does not display an error message when it processes a statement that uses an invalid subscript.
True
True or False: The subscript of the last element in a single-dimensional array is one less than the total number of elements in the array.
True
True or False: The values in an initialization list are stored in the array in the order that they appear in the list.
True
True or False: When an array is passed to a method, the method has access to the original array.
True
You can change the contents of a StringBuilder object, but you cannot change the contents of a String object.
True
To insert an item at a specific location in an ArrayList object, you use this method.
add
Sealing a package within a JAR file means that ___
all classes within the package must be in the same JAR file
