R4RIN
Articles
Java 8
MCQS
Java MCQ Quiz Hub
Java Mcq Question Set 6
Choose a topic to test your knowledge and improve your Java skills
1. Which of these class can generate an array which can increase and decrease in size automatically?
DynamicsList()
DynamicList()
ArrayList()
LinkedList()
2. Which of these method can be used to increase the capacity of ArrayList object manually?
ensureCapacity()
increasecapacity()
increaseCapacity()
Capacity()
3. Which of these method of ArrayList class is used to obtain present size of an object?
index()
size()
capacity()
length()
4. Which of these methods can be used to obtain a static array from an ArrayList object?
Array()
toArray()
covertArray()
covertoArray()
5. Which of these standard collection classes implements a linked list data structure?
LinkedList
HashSet
AbstractSet
AbstractList
6. Which of these method is used to add an element to the start of a LinkedList object?
addFirst()
AddFirst()
first()
add()
7. Which of these method of HashSet class is used to add elements to its object?
Add()
add()
insert()
addFirst()
8. Which of these methods can be used to delete the last element in a LinkedList object?
delete()
remove()
deleteLast()
removeLast()
9. Which of these object stores association between keys and values?
Map
Array
String
Hash table
10. Which of these method is used to reduce the capacity of an ArrayList object?
trimTosize()
trimToSize()
trimSize()
trim()
11. Which of these classes provide implementation of map interface?
LinkedList
HashMap
ArrayList
DynamicList
12. Which of these method is used to remove all keys/values pair from the invoking map?
remove()
delete()
removeAll()
clear()
13. Which of these method Map class is used to obtain an element in the map having specified key ?
get()
search()
look()
set()
14. Which of these methods can be used to obtain set of all keys in a map?
keySet()
getAll()
getKeys()
keyall()
15. Which of these method is used add an element and corresponding key to a map?
set()
put()
add()
redo()
16. Which of these standard collection classes implements all the standard functions on list data structure?
HashSet
AbstractSet
Array
LinkedList
17. Which of these method is used to make all elements of an equal to specified value?
fill()
add()
set()
all()
18. Which of these method of Array class is used sort an array or its subset?
bubblesort()
binarysort()
insert()
sort()
19. Which of these methods can be used to search an element in a list?
binaryserach()
find()
sort()
get()
20. Which of these method is used to change an element in a LinkedList Object?
add()
change()
redo()
set()
21. Which of these standard collection classes implements all the standard functions on list data structure?
HashSet
AbstractSet
LinkedList
Array
22. Which of these classes implements Set interface?
LinkedList
DynamicList
HashSet
ArrayList
23. Which of these class object can be used to form a dynamic array?
ArrayList
Map
Both a & b
Vector
24. Which of these are legacy classes?
Vector
Hashtable
Stack
All of the above
25. All of the above
HashMap
Enumeration
Hashtable
Map
26. What is the name of data member of class Vector which is used to store number of elements in the vector?
elements
elementCount
length
capacity
27. Which of these methods is used to add elements in vector at specific location?
addElement()
AddElement()
set()
add()
28. Which of these class object uses key to store value?
Dictionary
Map
Hashtable
All of the above
29. Which of these method is used to insert value and its key?
set()
put()
addElement()
insertElement()
30. Which of these is the interface of legacy is implemented by Hashtable and Dictionary classes?
Map
HashMap
Hashtable
Enumeration
31. Which of these is a class which uses String as a key to store the value in object?
ArrayList
Properties
Dictionary
Array
32. Which of these methods is used to retrieve the elements in properties object at specific location?
Elementat()
getProperty()
ElementAt()
get()
33. Which of these class object has architecture similar to that of array?
Hashtable
Bitset
Map
All of the above
34. Which of these method is used to make a bit zero specified by the index?
clear()
put()
set()
remove()
35. Which of these method is used to calculate number of bits required to hold the BitSet object?
numberofBits()
indexes()
length()
size()
36. Which of these is a method of class Date which is used to search weather object contains a date before the specified date?
contains()
after()
compareTo()
before()
37. Which of these methods is used to retrieve elements in BitSet object at specific location?
get()
Elementat()
getProperty()
ElementAt()
38. Which of these is a process of writing the state of an object to a byte stream?
Externalization
Serialization
File Filtering
All of the above
39. Which of these process occur automatically by java run time system?
Garbage collection
Serialization
File Filtering
All of the above
40. Which of these interface extends DataOutput interface?
Externalization
Serializable
ObjectInput
ObjectOutput
41. Which of these is a method of ObjectOutput interface used to finalize the output state so that any buffers are cleared?
flush()
close()
fflush()
clear()
42. Which of these is method of ObjectOutput interface used to write the object to input or output stream as required?
StreamWrite()
writeObject()
Write()
write()
43. Which of these is a process of extracting/removing the state of an object from a stream?
Externalization
Deserialization
Serialization
File Filtering
44. Which of these process occur automatically by java run time system?
Serialization
Deserialization
Memory allocation
All of the above
45. Which of these is an interface for control over serialization and deserialization?
Externalization
Serializable
FileFilter
ObjectInput
46. Which of these interface extends DataInput interface?
Serializable
ObjectInput
Externalization
ObjectOutput
47. Which of these is a method of ObjectInput interface used to deserialize an object from a stream?
Object WriteObject()
void close()
Object readObject()
int read()
48. Which of these class extend InputStream class?
ObjectInputStream
ObjectStream
ObjectInput
ObjectOutput
49. Which of these method can be used to make the main thread to be executed last among all the threads?
join()
stop()
sleep()
call()
50. Which of these method is used to find out that a thread is still running or not?
Alive()
checkRun()
run()
isAlive()
Submit