5 points QUESTION 21 The three major categories of Java collections are tree set
ID: 3831202 • Letter: 5
Question
5 points
QUESTION 21
The three major categories of Java collections are
tree sets, list sets, and hash maps
lists, sets, and maps
hash lists, hash tables, and sets
sets, collections, and maps
5 points
QUESTION 22
Given that String[] str has been initialized, to get a copy of str[0] with all characters converted to upper case, use the following statement
str.uppercase();
str[0].toUpperCase();
str.toUpperCase();
str[0].upperCase();
5 points
QUESTION 23
What would be the results of the following code?
final int SIZE = 25;
int[] array1 = new int[SIZE];
... // Code that will put values in array1
int value = 0;
for (int a = 0; a <= array1.length; a++)
{
value += array1[a];
}
value contains the lowest value in array1
value contains the sum of all the values in array1
value contains the highest value in array1
This would cause the program to crash.
5 points
QUESTION 24
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);
Iddle
diddl
diddle
, didd
5 points
QUESTION 25
If a subclass constructor does not explicitly call a superclass constructor,
The superclass fields will be set to the default values for their data types
It must include the code necessary to initialize the superclass fields
Java will automatically call the superclass's default constructor just before the code in the subclass's constructor executes
Java will automatically call the superclass's default constructor immediately after the code in the subclass's constructor executes
5 points
QUESTION 26
What term refers to data that describes other data?
meta data
pseudo-data
micro data
abstract data
5 points
QUESTION 27
If a class contains an abstract method,
The method must be overridden in subclasses
You cannot create an instance of the class
The method will have only a header, but not a body, and end with a semicolon
All of the above
5 points
QUESTION 28
In the following code, System.out.println(num), is an example of ________.
double num = 5.4;
System.out.println(num);
num = 0.0;
A value-returning method
A local variable
A complex method
A void method
5 points
QUESTION 29
In the realm of JDBC use of PreparedStatements help prevent what?
SQL Injection
increased threads
does not prevent anything, just executes insert statements like JDBC statements do
execution of stored procedures
5 points
QUESTION 30
If a subclass constructor does not explicitly call a superclass constructor,
It must include the code necessary to initialize the superclass fields
The superclass fields will be set to the default values for their data types
Java will automatically call the superclass's default constructor just before the code in the subclass's constructor executes
Java will automatically call the superclass's default constructor immediately after the code in the subclass's constructor executes
tree sets, list sets, and hash maps
lists, sets, and maps
hash lists, hash tables, and sets
sets, collections, and maps
Explanation / Answer
21) lists, sets, and maps
three main kind of collections are: - OrderedCollections or lists, Collections or sets and maps.
22) str[0].toUpperCase();
Str is an array and array has no toUpperCase() function but element of String array have this function.
23) value contains the sum of all the values in array1
Value is initialized with 0 then in each iteration of for loop, element of array is added to the value. So it contains the sum.
24) diddl
As it returns substring starting from position from 12 till before 17
25) Java will automatically call the superclass's default constructor just before the code in the subclass's constructor executes
This is because the first line in constructor should be call of super() constructor. If it is not there, a call to default one of super class will be added. If default constructor of super is not present, it will throw compilation error.
26) meta data
Metadata contains the data/information about the other data.
27) All of the above
This is the property of abstract class, that they cannot be instantiated, there abstracts needs to be defined in subclass and abstract method must not be defined in abstract class.
28) A void method
It is not returning anything else. Just saving a value in num.
29) SQL Injection
It prevents from SQL injection because all the parameters passed will be escaped by JDBC driver.
30) Java will automatically call the superclass's default constructor just before the code in the subclass's constructor executes
As explained in Q. 25.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.