VERIFIED ANSWERS
\Q\.How many objects are created by the following code?
List<String> actors = ArrayList<String>(4); - ANSWERS✔-1
\Q\.What does the Scanner class consider to be a word (assuming the default delimiters are
used)? - ANSWERS✔-Any series of non-whitespace characters
\Q\.Consider the following classes:
AndOne.png
What is the output of the following code segment?
And curry = new One(2);
System.out.print( curry.scoreBoard() ); - ANSWERS✔-AndOne: 4
\Q\.Consider the following two versions of a search() method, both of which are intended to
return true if the given list contains the target value, and false otherwise:
Version 1:
, public boolean search(List<Object> list, Object target)
{
for (int i = 0; i < list.size(); i++)
{
if (target.equals(list.get(i)))
{
return true;
}
}
return false;
}
Version 2:
public boolean search(List<Object> list, Object target)
{
boolean found = false;
for (int i = 0; i < list.size(); i++)
{
if (target.equals(list.get(i)))
{
found = true;
}
}
return found;
}