NPTEL Data Structure And Algorithms Using Java Week 9 Assignment Answers 2023

Join Our WhatsApp Group Join Now
Join Us On Telegram Join Now

NPTEL Data Structure And Algorithms Using Java Week 9 Assignment Solutions

NPTEL Data Structure And Algorithms Using Java Assignment 1 Answers 2023

NPTEL Data Structure And Algorithms Using Java Week 9 Assignment Answers 2023

1. Which of the following statements is/ are INCORRECT when it comes to set collection?
a. Set Interface in Java is present in java.util package.
b. Set Interface extends the Collection interface.
C. Set represents an unordered set of elements which doesn’t allow us to store the duplicate items.
d. We can’t store null element in Set.

Answer :- For Answer Click Here

2. Which of the following declarations is/are Incorrect?
a. Set s1 = new HashSetO:
b. Set s2 = new LinkedHashSetO:
c. Set s3 = new TreeSetO;
d. Set s4 = HashSetO:

Answer :- For Answer Click Here

3. Which of the following statements is/are incorrect in the case of HashSet class?
a. HashSet extends AbstractSet and implements the set interface.
b. It creates a collection that uses a hash table for storage.
c. HashSet is a generic class that has this declaration:
class HashSet
d. HashSet guarantees the order of its elements because the process of hashing doesn’t usually lend itself to the creation of sorted sets.

Answer :- For Answer Click Here

4. Which of the following is/are appropriate ways of iterating over a HashSet?
a. Iterate over a HashSet using a simple for-each loop.
b. Iterate over a HashSet using iterator0.
c. Iterate over a HashSet using Java forEach and Lambda expression.
d. Iterate over a HashSet using iterator0 and forEachRemaining0 method

Answer :- For Answer Click Here

5. What is the difference between HashSet and LinkedHashSet?
a. HashSet and LinkedHashSet are the same. There is no difference.
b. HashSet does guarantee the order of its elements because the process of hashing usually lends itself to the creation of sorted sets. In contrast, the LinkdeHashSet doesn’t follow the same order of the items as they are added into the set.
c. HashSet does not guarantee the order of its elements because the process of hashing doesn’t usually lend itself to the creation of sorted sets. In contrast, the LinkedHashSet follows the same order of the items as they are added into the set.
d. HashSet and LinkedHashSet are both implementations of the Set interface in Java, and they doesn’t have any key differences in terms of their characteristics and behavior

Answer :- For Answer Click Here

6. Which of the following options is/are Incorrect in the case of Streams in JAVA?
a. A Stream is a sequence of data.
b. Java I/O (Input and Output) is used to process the input and produce the output.
c. “Stream” is called Stream because it is continuous flow of data
d. We can’t perform file handling in Java by java.io API.

Answer :- For Answer Click Here

7. Character stream classes are used for?
a. Read and write characters and support a number of input-output-related methods.
b. Only to read characters
c. Only to write characters
d. Read and write characters but doesn’t support input-output related methods

Answer :- For Answer Click Here

8. Fill in the blank
class is an abstract class. It is the superclass of all classes representing an outpu stream of bytes. An output stream accepts output bytes and sends them to some sink.
a. OutputStream
b. InputStream
c. Abstract
d. Super

Answer :- For Answer Click Here

9. Which of the following is not a use of class OutputStream?
a. Writing bytes
b. Closing a stream
c. Cleaning a buffer
d. Reading bytes

Answer :- For Answer Click Here

10.

NPTEL Data Structure And Algorithms Using Java Week 9 Assignment Answers 2023
Answer :- For Answer Click Here
Course NameData Structure And Algorithms Using Java
CategoryNPTEL Assignment Answer
Home Click Here
Join Us on TelegramClick Here

Leave a comment