Sunday, January 22, 2017

JAVA Interview questions for Selenium Position

Below Java questions I faced during my QA Automation Testing interview. Most of the answers I searched from Google, Java blogs and tutorials, so I pasted out the link against each question for your easy reference.

Click here for Selenium Webdriver Interview Questions/Answers

1. What is checked exception?
Exception checked during compile time (IOException, FileNotfound Exception)

2. What is unchecked exception?
Exception checked during runtime (Indexoutofbound, ArithmeticException, NullPointerException)

3. Can we make Array dynamic?

4. What is the Difference between array and collection?

5. What is collection?

6. What is HashMap in collection?

7. Difference between HashMap and Hash Table

8. Difference between SetMap and Queue map

9. What is HashSet?

10. Does Set has null value?

11. Polymorphism

12. Overriding (Overriding behavior of parent class and implementing new behavior)

13.   Overloading (Different parameter and different written type with same method name)

14.   Inheritance: Single, multilevel, hybrid

15.   How to achieve multiple inheritance in Java

16.   What is interface and abstract class. Difference?

17.   Can we extends abstract class?
Abstract classes cannot be instantiated, but they can be subclassed. When anabstract class is subclassed, the subclass usually provides implementations for all of the abstract methods in its parent class. However, if it does not, then the subclass must also be declared abstract (source)

18.   Can we instantiate abstract class?
As above

19.   Can we change value of final variable in java? Why?

20.   Can a final variable be blank or empty? Why?

21.   What is constructor?

22.   Data encapsulation example in your project?

23.   What is the need of static variable in Java? Why it was need? What limitation did it overcome?

24.   What is inner class?

25.   Why is variable declaration of int, boolean, long start with small letter while String starts with Caps?

26.   Why String class doesn’t have constructor. Why dont we use 'new' keyword to create String object?

27.   Does static method can have static variable? – No
In Java, static means that it's a variable or function of a class and belongs to the complete class but not to one of its certain objects/methods. This means that static keyword can be used only in a 'class scope'

public static int javaMethod() {
    static int javaVariable = 24;             // not valid
    return ++javaVariable;
}

28.   Does non static method can have static variable? – Yes

29.   What is virtual method?

30. Is static constructor available in Java?

4 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Was useful in my interview. Thanks for sharing.
    Cheers,
    https://www.flowerbrackets.com/hashset-in-java/

    ReplyDelete

Read CSV from S3

 import csv def count_records(csv_file):     record_count = 0     first_line = None     last_line = None     # Open the CSV file and read it...