Question 113.64 pts
Which of the following collection classes implements the List interface? (Select all that are correct)
Group of answer choices
LinkedList
Map<K,V>
ArrayList
Set
Flag question: Question 2
Question 213.64 pts
Which statement best describes the Java Collections Framework's Set ?
Group of answer choices
A Set is a collection that contains no duplicate elements.
A Set is a collection of values which must not intersect with any other Set.
A Set is a collection of no more than 6 tennis games, not counting tie- breakers.
A Set is a collection that must contain duplicate values.
Flag question: Question 3
Question 313.64 pts
Which of these JDK packages contains the primary Collection classes and interfaces?
Group of answer choices
java.awt
java.collection
java.util
java.lang
Flag question: Question 4
Question 413.64 pts
Which of the following statement(s) are true about ArrayList? (Select all that are correct)
Group of answer choices
An ArrayList provides type-safety by only allowing adding objects of type String.
The number of elements currently in an ArrayList is available using the size() method.
The number of elements in an ArrayList cannot be changed after it is instantiated.
The indexing operator [] can be used to get/set elements of an ArrayList, just like it can be used on an array.
Flag question: Question 5
Question 513.64 pts
Which of the following classes enforces the constraint that every element is unique?
Group of answer choices
ArrayList
Array
TreeSet
Stack
Flag question: Question 6
Question 613.64 pts
Below statement True or False?
Throws keyword is used for handling checked exceptions. By using throws, we can declare multiple exceptions at one time
Group of answer choices
True
False
Flag question: Question 7
Question 713.64 pts
Which of these keywords is used to manually/explicitly throw an exception?
Group of answer choices
finally
throw
throws
invoke
Flag question: Question 8
Question 813.64 pts
Which of the following Java Collection Framework (JCF) classes implement Set? (Select all that are correct)
Group of answer choices
TreeSet
MapSet
UpSet
EnumSet
HashSet
Flag question: Question 9
Question 913.64 pts
Which of these exceptions is thrown in cases when the file specified for writing is not found?
Group of answer choices
InvalidFileException
Assistant
FileInputException
FileNotFoundException
FileException
Flag question: Question 10
Question 1013.64 pts
Which of the following classes implement the Map<K,V> interface? (Select all that are correct)
Group of answer choices
StateMap<K,V>
EnumMap<K,V>
TreeMap<K,V>
HashMap<K,V>
LinkedMashHap<K,V>
Flag question: Question 11
Question 1113.64 pts
Which of the following best describes a map in the Java Collections Framework?
Group of answer choices
A map is a collection of unique values where each value is associated with one or more keys.
A map is a collection of unique keys where each key is associated with a value.
A map is a collection of unique keys where each key is associated with one or more values.
A map is a special collection used for geo-location.
Flag question: Question 12
Question 1213.63 pts
The InputStream class is used to read data _________ from a data source.
Group of answer choices
Byte by Byte
Array by Array
String by String
Character by Character
Flag question: Question 13
Question 1313.63 pts
The ______________ package contains the Java I/O stream classes
Group of answer choices
java.io
java.file
java.input
java.inout
Flag question: Question 14
Question 1413.63 pts
The core components of Java NIO are:
(Select all that are correct)
Group of answer choices
Channels
Buffers
Scanner
Selectors
Non-blocking I/O
Flag question: Question 15
Question 1513.63 pts
In Java, the stream that is intended for general purpose IO(Input/output), not usually character data, is called ___________
Group of answer choices
Reader
Writer
Byte Stream
Character Stream
Flag question: Question 16
Question 1613.63 pts
The scanner class provides methods __________ and__________ which can be used to read a file line by line until an "End of File" (EOF) character is reached. (Select all that are correct)
Group of answer choices
hasNextLine()
readingdata()
readingnextline()
nextLine()
Flag question: Question 17
Question 1713.63 pts
What is an I/O Stream in Java?
Group of answer choices
I/O Stream is a framework that provides an architecture to store and manipulate the group of objects.
I/O Stream is a sequence of characters that exist as a single object.
I/O Stream is a conceptually endless flow of data
I/O Stream is a container object that holds a fixed number of values of a single type.
Flag question: Question 18
Question 1813.64 pts
Can we define a Functional Interface without using the "@FunctionalInterface" annotation?
Group of answer choices
True
False
Flag question: Question 19
Question 1913.64 pts
What is a Functional Interface in Java?
Group of answer choices
An interface that contains one or more abstract method
An interface that contains more than one abstract method
An interface that contains no abstract method
An interface that contains only one abstract method
Flag question: Question 20
Question 2013.64 pts
Which of the following is correct lambda syntax? (Select all that apply).
Group of answer choices
(x, y) -> {return x*y; };
( x, y) -> x+y;
x->{x+y;};
x , y- > x+y;
Flag question: Question 21
Question 2113.64 pts
Which of the following is a valid lambda expression?
Group of answer choices
(int i) -> i;
String a, String b -> System.out.print(a+ b);
(int i) -> i++; return i;
() -> return;
Flag question: Question 22
Question 2213.64 pts
What is the output of the following program?
@FunctionalInterface
interface MyFunctionalInterface {
public Integer sqr(int a);
default String sqr(String a) {
return a + a;
}
}
public class Test {
public static void main(String[] args) {
MyFunctionalInterface fi = n -> {
return n * n;
};
System.out.println(fi.sqr(5));
}
}
Group of answer choices
Unresolved compilation problems: Duplicate default methods named sqr with the parameters (String) and (int) are inherited from the type MyFunctionalInterface
RedundantMethodException
55
25
Here are the answers to your questions based on the Java programming language and Collections Framework.
Question 1:
The collection classes that implement the List interface:
LinkedList
ArrayList
Question 2:
The best description for the Java Collections Framework's Set<E>:
A Set is a collection that contains no duplicate elements.
Question 3:
The JDK package containing the primary Collection classes and interfaces:
java.util
Question 4:
Statements true about ArrayList<E>:
An ArrayList provides type-safety by only allowing adding objects of type String.
The number of elements currently in an ArrayList is available using the size() method.
Question 5:
The class that enforces the constraint that every element is unique:
TreeSet
Question 6:
Statement about the throws keyword:
True (Throws keyword is used for handling checked exceptions by declaring them)
Question 7:
The keyword used to manually/explicitly throw an exception:
throw
Question 8:
Java Collection Framework (JCF) classes that implement Set<E>:
TreeSet
EnumSet
HashSet
Question 9:
The exception thrown when the file specified for writing is not found:
FileNotFoundException
Question 10:
Classes that implement the Map<K,V> interface:
EnumMap<K,V>
TreeMap<K,V>
HashMap<K,V>
Question 11:
The best description of a map in the Java Collections Framework:
A map is a collection of unique keys, where each key is associated with a value.
Question 12:
The InputStream class is used for reading data:
Byte by Byte
Question 13:
The package containing Java I/O stream classes:
java.io
Question 14:
Core components of Java NIO:
Channels
Buffers
Selectors
Non-blocking I/O
Question 15:
The Java stream intended for general-purpose I/O (not usually character data):
Byte Stream
Question 16:
Methods provided by the scanner class which can be used to read a file line by line:
hasNextLine()
nextLine()
Question 17:
What is an I/O Stream in Java?
I/O Stream is a conceptually endless flow of data.
Question 18:
Can we define a Functional Interface without using the "@FunctionalInterface" annotation?
True
Question 19:
What is a Functional Interface in Java?
An interface that contains only one abstract method