Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
What is SDET?
3.
SDET Interview Questions for Freshers
3.1.
1.What is the difference between SDET and Manual Testers?
3.2.
2. Explain the difference between Severity and Priority.
3.3.
3. What is Exploratory and Ad hoc Testing?
3.4.
4. What are the professional responsibilities of a SDET?
3.5.
5. What is Alpha and Beta Testing?
3.6.
6. What is Risk-Based Testing?
3.7.
7. Explain Code Inspection.
3.8.
8. What are the qualities of a good bug report?
3.9.
9. What is the difference between Quality Assurance and Quality Control?
3.10.
10. What is Fuzz Testing?
3.11.
11. If the proper documentation for testing does not exist, what will you do?
3.12.
12. How can a tester decide that a product is ready to be moved into the live environment?
4.
SDET Interview Questions for Experienced
4.1.
13. If the tester is demanded a specific format of the bug report, what can he possibly do?
4.2.
14. Explain the difference between Code Walkthrough and Code Inspection.
4.3.
15. How do you test text boxes without changing their backgrounds?
4.4.
16. How to reverse a string in Java?
4.5.
17. Differentiate between Array and ArrayList in Java.‍
4.6.
18. Write a program to swap two numbers without using their temp variable.
4.7.
Java
4.8.
19. Write a program to reverse a number in any language.
4.9.
Java
4.10.
20. Determine if two binary trees are identical.
4.11.
21. Write an efficient program to convert a binary tree into its mirror.
4.12.
Java
4.13.
22. Find the palindrome substrings of a given string.
4.14.
Java
4.15.
23. Determine if the sum of any three integers in an array is equal to the given value.
4.16.
Java
4.17.
24. Write an algorithm for reversing words in a string.
4.18.
25. Write a program to clone a directed graph.
4.19.
Java
5.
SDET Programming Interview Questions
5.1.
26. How would you reverse a string in Java?
5.2.
27. Explain the difference between == and equals() in Java.
5.3.
28. Write a function to check if a string is a palindrome in Java.
5.4.
29. How do you find the largest number in an array using Java?
5.5.
30. What is the output of System.out.println(null instanceof Object); in Java?
5.6.
31. Explain the concept of polymorphism in Java.
5.7.
32. Write a function to remove duplicates from an array in Java.
5.8.
33. How would you check if a string is empty in Java?
5.9.
34. Explain the concept of exception handling in Java.
5.10.
35. Write a function to find the factorial of a number in Java.
6.
SDET MCQ Questions
6.1.
36. What is the output of System.out.println(0.1 + 0.2 == 0.3); in Java?
6.2.
a) true b) false
6.3.
37. Which method is used to add an element to the end of an ArrayList in Java?
6.4.
a) addLast() b) append() c) add() d) insert()
6.5.
38. What does JSON stand for?
6.6.
a) JavaScript Ordered Notation b) JavaScript Object Node c) JavaScript Object Notation d) JavaScript Origin Node
6.7.
39. Which method is used to remove the last element from an ArrayList in Java?
6.8.
a) removeLast() b) removeLastElement() c) pop() d) remove()
6.9.
40. What is the purpose of the trim() method in Java? 
6.10.
a) Removes whitespace from both ends of a string b) Removes whitespace from the beginning of a string c) Removes whitespace from the end of a string d) Truncates the string to a specified length
6.11.
41. What does CSS stand for? 
6.12.
a) Cascading Style Sheets b) Computer Style Sheets c) Creative Style Sheets d) Custom Style Sheets
6.13.
42. Which operator is used for exponentiation in Java? 
6.14.
a) ^ b) ** c) Math.pow() d) ^
6.15.
43. What does HTML stand for? 
6.16.
a) Hyper Text Markup Language b) High-level Text Markup Language c) Hyperlink Text Markup Language d) Hypertext Transfer Markup Language
6.17.
44. Which keyword is used to declare variables in Java? 
6.18.
a) var b) let c) const d) int
6.19.
45. What is the output of System.out.println(null == null); in Java? 
6.20.
a) true b) false c) Compilation error d) Runtime error
7.
Conclusion
Last Updated: Jun 9, 2024
Medium

SDET Interview Questions

