Play Framework Interview Questions & Answers

4 avg. rating (80% score) - 1 votes

Play Framework Interview Questions & Answers

Do you see lot of pressure in your current job? Wanted to change the job? Are you interested to work in the IT field? Then log on to www.wisdomjobs.com. Play framework is an open-source web application, written in Scala and also usable from other programming languages that are compiled to byte code, which follows the model-view-controller architectural pattern. Play frame work developer assists in developing and designing high performance, scalable, cloud native headless web application with web frameworks. So, all the job seekers place yourself as play framework developer, play akka developer, senior web software engineer, Scala software engineer etc, by looking into the play framework job interview questions and answers below and make your interview successful for your future job.

Play Framework Interview Questions

Play Framework Interview Questions
    1. Question 1. What Is Play Framework?

      Answer :

      Play Framework makes it easy to build scalable, fast and real-time web applications with Java and Scala. In other words Play Framework is a core offering of the Type safe Reactive Paltform. It is a web app framework, written in Scala and Java that provides iterative and Reactive application development very simple. The Play is a clean alternative to the legacy Enterprise Java stacks.

    2. Question 2. What Do You Mean By The Java Collection Framework?

      Answer :

      Collections are utilized in various programming languages and basic release contained some classes for collections such as Vector, Stack, Hashtable, and Array. But the more scope and uses Java 1.2 came up with collections Framework the collections interfaces, implementations and different type algorithms.

    3. Question 3. What Are The Advantages Of Collections Framework?

      Answer :

      Some of the advantages of collections framework are:

      • The reduce development effort by using core collection classes rather than defining collection classes.
      • The code quality is improved with the use of completely tested collections framework classes.
      • Reduce some effort for code maintenance by utilizing collection classes with the JDK.
      • Collection framework also provides reusability and Interoperability.

    4. Question 4. What Is The Advantage Of Generic In Collection Framework?

      Answer :

      The Java 1.5 came with Generic and more collection interfaces and implementations use it mostly. The Generics provide us the type of object that a collection can obtain, so if you try to understand and add any element of a different type it throws compile time error.

    5. Question 5. How Many Basic Interfaces Of Java Collections Framework?

      Answer :

      There are four main basic interfaces of Java Collections Framework:

      Collection: The collection defines is the root of the collection hierarchy. A collection provides a group of different objects called its element.

      Set: Set is a collection which cannot provide duplicate elements. Set interface models the mathematical set abstraction and it is used for a deck of cards.

      List: A list provides ordered and collection can obtain duplicate elements. So, you can easily find any element from its indexes.

      Map: A map cannot obtain duplicate keys. Each key can map to at most one value.

      The some different type’s interfaces are:

      • Queue
      • Dequeue
      • Iterator
      • SortedSet
      • SortedMap
      • ListIterator

    6. Question 6. What Do You Mean By Iterator In Play Framework?

      Answer :

      The iterator interface provides a different technique to iterate over any Collection. So we can easily get iterator instance from a collection utilizing iterator technique. The iterator takes the place of Enumeration in the Java Collection Framework. The iterator also provides the caller to destroy elements from the underlying collection at the time of the iteration.

    7. Question 7. What Are The Basic Differences Between Enumeration And Iterator Interfaces?

      Answer :

      An Enumeration is twice as fast as Iterator and it is used for very less memory. Enumeration also is used for is very basic and fits to basic needs.   But the Iterator is safer as compared to Enumeration because it always denies different threads to modify the group object is being iterated by it. The Iterator provides the caller to destroy elements from the underlying that is not possible with Enumeration.

    8. Question 8. What Is The Advantage Of Play Framework?

      Answer :

      Here are some of the most important advantages:

      • Modern stacks
      • Java and (Scala)
      • Amazing error handling
      • Reactive
      • Open
      • Supported
      • Flexible
      • Graphically improved developer productivity

    9. Question 9. What Do You Mean By Iterator Fail-fast Property?

      Answer :

      The Iterator fail-fast property test for any modification in the structure of the underlying collection every time we try to get the next element. If there are any modifications found, by CocurrentModificationException. The complete implementations of Iterator in Collection classes fail-fast by make except the concurrent collection classes such as ConcurrentHashMap and CopyOnWriteArrayList.

    10. Question 10. What Do You Understand By Unsupportedoperationexception?

      Answer :

      The UnsupportedOperationException is the exception; it is used for indicating that the operation is not supported. It is also used extensively in JDK classes, in Collection Framework, java.util.collections.UnmodifiableCollection by this exception for all add or remove operations.

    11. Question 11. What Do Mean By Comparable And Comparator Interfaces?

      Answer :

      The Java allows Comparable interface which always be implemented by any custom class if we want to use Arrays or Collections sorting techniques. The Comparable interfaces have compared To (T obj) techniques. We always override this technique in such a way that it returns a negative integer, zero, or a passive integer if this object is less than, equal to, or larger than the object over as element.

    12. Question 12. How Can We Design A Synchronized Collection From Giving Collection?

      Answer :

      The synchronized collection we` can use collections.synchronizedCollection (Collection c) to provide a synchronized (thread-safe) collection backed by the specified collection.

    13. Question 13. What Are The Other Methods To Iterate Over A List?

      Answer :

      The other methods iterate over a list in two different ways:

      •  Using iterator
      • Using for-each loop

      List<String> strList = new ArrayList<>();

      //using for-each loop

      for(String obj : strList){

          System.out.println(obj);

      }

      //using iterator

      Iterator<String> it = strList.iterator();

      while(it.hasNext()){

          String obj = it.next();

          System.out.println(obj);

      }

      Using iterator is more thread-safe because it provides sure that if underlying list elements are changed it will throw ConcurrentModificationException.

    14. Question 14. Why Do You Need To Use A Custom Object As A Key In Collection Classes Such As The Map Or Set?

      Answer :

      When are using any custom object in Map as the key, then you need to override equals () or hashCode() method and follow their contact. In other words, when you are storing a custom object in store Collection such as SortedSet and SortedMap you can also use equals() method is consistent to compareTo () method, or those collections will not follow their contacts such as Set may provides duplicates.

    15. Question 15. What Is The Difference Between Hashmap And Hashtable In Play Framework?

      Answer :

      A HashMap is not synchronized where as Hashtable is synchronized and HashMap is faster than Hashtable and so on.

    16. Question 16. Why Do You Use Concurrenthashmap In Java?

      Answer :

      If you have equaled the number of reader and writer than ConcurrentHashMap will perform in line of Hashtable or synchronized HashMap.

    17. Question 17. What Do You Understand By Hashcode () And Equals () Methods?

      Answer :

      A HashMap is used for key object where as hashCode() and equals() method to consider the index to out the key value pair. The hashCode () and equals () methods are also used when we try to get value from the HashMap. If hashCode() and equals() method is not define correctly, two other key’s might obtain same hashCode() and equals() result and in that situation rather than storing it at other location, the HashMpa will determine them same and overwrite them. So, we can say that, the collection classes that does not duplicate data use hashCode() equals() to determine duplicate data so these methods it is very necessary to define correctly.

    18. Question 18. How Can We Use Any Class As Map Key?

      Answer :

      If we can use any class as Map key, follow these points:

      The class always follows the basic rule optimized with hashCode() and equals() for all instances.

      If class filed is not used in equals () method, you should not utilize in hashCode() method.

      When the class overrides equals () method, it always overrides hashCode() method.

      Example:

      Suppose I have a class MyFirstKey then I am using a HashMap key.

      //MyFirstKey name argument passed is used for equals() and hashCode()

      MyFirstKey key = new MyFirstKey('Meraj Ansari'); //assume hashCode=1234

      myHashMap.put(key, 'Value');

       // Below code will change the key hashCode() and equals()

      // but its location is not changed.

      key.setName('Deepak Gupta'); //assume new hashCode=98390

       myHashMap.get(new MyFirstKey('Meraj Ansari'));

    19. Question 19. What Are The Similarities Between Arraylist And Vector?

      Answer :

      There are some ArrayList and Vector are similar classes in various ways such as:

      • Maintains the order of insertion and we can provide the elements in the order of insertion.
      • Iterator defines of ArrayList and Vector altogether is fail-fast by design.
      • The ArrayList and Vector both provide null values and random access to element utilizing index number.
      • Both techniques are indexed and based and backed up by an array initially.

    20. Question 20. What Do You Understand By Enumset?

      Answer :

      The java.util.EnumSet is Set define to use with enum types. All elements are an Enum set must come from only one Enum type that is defined, implicitly and explicitly if the set is created. An Enum set is not synchronized and null elements are not provided. This method also provides some useful methods such as copyOf that means (Collection c) and of(E first, E…rest) or complementOf(EnumSet s).

    21. Question 21. What Do Mean By Concurrent Collection Classes?

      Answer :

      The Java 1.5 Concurrent package (java.util.concurrent) obtains thread safe collection classes that provide groups to be changed while iterating.  Designing by the iterator is fail-fast and throws ConcurrentModificationException.

      The few classes are:

      • CopyOnWriteArrayList
      • ConcurrentHashMap
      • CopyOnWriteArraySet

    22. Question 22. What Is Enable Database?

      Answer :

      Play Framework allows in-built support for H2 database. For enable database, it opens the application.conf file and a document follows these two rules.

      • db.default.driver=org.h2.Meraj
      • db.default.url="jdbc:h2:mem:play"

    23. Question 23. How Many Directory For Create A New Directory In Play Framework?

      Answer :

      Here are some directories, creating for the new directory.

      App: The directory obtains the application specific code such as models, views and controllers. The model directory will obtain the application domain model. The views directory provides server side templates. And the controller’s package allows the Java code that responds for url routes.

      Conf: The conf directory allows application configuration and define the file routes.

      Project: The project directory provides the include scripts. The build system is based on sbt.

      Public: The public directory contains our public resources such as, JavaScript, CSS, and image directory and so on.

      Test: The test directory provides application.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Spring MVC Framework Tutorial