A HashMap allows the existence of:
Anonymous Quiz
19%
null values
28%
one null key
17%
None of these
36%
All of these
Veracode uncovers the top security issues facing specific programming languages - SD Times
https://sdtimes.com/security/veracode-uncovers-the-top-security-issues-facing-specific-programming-languages/
https://sdtimes.com/security/veracode-uncovers-the-top-security-issues-facing-specific-programming-languages/
SD Times
Veracode uncovers the top security issues facing specific programming languages - SD Times
Veracode details the top security issues affecting the top programming languages, such as .NET, C++, Java, JavaScript, PHP and Python.
What implementation of Iterator can traverse a collection in both directions?
Anonymous Quiz
24%
Iterator
45%
ListIterator
14%
SetIterator
17%
MapIterator
The Comparable interface contains which called?
Anonymous Quiz
40%
toCompare
9%
compare
43%
compareTo
9%
compareWith
Which is faster and uses less memory?
Anonymous Quiz
22%
ListEnumeration
31%
Iterator
42%
Enumeration
6%
ListIterator
What Iterator can throw a ConcurrentModificationException?
Anonymous Quiz
25%
Fail-fast Iterators
18%
b.Fail-safe Iterators
54%
All of these
4%
None of these
What is the default number of Partitions/segments in Concurrent Hash Map?
Anonymous Quiz
20%
12
30%
32
17%
4
33%
16
Which is best suited to a multi-threaded environment?
Anonymous Quiz
12%
WeakHashMap
32%
Hashtable
29%
HashMap
26%
ConcurrentHashMap
Which does NOT implement the Collection interface?
Anonymous Quiz
8%
a.List
46%
b.Map
8%
c.Set
38%
None of these
Which provides better performance for the insertion and removal from the middle of the list?
Anonymous Quiz
6%
Vector
31%
ArrayList
40%
LinkedList
23%
All of these
import java.util.Arrays;
import java.util.Comparator;
class Sort implements Comparator<Integer>{
public int compare(Integer o1,Integer o2){
return o2.compareTo(o1);
}
}
public class Program
{
public static void main(String[] args) {
Integer intArray[]={2,3,1};
Arrays.sort(intArray,new Sort());
for(int i: intArray ){
System.out.print(i+" ");
}
}
}
import java.util.Comparator;
class Sort implements Comparator<Integer>{
public int compare(Integer o1,Integer o2){
return o2.compareTo(o1);
}
}
public class Program
{
public static void main(String[] args) {
Integer intArray[]={2,3,1};
Arrays.sort(intArray,new Sort());
for(int i: intArray ){
System.out.print(i+" ");
}
}
}
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
public class Program
{
public static void main(String[] args) {
Set set=new TreeSet();
set.add(1);
set.add("2");
set.add(3);
Iterator iterator=set.iterator();
while(iterator.hasNext()){
System.out.print(iterator.next()+" ");
}
}
}
import java.util.Set;
import java.util.TreeSet;
public class Program
{
public static void main(String[] args) {
Set set=new TreeSet();
set.add(1);
set.add("2");
set.add(3);
Iterator iterator=set.iterator();
while(iterator.hasNext()){
System.out.print(iterator.next()+" ");
}
}
}
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class Program
{
public static void main(String[] args) {
List<String> arrayList=new ArrayList<String>();
arrayList.add("a");
arrayList.add("b");
Iterator<String> iterator= arrayList.iterator();
while(iterator.hasNext()){
System.out.println(iterator.next());
arrayList.add("c");
}
}
}
import java.util.Iterator;
import java.util.List;
public class Program
{
public static void main(String[] args) {
List<String> arrayList=new ArrayList<String>();
arrayList.add("a");
arrayList.add("b");
Iterator<String> iterator= arrayList.iterator();
while(iterator.hasNext()){
System.out.println(iterator.next());
arrayList.add("c");
}
}
}
An unordered array has a search time complexity of:
Anonymous Quiz
33%
O(log n)
24%
O(n)
39%
O(n+1)
3%
O(1)
The add and remove method in TreeSet have a time complexity of:
Anonymous Quiz
7%
O(n)
34%
O(n+1)
31%
O(1)
28%
O(log n)