QUESTIONS 100% VERIFIED ANSWERS
A test case can't return an error when the code is correct.
true
false
- answers-false
An abstract class can be _____________.
instantiated
all of the above
extended
without constructor
- answers-extended
An abstract class cannot be _____________.
extended
all of the above
instantiated
assigned as a type for an object reference
- answers-instantiated
An array can have several different types of data simultaneously.
false
true
- answers-False
, An array can hold multiple values of the same type of data.
false
true
- answers-true
Class Book inherits from class Product. Select all of the following ArrayLists that could
hold Book-type objects
ArrayList<Book> = new ArrayList<>();
ArrayList<Object> = new ArrayList<>();
ArrayList<String> = new ArrayList<>();
ArrayList<Product> = new ArrayList<>();
- answers-ArrayList<Book> = new ArrayList<>();
ArrayList<Object> = new ArrayList<>();
ArrayList<Product> = new ArrayList<>();
Given a document "employees.txt" that contains the following lines:
Name,Dept,ID
Manar,Sale,801
Sami,Engineering,802
Dalia,Production,800
David,Sale,804
Omar,Sale,805
Rama,Sale,806
and the following code that reads this file:
ArrayList<String> empData = new ArrayList();
fileScanner = new Scanner(new File("employees.txt"));
fileScanner.nextLine();
while (fileScanner.hasNextLine()) {
String line = fileScanner.nextLine();
String[] lineArray = line.split(",");
if (lineArra[1] == "Sale" && lineArray[2] > 801) ) {
empData.add(lineArray[0]);
}
}