On Java | More Q&A Click Here
# | Question | Options | Answer |
---|---|---|---|
201 | Which of these keywords are used to define an abstract class? | abstract | |
202 | Which of these is not abstract? | Thread | |
203 | If a class inheriting an abstract class does not define all of its function then it will be known as? | Abstract | |
204 | Which of these is not a correct statement? | Abstract class can be initiated by new operator | |
205 | Which of these packages contains abstract keyword? | java.lang | |
206 | Which of these class is superclass of String and StringBuffer class? | java.lang | |
207 | Which of these operators can be used to concatenate two or more String objects? | + | |
208 | Which of this method of class String is used to obtain a length of String object? | length() | |
209 | Which of these constructors is used to create an empty String object? | String() | |
210 | Which of these is an incorrect statement? | StringBuffer class is used to store string in a buffer for later use | |
211 | Which of this method of class String is used to extract a substring from a String object? | substring() | |
212 | Which of these method of class String is used to remove leading and trailing whitespaces? | trim() | |
213 | What is the value returned by function compareTo() if the invoking string is greater than the string compared? | value greater than zero | |
214 | Which of the following statement is correct? | replace() method replaces all occurrences of one character in invoking string with another character | |
215 | Which of these method of class String is used to compare two String objects for their equality? | equals() | |
216 | Which of these methods is used to compare a specific region inside a string with another specific region in another string? | regionMatches() | |
217 | Which of these methods of class String is used to check whether a given object starts with a particular string literal? | startsWith() | |
218 | What is the value returned by function compareTo() if the invoking string is less than the string compared? | value less than zero | |
219 | Which of these data type value is returned by equals() method of String class? | boolean | |
220 | Which of these class is used to create an object whose character sequence is mutable? | StringBuffer() | |
221 | Which of this method of class StringBuffer is used to concatenate the string representation to the end of invoking string? | append() | |
222 | Which of these method of class StringBuffer is used to find the length of current character sequence? | length() | |
223 | Which of the following statement is correct? | reverse() method reverses all characters | |
224 | Which of these methods of class StringBuffer is used to extract a substring from a String object? | substring() | |
225 | Which of this method of class StringBuffer is used to reverse sequence of characters? | reverse() | |
226 | Which of this method of class StringBuffer is used to get the length of the sequence of characters? | length() | |
227 | Which of these is a process of writing the state of an object to a byte stream? | Serialization | |
228 | Which of these process occur automatically by the java runtime system? | Serialization | |
229 | Which of these is an interface for control over serialization and deserialization? | Externalization | |
230 | Which of these interface extends DataOutput interface? | ObjectOutput | |
231 | Which of these is a method of ObjectOutput interface used to finalize the output state so that any buffers are cleared? | flush() | |
232 | Which of these is method of ObjectOutput interface used to write the object to input or output stream as required? | writeObject() | |
233 | Which of these is a process of extracting/removing the state of an object from a stream? | Deserialization | |
234 | Which of these process occur automatically by java run time system? | All of the mentioned | |
235 | Which of these interface extends DataInput interface? | ObjectInput | |
236 | Which of these class extend InputStream class? | ObjectInputStream | |
237 | How an object can become serializable? | If a class or any superclass implements java.io.Serializable interface | |
238 | What is serialization? | Turning object in memory into stream of bytes | |
239 | What is deserialization? | Turning stream of bytes into an object in memory | |
240 | How many methods Serializable has? | 0 | |
241 | What type of members are not serialized? | Static | |
242 | If member does not implement serialization, which exception would be thrown? | NotSerializableException | |
243 | Which of the following methods is used to avoid serialization of new class whose super class already implements Serialization? | writeObject() | |
244 | Which of the following methods is not used while Serialization and DeSerialization? | readWriteObject() | |
245 | Which of these package contains classes and interfaces for networking? | java.net | |
246 | Which of these is a protocol for breaking and sending packets to an address across a network? | TCP/IP | |
247 | How many ports of TCP/IP are reserved for specific protocols? | 1024 | |
248 | How many bits are in a single IP address? | 32 | |
249 | Which of these is a full form of DNS? | Domain Name Service | |
250 | Which of these class is used to encapsulate IP address and DNS? | InetAddress | |
251 | Which of these interface abstractes the output of messages from httpd? | LogMessage | |
252 | Which of these class is used to create servers that listen for either local or remote client programs? | ServerSockets | |
253 | Which of these is a standard for communicating multimedia content over email? | Mime | |
254 | Which of these methods is used to make raw MIME formatted string? | parse() | |
255 | Which of these class is used for operating on request from the client to the server? | httpd | |
256 | Which of these method of MimeHeader is used to return the string equivalent of the values stores on MimeHeader? | toString() | |
257 | Which of these is an instance variable of class httpd? | All of the mentioned | |
258 | Which of these methods of httpd class is used to read data from the stream? | getRawRequest() | |
259 | Which of these method of httpd class is used to get report on each hit to HTTP server? | logEntry() | |
260 | Which of these methods are used to find a URL from the cache of httpd? | serveFromCache() | |
261 | Which of these variables stores the number of hits that are successfully served out of cache? | hits.to.cache | |
262 | Which of these method of httpd class is used to write UrlCacheEntry object into local disk? | writeDiskCache() | |
263 | Which of these method is used to start a server thread? | run() | |
264 | Which of these method is called when http daemon is acting like a normal web server? | handleGet() | |
265 | Which of these standard collection classes implements a dynamic array? | ArrayList | |
266 | Which of these class can generate an array which can increase and decrease in size automatically? | ArrayList() | |
267 | Which of these method of ArrayList class is used to obtain present size of an object? | size() | |
268 | Which of these methods can be used to obtain a static array from an ArrayList object? | toArray() | |
269 | Which of these method is used to reduce the capacity of an ArrayList object? | trimToSize() | |
270 | Map implements collection interface? | False | |
271 | Which of the below does not implement Map interface? | Vector | |
272 | What is the premise of equality for IdentityHashMap? | Reference equality | |
273 | What happens if we put a key object in a HashMap which exists? | The new object replaces the older object | |
274 | If two threads access the same hashmap at the same time, what would happen? | ConcurrentModificationException | |
275 | If large number of items are stored in hash bucket, what happens to the internal structure? | The bucket will switch from LinkedList to BalancedTree | |
276 | How can we remove an object from ArrayList? | remove() method and using Iterator | |
277 | How to sort elements of ArrayList? | Collections.sort(listObj); | |
278 | When two threads access the same ArrayList object what is the outcome of the program? | ConcurrentModificationException is thrown | |
279 | How is Arrays.asList() different than the standard way of initialising List? | Arrays.asList() returns a fixed length list and doesn’t allow to add or remove elements | |
280 | What is the difference between length() and size() of ArrayList? | length() returns the capacity of ArrayList and size() returns the actual number of elements stored in the list | |
281 | Which class provides thread safe implementation of List? | CopyOnWriteArrayList | |
282 | Which of the below is not an implementation of List interface? | SessionList | |
283 | What does Collections.emptySet() return? | Immutable Set | |
284 | What is the relation between hashset and hashmap? | HashSet internally implements HashMap | |
285 | What is the difference between TreeSet and SortedSet? | SortedSet is an interface; TreeSet is a concrete class | |
286 | What happens if two threads simultaneously modify TreeSet? | ConcurrentModificationException is thrown | |
287 | What is the unique feature of LinkedHashSet? | It maintains the insertion order and guarantees uniqueness | |
288 | Which of these standard collection classes implements a linked list data structure? | LinkedList | |
289 | Which of these classes implements Set interface? | HashSet | |
290 | Which of these method is used to add an element to the start of a LinkedList object? | addFirst() | |
291 | Which of these method of HashSet class is used to add elements to its object? | add() | |
292 | Which of these methods can be used to delete the last element in a LinkedList object? | removeLast() | |
293 | Which of this method is used to change an element in a LinkedList Object? | set() | |
294 | Which of these object stores association between keys and values? | Map | |
295 | Which of these classes provide implementation of map interface? | HashMap | |
296 | Which of these method is used to remove all keys/values pair from the invoking map? | remove() | |
297 | Which of these method Map class is used to obtain an element in the map having specified key? | get() | |
298 | Which of these methods can be used to obtain set of all keys in a map? | keySet() | |
299 | Which of these method is used add an element and corresponding key to a map? | put() | |
300 | Which of these class object can be used to form a dynamic array? | ArrayList & Vector |