Author Amit Singh
0 upvote
Create a resume that lands you SDE interviews at MAANG
Speaker
Anubhav Sinha
SDE-2 @
12 Jun, 2024 @ 01:30 PM

Introduction

Preparing for an SDET (Software Development Engineer in Test) interview can be a daunting task, especially with the ever-evolving landscape of technology and methodologies. To help you ace your upcoming interviews and land your dream job in 2024, we've curated a comprehensive list of over 40 SDET interview questions along with detailed answers.


What is SDET?

SDET stands for Software Development Engineer in Test. An SDET is a professional who not only writes code to test software but also has a strong background in software development. They are responsible for designing, developing, and maintaining automated test suites to ensure the quality of software products. Additionally, SDETs collaborate closely with software developers and quality assurance teams to streamline the testing process and identify bugs early in the development lifecycle. In essence, SDETs play a crucial role in ensuring the reliability, scalability, and performance of software applications through rigorous testing practices and automation.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

SDET Interview Questions for Freshers

1.What is the difference between SDET and Manual Testers?

S.No.

SDET

Manual Tester

1.

SDETs are involved in the software development process at every stage.

Only the testing stage of the software development process involves testers.

2.

They are software developers and testers with extensive experience.

They are those who are entirely responsible for the execution of test cases.

3.

SDETs can create tools for test automation.

It is not necessary for manual testers to create test automation frameworks or tools.

4.

Given that they concentrate on various testing types and methodologies, including security, functional, non-functional, and others, the scope of SDET testing is fairly broad.

The testing scope for testers is substantially smaller because they primarily concentrate on the application's functioning.

5.

They remain concerned with white as well as black box testing.

They remain concerned with black box testing.

6.

SDETs generally command a higher salary than those who perform manual testing roles alone.

Manual testers command a lower salary; however, since many organizations expect testers to run tests as well as write test automation scripts, they are expected to upgrade their skills continually.

2. Explain the difference between Severity and Priority.

Severity

Priority

The severity of a defect in the form of a bug refers to the impact it can have on a customer's business.

The term "priority" refers to how crucial it is to repair the bug.

It assesses how much of an impact the problem will have on the system.

Developers assign priority to various faults based on their potential severity, which is then sought to be resolved in a specific order. As a result, priority refers to the order in which the defect is fixed. 

Severity can range from critical to minor.

Priority levels can range from high to medium to low.

3. What is Exploratory and Ad hoc Testing?

  • Exploratory Testing: The tester in this style of testing is unaware of the requirements and does the test only on the basis of investigating the application's functionality. Domain specialists conduct exploratory testing. 
  • Ad hoc Testing: Informal testing is the term used to describe this style of testing. It is carried out with no prior planning, documentation, or adherence to any specific test design technique. When testers have a good understanding of the Application Under Test, they are conducted at random (AUT). There are generally no expected results or business requirement documents, or test cases. 

Ad hoc Testing

4. What are the professional responsibilities of a SDET?

Ans. The roles and responsibilities of a SDET generally include:

  • As an SDET Engineer, you'll be involved in data design, product design, and user interface design.
  • SDET strives to understand a product's necessity from the customer's perspective, and because they are involved in every stage of its development, from conception to final release, they are the most acceptable advocate who can justify the software's need.
  • Automation solutions: SDETs must create high-quality, dependable test automation solutions for performance, functional, and regression testing.
  • Functional as well as non-functional testing: SDETs are helpful in both functional and non-functional aspects of testing. This means they consider functionality as well as other factors such as the application's security, the lack of any hacks that may be exploited, and so on.
  • Important channel of communication: SDETs are in charge of investigating client issues that have been submitted to them by the technical support team.
  • Designing: SDETs also participate in architectural design discussions and provide helpful feedback.

 

5. What is Alpha and Beta Testing?

Ans. Let’s see alpha and beta testing in detail:

  • Alpha Testing: Before the application is released into the live environment, testers undertake this testing to determine the presence of any issues.
  • Beta Testing: End-users who are also actual users of the application undertake this testing in a real-world setting. 

 

6. What is Risk-Based Testing?

Ans. Risk-based testing is a form of test that involves evaluating a product's functionality depending on the priority of the deliverables. The business requirement criterion is used as a yardstick for defining the priority of all a product's functionalities. As a result, the high-priority functionalities that are expected to have the most significant impact on the business are tested first. Following these are functionalities with a medium or low priority. When there isn't enough time to try all of the features, this type of testing is used.
 

