Java - Online Test - Map - javasearch.buggybread.com


Share

Search Java Test Questions


 223 test questions in repository.




Java - Test Questions on 'map' - 24 questions found


Which of the following collection maintain its elements in Natural Sorted order ? Core Java
HashMap
TreeMap
LinkedHashMap
LinkedMap

  treemap  collections  java  sorted collections  map

Which of the following collections stores its elements in insertion Order ?Core Java
HashMap
TreeMap
LinkedHashMap
LinkedMap

  linkedhashmap  collections  java  map

If we add Enum constants to a sorted collection ( Treemap , TreeSet ), What will be the order in which they will be maintained ?Core Java
Sorted Collection wont maintain them in any order.
Insertion Order
Order in which constants are declared.
Natural Sorting Order.

  enum  collections  sorted collections  treemap  treeset  compareTo  comparable  java

If we try to add duplicate key to the HashMap, What will happen ?Core Java
It will throw an exception.
It won't add the new Element without any exception.
The new element will replace the existing element.
Compiler will identify the problem and will throw an error.

  hashmap  map  collections  java

Which of the following is false ?Core Java
HashMap came before HashTable.
HashMap allows null values whereas Hashtable doesn’t allow null values.
HashTable and HashMap allow Key-Value pairs.
Hashtable is synchronized whereas HashMap is not.

  map  hashmap  hashtable  collection  java

Which of the collections allows null as the key ?Core Java
HashTable
HashMap
TreeMap
LinkedHashMap

  java  collections  map

Effective Java 6 , TreeMap implements ...Core Java
Map Interface
SortedMap Interface
NavigableMap Interface
SortedNavigableMap Interface

  java  collections  map

Which of the following is a valid flow in Hadoop ?Bigdata
Input -> Reducer -> Mapper -> Combiner -> -> Output
Input -> Mapper -> Reducer -> Combiner -> Output
Input -> Mapper -> Combiner -> Reducer -> Output
Input -> Reducer -> Combiner -> Mapper -> Output

  hadoop  map reduce

MapReduce was devised by ...Bigdata
Apple
Google
Microsoft
Samsung

  hadoop  map reduce

Which of the following is not a phase of Reducer ?Bigdata
Map
Reduce
Shuffle
Sort

  hadoop  map reduce

What is the input to the Reduce function ?Bigdata
One Key and One Value
Multiple Keys and Multiple associated Values
Multiple Keys and One associated values with each
One key and associated values.

  hadoop  bigdata  big data  map-reduce  map reduce  reduce function

Which of the following is the implementation language for Map Reduce Framework ?
Big Data
Hadoop
Java
C++

  hadoop  bigdata  big data  map-reduce  map reduce framework

Which of the following collections stores its elements in natural sorting order ?Core Java
HashMap
LinkedHashMap
TreeMap
EnumMap

  map  collections

Semaphores are used to solve problem of ... Operating system
Race Condition
Process Synchronization
Mutual Exclusion
All of above

  Semaphore  Operating system

Which keyword is used to provide explicit access of a code block to single thread ?Core Java
Transient
Final
Explicit
Synchronized

  java  threads  multithreading

Which of the following Java feature promotes access protection or Hiding ?Core Java
Inheritance
Encapsulation
Abstraction
Composition

  java  java concepts  java features  oops concepts  oops features  access protection  information hiding

Which of the following is true ?Core Java
Composition is Tightly Bound
Inheritance is Tightly Bound
Object can only hold reference of only one other object
A Class cannot be extended by multiple classes

  

Which method needs to be implemented if a class is implementing comparable interface ?Core Java
comp
compare
compareTo
compareEquals

  comparable  interfaces  compare  compareTo

Collections is a / an ..Core Java
interface
abstract class
final class
util class

  collections

What will be the output upon executing main method ?

public static void main(String[] args){
      Set set = new HashSet();
      set.add(1);
      set.add(2);
      set.add(3);
      System.out.println(set);
   }
Core Java
1,2,3
Order cannot be determined
Compilation error
3,2,1

  set  hashset  collections

Binary Search requires that the collection should beAlgorithm
Sorted in Ascending Order
Sorted in Descending Order
Sorted in any Order
Unsorted

  Binary Search  Search  Algorithm

What is the relationship between Vehicle and Engine in this example ?

public class Vehicle {
   Enginer engine;
   public void move(){
      engine = new Engine();
      engine.start();
   }
}
Core Java
Composition ( Vehicle has a Engine )
Composition ( Engine has a Vehicle )
Inheritance ( Vehicle is a Engine )
Inheritance ( Engine is a Vehicle )

  composition  inheritance  oops concepts

What is the relationship between Car and Vehicle in the following code ?

public class Car extends Vehicle{
   Engine engine;   
   
   public static void main(String[] args){
      Vehicle vehicle = new Car();
      car.move();
   }   

   public void move(){
      engine = new Engine();
      engine.start();
   }
}
Core Java
Composition ( Vehicle has a Car )
Composition ( Car has a Vehicle )
Inheritance ( Vehicle is a Car )
Inheritance ( Car is a Vehicle )

  Inheritance  Composition  Oops concepts

What is the problem with the following code ?

public class Car extends Vehicle{
   Vehicle vehicle;
   
   Car(){
      super();
      this.vehicle = new Vehicle();
   }
}
Core Java
There is an Inheritance as well as Composition relationship between Vehicle and Car which is not permitted
We cannot initialize the parent class instance within the constructor
Call to super is illegal
There is no problem

  Composition  Inheritance  OOPS concepts







comments powered by Disqus