SDET Interview Questions
What is Finally in Java?
We use it along with try/catch block
What are the differences between equal() and "==" ?
equal() checks just value. "==" checks both references and values
What is main method in Java
A method that runs when Java is executed- Engine
What is abstract class in Java?
Abstract classes can have both abstract and concrete methods We use abstract keyword for abstract class When we want to inherit an abstract class we use extends keyword
What are the differences between array and array list?
Arrays are strict for size, we can store both in Arrays (primitives and objects). ArrayLists are flexible(resizable), We can not store primitives in ArrayList
What is throws in Java?
Can be used multiple exception name with throws Used Throws after method name
What are the exceptions in Java?
Checked and Unchecked Exceptions.
What is a class in Java?
Class is a template used to create objects and to define object data types and methods
What is Encapsulation in Object-Oriented Programming (OOP)?
Data hiding for protection reasons We use POJO to access these data
What are the access modifiers in Java?
Default Private Protected Public
What is static block?
Executed first Used to initialize our static variables
What is abstraction?
Hidden implementation We hide the implementation details from the user. We just show the functionality to the user. We do not show how does it work.
What is overriding?
It is when a subclass uses the same name and same signature as a method in the parent class.
Which tools do the testers use for API testing?
Java + API (Postman for manual API testing)
What is JDK
Java Development Kit - JRE with Development Tools
What is the JRE?
Java Runtime Environment - JVM with Java Libraries
What is the JVM?
Java Virtual Machine
What are the essential tools for testers?
Jenkins, GitHub, Jira
What are the differences between method and constructors?
Methods return a value. Method name can be anything Used to create an object. Same name with the class. No a return type. Classes always have a default constructor.
What are the principles of OOP?
Polymorphism, abstraction, inheritance, encapsulation
What is method in Java?
Reusable codes blocks for specific functions some methods can have a return type and some are void. We can have methods with parameters and no parameters
What is Unchecked Exception?
Run Time Error We just see the error when we run the code e.g ArithmeticException ArrayIndexOutOfBoundsException NullPointerExc ClassCastExc NumberFormatExc IllegalArgument
What is Constructor?
Special methods that is used to initialize objects. Name should be same with the name of class There is no return type
What is non primitive data type?
String
What are the differences between String Builder and String Buffer?
String Buffer is Synchronized, Thread-safe, Slower String Builder is Not synchronized, Not thread-safe, Faster
What are Super() and this?
Super() calls the parent class variable and methods Parent class constructor "this" is a reference variable that refers to the current object and used to eliminate the confusion between class attributes and parameters with the same name
What is throw in Java?
Used inside the method wherever we want One exception with one throw Used the object with throw keyword (throw new IllegalStateException)
Why is String immutable in Java?
We can not change a single character into a String Java is not creating a new String when the characters in String are the same. It uses the string pool to secure data Java Developers decide Strings are immutable due to efficiency and security
What is inheritance in OOP?
We need at least 2 classes We use extends keyword Child class has the features of the parent class
What is interface in Java?
We use interface keyword for interface In the interface variable must be initialized Variables should be public static final by default For interface we use implements keyword
What is overloading?
When a method has the same name but different signature. EX: void m1() int m1(int a) void m1(int a, int b)
What are the primitive data types?
byte, short, int, long, float, double, boolean, char
What is Final in Java?
final Variables can not be assigned new values final methods can not be overiden final classes can not be extended
What is Checked Exception?
Compile time error We see red underline for these exceptions. e.g IOException
What is Finalize in Java?
It works with garbage collector to clean the memory
What is OOP?
Object Oriented Programming OOP is a programming language model organized around objects rather than actions
What is polymorphism in OOP concept?
Overloading Same function with different behavior More than one method in the same class: Same method name + different signature Overriding Perform the same action in different ways In classes with parent-child relation: Same method name + same parameters
Which tools do the testers use for DataBase testing?
SQL + JDBC + Java
Which tools do the testers use for UI testing?
Selenium + Java