7. Explain Code Inspection.

Ans. Code inspection can be thought of as a formal type of evaluation that protects against the emergence of a potential problem later on. It allows the programmer to enlist the assistance of a group to review their source code. This group examines the code and interrogates the programmer on its logic. This type of prior review aids in the verification of code standards as well as the prevention of frequent programming faults.
 

8. What are the qualities of a good bug report?

Ans. The elements of a good bug report are:

  • It should focus on a specific issue and deliver precise, clear, and timely information.
  • It should include a detailed description of the bug.
  • It should also provide the steps for reproducing the bug, in addition to the environment details.
  • It should also include information on the bug's actual and intended behavior.

 

9. What is the difference between Quality Assurance and Quality Control?

Quality Assurance

Quality Control

Quality Assurance is a preventive technique that emphasizes the importance of planning, documenting, and agreeing on a specific set of criteria for assuring quality. 

Quality Control is a proactive strategy that encompasses all efforts targeted at determining the quality of solutions given.

The former focuses on the quality process.

The latter focuses on the output quality.

It is performed at the start of a project with the goal of preventing flaws from entering the solution in the first place.

It aids in the verification of output quality compliance with defined quality standards.

10. What is Fuzz Testing?

Ans. The practice of finding security flaws and coding problems, as well as hackable software defects, is known as fuzz testing. It is conducted by inserting a massive amount of random, erroneous, and unintentional data into the system to cause it to crash and then determining whether anything has broken into the system.

11. If the proper documentation for testing does not exist, what will you do?

Ans. It is possible that sufficient documentation for test cases is not accessible, yet the tester is still required to perform the test case. In this case, the tester may refer to a prior email from the customer that clearly outlines all of the criteria. He may also refer to screenshots containing the details of the adjustments, as well as any verbal conversation with the customer, to better comprehend the functionality of the changes required. 
 

12. How can a tester decide that a product is ready to be moved into the live environment?

Ans. The decision to release a product into the real world is a big one. It is a collaborative effort between testers, developers, and upper management. As a result, they take certain factors into account to ensure that the product delivery is bug-free.

  • Validation of the bug reports that the testers have submitted. It details how the bug was fixed and whether or not the tester retested the results.
  • Validation of the whole set of test cases that the tester wrote for that particular documentation and feature.
  • Execute automated test cases to ensure that new features don't interfere with current ones.
  • Validation of the test coverage report, which is necessary to guarantee that all emerging components are covered.

SDET Interview Questions for Experienced

13. If the tester is demanded a specific format of the bug report, what can he possibly do?

Ans. If the tester is asked for a specific format of the bug report, he can follow a conventional approach wherein the report contains the following elements:

  • Bug Summary
  • Reproduce Steps
  • Expected and Current Behavior of One Specific Bug

 

14. Explain the difference between Code Walkthrough and Code Inspection.

Code Walkthrough

Code Inspection

A Code Walkthrough can be thought of as an informal review that takes place at a casual meeting.

A code inspection is a formal evaluation that is carried out to ensure that a product complies with particular requirements and standards.

In order to get feedback on his work, the author describes it to his supervisor or peers.

It is started by the project team, and it entails regular meetings and comparisons of the result to specific papers, codes, and artefacts.

The goal is to ensure that the product is still valid. It's typically thought of as a static approach to quality control.

It comprises systematic and structured testing that improves a software product's availability, maintainability, and dependability.

15. How do you test text boxes without changing their backgrounds?

Ans. This can be performed without passing any data like:

  • Special Characters
  • Size of the Text Field
  • Alphanumeric Values
  • Minimum/Maximum Characters
  • Text Format

 

16. How to reverse a string in Java?

Ans. A String can be reversed in Java by adopting different ways like:

  • Using StringBuilder Class
  • Using StringBuffer Class
  • Convert String into Character Array and use For Loop
  • Using Array List

 

17. Differentiate between Array and ArrayList in Java.‍

S.No.

Array

ArrayList

1.StaticDynamic
2.It contains objects as well as primitive data typesIt contains only objects
3.At the time of array declaration, the size of the Array is given. It cannot be changed afterward.The size of the array is not fixed, and it changes dynamically. The capacity of the ArrayList automatically increases when new elements are added.
4.MultidimensionalSingle Dimension

