Save
Upgrade to remove ads
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

OOP MOD 9&10

QuestionAnswer
How many ways does the java.lang.Comparable interface allow us to sort a collection? 1
Which of these is Basic interface that all other interface inherits? Collection
vWhich of these methods sets every element of a List to a specified object? fill()
What type of List is used with synchronized access? Vector
Which of these is an incorrect form of using method max() to obtain maximum element? max(Comparator comp)
Which of the following class doesn't implement the Set interface? None of the above
What is the correct difference between HashSet and HashMap? HashSet contains only values whereas HashMap contains the key and value pair.
A PriorityQueue is always sorted in natural order? false
Which of the following is not true for a generic collection? Generic collection is not mutable.
Which of the following is a correct difference between HashMap and Hashtable? HashMap is not synchronized while the Hashtable is synchronized.
The display(byte[]) method of OutputStream Class is used to write an array of byte to the current output stream. False
System.err is the standard error stream. true
In Java, 3 streams are created for us automatically. true
A stream is a sequence of data. True
An _________ accepts output bytes and sends them to some sink. OutputStream
A method of the FileWriter class that is used to write char array into FileWriter. write(char[] c)
The FileReader (String file) is the constructor of the FileReader class that creates a new file and get its file name in string false
write (char c) is a method of the FileWriter class that is used to write the char into FileWriter. True
A method of the FileWriter class that is used to close the FileWriter. close()
A method of the FileWriter class that is used to write the char into FileWriter. write (char c)
Which of these interface is not a part of Java's collection framework? SortedList
We can use any object with the methods of the java.util.Arrays class? Yes
We can use any object with the methods of the java.util.Arrays class? No
Which of these interface declares core method that all collections will have? Collection
Which of these methods deletes all the elements from invoking collection? clear()
What type of set would you use if you wanted it sorted? TreeSet
Which of the following is a correct difference between List and Set? List can hold duplicate elements while Set includes only unique elements.
What is the design pattern followed by Iterator? None
InputString is used to read data from a source; it may be a file, an array, peripheral device or socket. true
It is the superclass of all classes representing an output stream of bytes. OutputStream
The erase() method of OutputStream Class flushes the current output stream. false
An output stream accepts output bytes and sends them to some sink. true
flush() is a method of the FileWriter class that flushes the data of FileWriter. true
create (char[] c) is a method of the FileWriter class that is used to write char array into FileWriter. false
Java FileReader class returns data in byte format like FileInputStream class. true
WriterFile(String file) is a constructor of the Filewriter class that creates a new file and get its file name in string false
A constructor of the Filewriter class that creates a new file and get its file name in string FileWriter(String file)
Which method do we need to implement in the java.util.Comparator interface? compare()
Which method do we need to implement in the java.lang.Comparable interface? compareTo()
If two arrays hold the same elements they are considered equal by the Arrays.equals() method? false
Which type of list implements the Queue interface LinkedList
You can't put null elements into Queues in the API? true
What type of ordering does a PriorityQueue have? ordered and sorted
What type of Queue is a PriorityQueue? PIPO
Which of the following is a correct difference between HashSet and TreeSet? HashSet maintains no order while TreeSet maintains ascending order.
All are invalid codes in getting an input from the console, except one. i=System.in.read();
InputStream is used to read data from a source; it may be a file, an array, peripheral device or socket. true
System.in is the standard input stream. true
The write(int) method of OutputStream Class is used to write a byte to the current output stream. true
What are the valid Constructors of FileReader class? (choose two) FileReader (String file) FileReader (File file)
read () is a method of the FileReader class that is used to return a character in ASCII form. It returns 0 at the end of file. false
create (char c) is a method of the FileWriter class that is used to write the char into FileWriter. false
Java FileReader class is used to read data from the file. true
Is the following code snippet valid? List aList = new ArrayList(); yes
Which of the following is a benefit of using the Java Collections Framework? More robust codebase
Which of these classes is not part of Java's collection framework? Array
What do sets care about Uniqueness
Which of the following is not true in case of a WeakHashMap? WeakHashMap doesn't allow null keys and null values.
Automatically created streams are attached with the console. true
The ________ method of OutputStream Class flushes the current output stream. flush()
A string is a sequence of data. true
read () is a method of the FileReader class that is used to return a character in ASCII form. It returns -1 at the end of file. true
In using FileWriter class, unlike FileOutputStream class, you don't need to convert string into byte array because it provides method to write string directly. true
In using __________, unlike FileOutputStream class, you don't need to convert string into byte array because it provides method to write string directly. FileWriter class
A constructor of the FileReader class that creates a new file and get its file name in file objects. FileReader (File file)
Which interface would we use to sort a class that can't be modified? java.util.Comparator
Which of these interface is not a part of Java's collection framework? SortedList
Which of the following is a valid difference between Set and Map? Set contains only values whereas Map contains key and values both.
OutputStrean is the superclass of all classes representing an output stream of bytes. true
The close() method of OutputStream Class is used to close the current output stream. true
write (String text) is a method of the FileWriter class that is used to write the string into FileWriter. true
scan () is a method of the FileReader class that is used to return a character in ASCII form. It returns -1 at the end of file. false
A method of the FileWriter class that is used to write the string into FileWriter. write (String text)
flush () is a method of the FileWriter class that is used to close the FileWriter. false
Which of these packages contain all the collection classes? java.util
Which of the following is not true for the IdentityHashMap? IdentityHashMap is synchronized.
What type of variables can we use with the java.util.Collections Class? reference variables
What type of collection does not extend the Collection interface? Map
Which of the following is a correct difference between the Iterator and Enumeration? Iterator can traverse legacy and non-legacy containers whereas the Enumeration can traverse only legacy containers.
System.error is the standard error stream. false
The flush() method of OutputStream Class is used to close the current output stream. false
In using FileWriter class, like FileOutputStream class, you need to convert string into byte array because it provides method to write string directly. false
Java ReadFile class is a character-oriented class which is used for file handling in java. false
What type of collection has always been type safe Array
Which of the following method you need to override for using an object as key in a HashMap? hashCode()
What do maps care about Uniqueness
Which of the following is not true for a fail-fast iterator? Fail fast system reports the failure right away but the system recovers after the failure.
The display(int) method of OutputStream Class is used to write a byte to the current output stream. false
The flush() method of OutputStream Class flushes the current output stream. true
This the standard error stream. System.err
FileWriter(String file) is a constructor of the Filewriter class that creates a new file and get its file name in string true
close() is a method of the FileWriter class that is used to close the FileWriter. true
Java ReadFile class returns data in byte format like FileInputStream class. false
What type of exception is raised when we run a program with objects that are not mutually comparable in a sorted set? ClassCastException
You can't put null elements into Lists in the API? false
What is Collection in Java? A group of interfaces
What is the correct difference between HashMap and TreeMap? HashMap maintains no order but TreeMap maintains ascending order.
An output strean accepts output bytes and sends them to some sink. true
System.util.Scanner is the standard input stream. false
A stream is composed of bytes true
A method of the FileReader class that is used to return a character in ASCII form. It returns -1 at the end of file. read()
A constructor of the FileReader class that creates a new file and get its file name in string FileReader (String file)
What are we referring to when we mention java.util.Collections A utilility class for use with collections
What type of collections are Lists? ordered
What type of collection would we use if we wanted no duplicates? Set
OutputStream is the superclass of all classes representing an output stream of bytes. true
OutputStream is used to write data to a destination; it may be a file, an array, peripheral device or socket. true
This the standard output stream. System.out
write (char[] c) is a methodIs the following code snippet valid? public class SimpleGenericInterfaceImpl implements SimpleGenericInterface { ? of the FileWriter class that is used to write char array into FileWriter. true
A constructor of the Filewriter class that creates a new file and get its file name in file objects. FileWriter(File file)
What do Lists have in common? an index
Which of the following is a correct method to convert the array of strings into a list? Arrays class asList() method
Which of these interface handle sequences? List
Within a PriorityQueue the elements sorted last are processed first? false
n Java, 2 streams are created for us automatically true
The write(byte[]) method of OutputStream Class is used to write an array of byte to the current output stream. true
Java In/Ou is used to process the input and produce the output true
Java ReadFile class is used to read data from the file. false
A method of the FileWriter class that flushes the data of FileWriter flush()
WriterFile(File file) is a constructor of the Filewriter class that creates a new file and get its file name in file objects. true
Which List would you use if wanted fast access and were doing lots of insertions and deletions? LinkedList
Which of these is static variable defined in Collections? All of the mentioned
The __________method of OutputStream Class is used to write a byte to the current output stream. write(int)
The java.io package contains all the classes required for input and output operations. true
Java FileReader class is a character-oriented class which is used for file handling in java. true
Which of the following is not true for the UnsupportedOperationException? It occurs if a method is not found in the underlying collection.
Java ReadFile class returns data in byte format like FileInputStream class. false
The FileReader (File file) is the constructor of the FileReader class that creates a new file and get its file name in file objects. false
There are no direct implementation of the Collection interface? true
You can't put null elements into Lists in the API? false
A stream is composed of bits true
Is the following code snippet valid? public class SimpleGenericInterfaceImpl implements SimpleGenericInterface { ? no
All are valid codes in printing error message in the console, except one. System.err.print="Hello";
Created by: jxxnixx
 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards