• Slider Banner

    Prepare for

    Technical Interview

    Over .1 Million+ Interview Questions for different profiles

    Read More
  • Slider Banner

    Join the

    Programming World

    Learn about top programming languages, tools and frameworks.

    Read More
  • Slider Banner

    Prepare with

    Certification MCQ

    Practice for certification from 1000+ multiple choice questions.

    Read More

What are the challenges with PageFactory?

Below are the challenges with PageFactory:

No of Pages: If there is an application with hundreds or thousands of web pages then the time and the effort in the development of automation framework will be high.

Maintenance Overhead: The cost increases when maintenance overhead increases which are due to the maintenance of large class as they break the OO design principle.

Programming Best Practices: The development of POM framework for multiple pages is equal to developers work thus testers should be highly knowledgeable in programming best practices.

Not Generic Model: Page object model is not a generic model and its specific to the applications.

The best approach to overcome the above challenges is by refactoring the POM concept to Screenplay Pattern.

What are different API Optimisation Techniques?

Below are the different techniques:

Compression Techniques: Use JSON serializer and gZip compress techniques for the data transmitted over the web.
Use faster data access strategies
Caching: Have heard somewhere that the "fastest HTTP call is the one that you don't make" that is, use caching(Memcache/Redis), most of the requests are read operations, wise use of cache control headers are also useful. That spares the database from serving repeated read requests which are expensive. (Not sure if Etags can be of any use ?)
Use asynchronous methods judiciously
make as few API calls as possible
Programming level: use code optimization/threading/parallel programming.
Geography: Account for the distance between end users and origin servers, we can use CDNs for storing the static contents of the response, so that it can be served real fast.
API level: use pagination/filters/ranges to generate fine-grained data that is tailored to the need of the client.

What are checked and unchecked Exception in Java?

Checked Exception: are the exceptions that are checked at compile time. If some code within a method throws a checked exception, then the method must either handle the exception or it must specify the exception using throws keyword.

  • FileNotFoundException
  • IOException
  • ClassNotFoundException
  • SQLException 
  • DataAccessException
  • InvocationTargetException
  • MalformedURLException

Unchecked Exception: Unchecked are the exceptions that are not checked at compiled time. 

  • NullPointerException
  • ArrayIndexOutOfBound
  • IllegalArgumentException
  • IllegalStateException
  • IllegalStateException

If Timeout of Explicit wait is 30 Seconds and Timeout for Implicit Wait is 60 seconds, Consider element is not found then for how much time script will wait before the exception is thrown.

Case 1: When Implicit Wait > Explicit Wait. For Example Implicit Wait is 60 seconds and Explicit Wait is 30 Seconds.

Then, Script will wait for 60 seconds.

Case 2: When Explicit Wait > Implicit Wait. For Example Implicit Wait is 20 seconds and Explicit Wait is 40 Seconds.

Then, Script will wait for 40 seconds.

What is return type of TestNG Data Provider?

Data provider returns a two-dimensional JAVA object to the test method and the test method, will invoke M times in a M*N type of object array. For example, if the DataProvider returns an array of 2*3 objects, the corresponding test case will be invoked 2 times with 3 parameters each time.


   * @return Object[][] where first column contains 'author'
   * and second column contains 'Country'

    public Object[][] getData()
        return new Object[][]
            { "Ram", "India" },
            { "Sham", "UK" },
            { "Mohan", "USA" }

What is API Mocking?

The most common term for creating simulated components is mocking, but others are also used, and partly apply to different things; stubbing, simulation, and virtualization. The basic concept is the same - instead of using an actual software component (an API in our case) – a "replacement" version of that API is created and used instead. It behaves as the original API, but lacks many of the functional and non-functional characteristics of the original component. Which term is applicable depends on the degree to which the mock-up corresponds to the actual API:

  • Stubbing: mostly a placeholder without real functionality
  • Mocking: basic functionality required for a specific testing or development purpose
  • Simulation: complete functionality for testing or development purposes
  • Virtualization: Imulation that is deployed into an operational, manageable and controllable environment

Write a Java Program to convert "Welcome to Java" to "Java to Welcome".

Check below code:

package com.test.strings;

public class StringWords 
	public static void main(String args[])
		String s = "Welcome to Java";
		String a[] = s.split(" ");
		String rev = "";
		for(int i = a.length - 1; i >= 0; i--)
			rev = rev + a[i] + " ";

Output: Java to Welcome

What will be the output of below Java code?

Sample Code: 

public  class  A  
    public void m1(int ... i)
        System.out.println("Parent class");

public class B extends A
    public void m1(int i)
        System.out.println("child class");

class C
    public static void main(String[] args)
        A a = new A();

        B b=new B();

        A a1=new B();


Parent class

child class

Parent class

Subscribe to