18. Write a program to swap two numbers without using their temp variable.

Ans. The program to swap two numbers without using the temp variable is shown below:

  • Java

Java

public class swap {
 public static void main(String args[]) {
   int a = 50;
   int b = 60;
   System.out.println("Numbers before swapping: ");
   System.out.println("number a is " + a);
   System.out.println("number b is " + b);
   // Swapping numbers
   a = a + b;
   b = a - b;
   a = a - b;
   System.out.println("Numbers before swapping:");
   System.out.println("number a is " + a);
   System.out.println("number b is " + b);
 }
}

Output:


 

19. Write a program to reverse a number in any language.

Ans. The program to reverse a number in any language is given below:

  • Java

Java

public class reverseNumber {
 public long reverse(long num) {
   long temp = 0;
   while (num != 0) {
     temp = (temp * 10) + (num % 10);
     num = num / 10;
   }
   return temp;
 }
 public static void main(String args[]) {
   long n = 342619;
   reverseNumber inp = new reverseNumber();
   System.out.println(“Given number is“ + n);
   System.out.println(“Reverse of given number is“ + inp.reverse(n));
 }
}

Output:

20. Determine if two binary trees are identical.

Ans. As part of the technical round, this is one of the most common SDET Interview Questions. 
The roots of two binary trees will be presented as part of the problem statement. Identical trees are those in which each node has the same data and layout. It's also worth noting that just because the trees have the same data doesn't mean they're identical. It's also crucial to think about their structure. 
The problem at hand can be solved in a recursive manner. If two compared nodes are null or one of them is null, the base case of recursion for framing the answer for this is null. Thus two trees (Y and Z) are identical if:

  • Data on their roots are the same, or both roots are null
  • The left sub-tree of Y is identical to the left sub-tree of Z 
  • The right sub-tree of Y is identical to the right sub-tree of Z
    You can proceed with simultaneously using depth-first traversal on both trees and then keep comparing the data at each level. 

 

21. Write an efficient program to convert a binary tree into its mirror.

Ans. The root node of a binary tree will be given to you, and you must swap the left and right children for each node. In order to mirror the nodes of a binary tree, bottom-up mirroring and depth-first traversal will be used.
The binary tree can be traversed in reverse order. This would necessitate swapping the left and right children for each node. DFS (Depth-First Traversal/Search) can be used to ensure that all of a node's offspring have been visited before returning from it (and mirrored).

Program:

  • Java

Java

class Node
{
   int data;
   Node left = null, right = null;

   Node(int data) {
       this.data = data;
   }
}

class CodingNinjas
{
   public static void preorder(Node root)
   {
       if (root == null) {
           return;
       }

       System.out.print(root.data + " ");
       preorder(root.left);
       preorder(root.right);
   }

   public static void swap(Node root)
   {
       if (root == null) {
           return;
       }

       Node temp = root.left;
       root.left = root.right;
       root.right = temp;
   }

   public static void convertToMirror(Node root)
   {
       if (root == null) {
           return;
       }

       convertToMirror(root.left);

       convertToMirror(root.right);

       swap(root);
   }

   public static void main(String[] args)
   {
       /* Let's try to make this tree:
                 1
               / \
             2 3
            / \ / \
           4 5 6 7
       */

       Node root = new Node(1);
       root.left = new Node(2);
       root.right = new Node(3);
       root.left.left = new Node(4);
       root.left.right = new Node(5);
       root.right.left = new Node(6);
       root.right.right = new Node(7);

       convertToMirror(root);
       preorder(root);
   }
}

Output:


 

22. Find the palindrome substrings of a given string.

Ans. In this situation, you'll need to locate all non-single letter palindrome substrings. You can start by extending to the left and right for each letter in the input string, testing for even and odd length palindromes. If you see that there isn't a palindrome, you must continue on to the following letter. We can start by enlarging and comparing one character to the left and right. You print out the palindrome substring if both are equal.

Program:

  • Java

Java

import java.util.ArrayList;
import java.util.List;


public class CodingNinjas {
   public static List<String> allPalindromeSubstring(String s)
   {
       List<String> mylist = new ArrayList<String>();


       // We will move the pivot from the start of the string till end.
       for (float pivot=0; pivot<s.length(); pivot+=.5) {


           // setting the radius to the nearest first element on the left as well as right.
           float palindromeRadius = pivot - (int)pivot;


           /*  if the position that needs to be compared
               has an element and
               the characters at the left and the right matches. */
           while ((pivot+palindromeRadius)<s.length()
               && (pivot-palindromeRadius)>=0
               && s.charAt((int)(pivot-palindromeRadius))
                       == s.charAt((int)(pivot+palindromeRadius))) {


               mylist.add(s.substring((int)(pivot-palindromeRadius),
                                   (int)(pivot+palindromeRadius+1)));


               /*  We will increase the radius by one
                   to point the next elements in left and right. */
               palindromeRadius++;
           }
       }


       return mylist;
   }


   public static void main(String[] args)
   {
       List<String> mylist = allPalindromeSubstring("hellolle");
       System.out.println(mylist.size());
       System.out.println(mylist);
       mylist = allPalindromeSubstring("codingninjas");
       System.out.println(mylist.size());
       System.out.println(mylist);
   }
}

Output:


 

23. Determine if the sum of any three integers in an array is equal to the given value.

Ans. In order to solve this problem, you will be required to sort the array. You will be required to fix one element e and find a pair (a, b) in the remaining array so that required_sum – e is a+b. 

You can begin with the first element "e" in the array and then try to find such a pair (a, b) in that remaining array (i.e., A[i + 1] to A[n-1]) which satisfies the condition: a + b = required_sum – e. If you happen to find the pair, it means that you have found the solution: a, b and e. 

Consequently, you can stop the iteration. 

On the other hand, if you do not find the pair, then you will have to repeat the steps for all elements e at index i=1 to n-3 until we find the specific pair which meets the condition. 

Program:

  • Java

Java

// Java program to find a triplet
class HelloWorld {

   // returns true
       // if there is a triplet with the sum that is
       // equal to the 'sum' present in the array Arr[].
       // Also, prints that triplet.
   boolean find3Numbers(int Arr[], int array_size, int sum)
   {
       int l, r;


       /* Sort the elements of the array */
       quickSort(Arr, 0, array_size - 1);


         // Now fix the first element of the array one by one
                 // and find the other two elements of the array
       for (int i = 0; i < array_size - 2; i++) {


           /* Now, to find the other two elements of the array,
             start two index variables
             from the two corners of that array
             and then move them towards each other. */
           l = i + 1; // This is the index of first element in
                      // the remaining elements
           r = array_size - 1; // index of last element of the array
           while (l < r) {
               if (Arr[i] + Arr[l] + Arr[r] == sum) {
                   System.out.print("Triplet is " + Arr[i] + ", " + Arr[l] + ", " + Arr[r]);
                   return true;
               }
               else if (Arr[i] + Arr[l] + Arr[r] < sum)
                   l++;


               else // Arr[i] + Arr[l] + Arr[r] > sum
                   r--;
           }
       }


       // If we have reached here, then no triplet was present.
       return false;
   }


   int partition(int Arr[], int si, int ei)
   {
       int x = Arr[ei];
       int i = (si - 1);
       int j;


       for (j = si; j <= ei - 1; j++) {
           if (Arr[j] <= x) {
               i++;
               int temp = Arr[i];
               Arr[i] = Arr[j];
               Arr[j] = temp;
           }
       }
       int temp = Arr[i + 1];
       Arr[i + 1] = Arr[ei];
       Arr[ei] = temp;
       return (i + 1);
   }


   /* Implementation of the Quick Sort algorithm
   Arr[] is the array to be sorted
   si is the Starting index
   ei is the Ending index.
   */
   void quickSort(int Arr[], int si, int ei)
   {
       int pi;


       /* Partitioning index */
       if (si < ei) {
           pi = partition(Arr, si, ei);
           quickSort(Arr, si, pi - 1);
           quickSort(Arr, pi + 1, ei);
       }
   }


   // Driver program to HelloWorld above functions
   public static void main(String[] args)
   {
       HelloWorld triplet = new HelloWorld();
       int Arr[] = { 1, 4, 45, 6, 10, 8 };
       int sum = 19;
       int array_size = Arr.length;


       triplet.find3Numbers(Arr, array_size, sum);
   }
}

Output:


 

24. Write an algorithm for reversing words in a string.

Ans. The goal of this exercise is to reverse the words in a string that forms a sentence (an array of characters). You should pay attention to how the words are separated by whitespaces. In most cases, there are two steps to solving this problem. 

  • To begin, you'll need to reverse the string. For that, we can use any of these methods.
    • Using StringBuffer Class
    • Using StringBuilder Class
    • Using Array List
    • Convert that String into a Character Array and then using For loop
  • After that, you'll have to go through the string and reverse each word in its position.

 

25. Write a program to clone a directed graph.

Ans. The goal of this issue is to use depth-first traversal and a hash table to clone a directed graph and print an output graph. You can start cloning a directed graph by producing a deep copy as soon as you get the root node. As a result, the cloned graph will contain the identical vertices and edges as the original graph.

Through depth-first traversal, you can start by making a duplicate of each node as you traverse the graph. Each completed node can be placed in a hashtable, eliminating the need to revisit nodes already present in the hashtable. The hashtable key will be a node from the original graph, and the value will be the cloned graph's corresponding node.

Program:

  • Java

Java

// This is a java program through which we will clone a directed acyclic graph.
import java.util.*;

class HelloWorld {
   // This class will help us in creating a new graph node
   static class Node
   {
       int key;
       ArrayList<Node> adj = new ArrayList<Node>();
       
       /*  key is the value of that node.
           adj will be used for holding a dynamic list of all Node type neighboring
           nodes
       */
       Node(int key)
       {
           this.key = key;
       }
   }

   // This is the function that will help in printing a graph, depth-wise, recursively
   static void printGraph(Node startNode, boolean[] visited)
   {    
   /*  We will visit only those nodes of the graph who have any neighboring  
       nodes to be traversed
   */    
       if (!startNode.adj.isEmpty())
       {
           /*  Looping through the neighboring nodes of this node.
               If source node is not already visited,
               print edge from source to neighboring nodes.
               After visiting all neighbors of source node,
               mark its visited flag to true
           */
           for(Node i : startNode.adj)
           {
               if (!visited[startNode.key])
               {
                   System.out.println("edge " + startNode + "-" + i + ":" + startNode.key + "-" + i.key);

                   if (!visited[i.key])
                   {
                       printGraph(i, visited);
                       visited[i.key] = true;
                   }
               }
           }
       }
   }

   /*  This is the function that will help us in cloning a graph.
       To do this, we will start reading
       that original graph depth-wise, recursively.
       When we will encounter an unvisited node in the original graph,
       we will initialize a new instance of Node for cloned graph
       with key of original node
   */

   static Node cloneGraph(Node oldSource, Node newSource, boolean[] visited)
   {
       Node clone = null;

       if (!visited[oldSource.key] && !oldSource.adj.isEmpty())
       {
           for(Node old : oldSource.adj)
           {

               /*  The following check is used for backtracking,
                   so new nodes don't get initialized every single time
               */

               if (clone == null || (clone != null && clone.key != old.key))
                   clone = new Node(old.key);

               newSource.adj.add(clone);
               cloneGraph(old, clone, visited);

               /* Once, all the neighbors for the particular node
                  are created in cloned graph,
                  code will start backtracking and exit from the node,
                  mark that node as visited in the original graph,
                  and traverse the next unvisited
               */
               visited[old.key] = true;
           }
       }
       return newSource;
   }

   public static void main(String[] args)
   {
       Node n0 = new Node(0);
       Node n1 = new Node(1);
       Node n2 = new Node(2);
       Node n3 = new Node(3);
       Node n4 = new Node(4);

       n0.adj.add(n1);
       n0.adj.add(n2);
       n1.adj.add(n2);
       n1.adj.add(n3);
       n1.adj.add(n4);
       n2.adj.add(n3);
       n3.adj.add(n4);

       /*  Flag that will help in checking if a node is already visited.
           It will stop indefinite looping while recursion
       */
       boolean visited[] = new boolean[5];
       System.out.println("Graph Before Cloning:-");
       printGraph(n0, visited);
       Arrays.fill(visited, false);

       System.out.println("\nCloning Process Starts");
       Node clonedGraphHead = cloneGraph(
       n0, new Node(n0.key), visited);
       System.out.println("Cloning Process Completes.");

       Arrays.fill(visited, false);
       System.out.println("\nGraph After Cloning:-");
       printGraph(clonedGraphHead, visited);
   }
}

