Real Time Automation Interview Questions - Part 5
In continuation with the latest series of Real Time Automation Interview Questions, we present you the part 5 of the course structure. Click on below links for previous parts.
Real Time Automation Interview Questions - Part 5
- Use of Constructor?
- The purpose of constructor is to initialize the object of a class while the purpose of a method is to perform a task by executing java code.
- Constructors cannot be abstract, final, static and synchronised while methods can be. Constructors do not have return types while methods do.
- Difference between static and non-static methods?
- Static method uses compile time binding or early binding.
- Non-static method uses run time binding or dynamic binding.
- A static method cannot be overridden being compile time binding. A non-static method can be overridden being dynamic binding.
- Links : https://www.geeksforgeeks.org/difference-between-static-andnon-static-method-in-java/
- What is Super keyword in Java?
- The super keyword refers to superclass (parent) objects. It is used to call superclass methods, and to access the superclass constructor.
- The most common use of the super keyword is to eliminate the confusion between superclasses and subclasses that have methods with the same name.
- Difference between break and continue statement?
- Break statement resumes the control of the program to the end of loop and made executional flow outside that loop.
- Continue statement resumes the control of the program to the next iteration of that loop enclosing 'continue' and made executional flow inside the loop again
- Difference between this and super?
- this keyword mainly represents the current instance of a class.
- On other hand super keyword represents the current instance of a parent class.
- this keyword used to call default constructor of the same class.
- What is the difference between length and length() in Java?
- array.length: length is a final variable applicable for arrays. With the help of the length variable, we can obtain the size of the array.
- string.length() : length() method is a final variable which is applicable for string objects. The length() method returns the number of characters present in the string.
- What are the types of assertions in Java?
- Selenium Assertions can be of three types: “assert”, “verify”, and ” waitFor”.
- When an “assert” fails, the test is aborted.
- When a “verify” fails, the test will continue execution, logging the failure.
- A “waitFor” command waits for some condition to become true.
- Have you used the action class and where it is used?
- Actions class is an ability provided by Selenium for handling keyboard and mouse events. Actions action = new Actions(driver);
- action.moveToElement(element).click().perform();
- The perform() method is used to perform the series of actions that are defined.
- Link : https://www.browserstack.com/guide/action-class-in-selenium
- What is the difference between checked and unchecked exception?
- There are two types of exceptions: checked exception and unchecked exception.
- The main difference between checked and unchecked exception is that the checked exceptions are checked at compile-time while unchecked exceptions are checked at runtime.
- checked exceptions – SQLException,IOException,ClassNotFoundException,InvocationTargetException
- unchecked exceptions – NullPointerException,ArrayIndexOutOfBoundsException,ArithmeticException,IllegalA rgumentException NumberFormatException
- Apart from sendKeys, is there any other way to perform the desired operation?
- WebDriver driver = new FirefoxDriver();
- JavascriptExecutor executor = (JavascriptExecutor)driver; executor.executeScript("document.getElementBy Id("textbox_id").value='new value';);
Comments
Post a Comment