Output:

SDET Programming Interview Questions

26. How would you reverse a string in Java?

public class Main {
    public static String reverseString(String str) {
        return new StringBuilder(str).reverse().toString();
    }
}

27. Explain the difference between == and equals() in Java.

The == operator checks for reference equality, while equals() method checks for content equality in Java objects.

28. Write a function to check if a string is a palindrome in Java.

public class Main {
    public static boolean isPalindrome(String str) {
        return str.equals(new StringBuilder(str).reverse().toString());
    }
}

29. How do you find the largest number in an array using Java?

public class Main {
    public static int findLargestNumber(int[] arr) {
        int max = arr[0];
        for (int num : arr) {
            if (num > max) {
                max = num;
            }
        }
        return max;
    }
}

30. What is the output of System.out.println(null instanceof Object); in Java?

The output is false because null is not an instance of any class, including Object.

31. Explain the concept of polymorphism in Java.

Polymorphism in Java allows objects to be treated as instances of their parent class, enabling methods to be called dynamically based on the object's type.

32. Write a function to remove duplicates from an array in Java.

import java.util.HashSet;

public class Main {
    public static int[] removeDuplicates(int[] arr) {
        HashSet<Integer> set = new HashSet<>();
        for (int num : arr) {
            set.add(num);
        }
        return set.stream().mapToInt(Integer::intValue).toArray();
    }
}

33. How would you check if a string is empty in Java?

public class Main {
    public static boolean isEmpty(String str) {
        return str == null || str.isEmpty();
    }
}

34. Explain the concept of exception handling in Java.

Exception handling in Java allows the program to handle errors gracefully by catching and handling exceptions using try, catch, and finally blocks.

35. Write a function to find the factorial of a number in Java.

public class Main {
    public static long factorial(int n) {
        if (n == 0 || n == 1) return 1;
        return n * factorial(n - 1);
    }
}

SDET MCQ Questions

36. What is the output of System.out.println(0.1 + 0.2 == 0.3); in Java?

a) true b) false

false

37. Which method is used to add an element to the end of an ArrayList in Java?

a) addLast() b) append() c) add() d) insert()

add()

38. What does JSON stand for?

a) JavaScript Ordered Notation b) JavaScript Object Node c) JavaScript Object Notation d) JavaScript Origin Node

JavaScript Object Notation

39. Which method is used to remove the last element from an ArrayList in Java?

a) removeLast() b) removeLastElement() c) pop() d) remove()

remove()

40. What is the purpose of the trim() method in Java? 

a) Removes whitespace from both ends of a string b) Removes whitespace from the beginning of a string c) Removes whitespace from the end of a string d) Truncates the string to a specified length

Removes whitespace from both ends of a string

41. What does CSS stand for? 

a) Cascading Style Sheets b) Computer Style Sheets c) Creative Style Sheets d) Custom Style Sheets

Cascading Style Sheets

42. Which operator is used for exponentiation in Java? 

a) ^ b) ** c) Math.pow() d) ^

Math.pow()

43. What does HTML stand for? 

a) Hyper Text Markup Language b) High-level Text Markup Language c) Hyperlink Text Markup Language d) Hypertext Transfer Markup Language

Hyper Text Markup Language

44. Which keyword is used to declare variables in Java? 

a) var b) let c) const d) int

var

45. What is the output of System.out.println(null == null); in Java? 

a) true b) false c) Compilation error d) Runtime error

true

Conclusion

In this article, We discussed the top 40+ SDET Interview Questions and Answers 2024. It's essential to recognize the significance of thorough preparation and continuous learning in navigating the competitive landscape of software development and testing. These questions cover a wide array of topics, ranging from programming concepts to testing methodologies, providing invaluable insights into what SDET interviewers may ask.

You can check out more articles about SDE-1 role at Amazon and SDE-2 role at Amazon.

Are you planning to ace the interviews of reputed product-based companies like Amazon, Google, Microsoft, and more? 

Also check out - String Interview Questions In Java

Recommended Readings:

 

Attempt our Online Mock Test Series on Code360 now!

Merry Coding!

Live masterclass