Sdet

100+ Sdet Interview Questions and Answers

Updated 25 Nov 2024

Popular Companies

search-icon

Q1. Given a M x N 2D array containing random alphabets and a function Dict(string word) which returns whether the 'word' is a valid English word. Find all possible valid words you can get from the 2D array, where t...

read more
Ans.

Given a 2D array of alphabets and a function to check valid English words, find all possible valid words adjacent to each other.

  • Create a recursive function to traverse the 2D array and check for valid words

  • Use memoization to avoid redundant checks

  • Consider edge cases such as words with repeating letters

  • Optimize the algorithm for time and space complexity

Q2. what happen between, when you enter a URL into a browser address bar and hit enter to actually page gets loaded ?

Ans.

When entering a URL and hitting enter, the browser performs DNS lookup, establishes a TCP connection, sends an HTTP request, receives the response, and renders the page.

  • Browser performs DNS lookup to resolve the domain name to an IP address

  • Browser establishes a TCP connection with the server

  • Browser sends an HTTP request to the server

  • Server processes the request and sends back an HTTP response

  • Browser receives the response and starts rendering the page

Sdet Interview Questions and Answers for Freshers

illustration image

Q3. In a line where words are separated by spaces, , and capitalize first letter of the reversed word. Other letters of the word should be in small. Input : “how are you?” → Output: “Woh Era ?uoy”

Ans.

The program takes a string as input and capitalizes the first letter of each reversed word while keeping the rest of the letters in lowercase.

  • Split the input string into an array of words using the space as a delimiter

  • Iterate through each word in the array

  • Reverse the word and capitalize the first letter

  • Join the modified words back into a single string with spaces in between

Q4. Given a circular linked list containing sorted elements (int value). The head of the linked list points to a random node (not necessarily to the smallest or largest element). Problem is top write a code which w...

read more
Ans.

Insert a node at its correct position in a circular linked list containing sorted elements.

  • Traverse the linked list until the correct position is found

  • Handle the case where the value to be inserted is smaller than the smallest element or larger than the largest element

  • Update the pointers of the neighboring nodes to insert the new node

  • Consider the case where the linked list has only one node

Are these interview questions helpful?

Q5. how will you check that each page of amazon.com is having its logo or not.he also asked me to write code for this also

Ans.

To check if each page of amazon.com has its logo, we can use web scraping techniques and verify the presence of the logo image.

  • Use a web scraping library like BeautifulSoup or Selenium to extract the HTML content of each page.

  • Search for the logo image tag or element using its HTML attributes or XPath.

  • Verify if the logo image is present on each page by checking if the search result is not empty.

  • Repeat the process for all the pages of amazon.com.

  • Optionally, you can also check i...read more

Q6. if you are given a sorted array of size 7 but only 4 elements in it and a sorted array of 3 elements. How would to combine the elements into the first array in such a way that array is sorted

Ans.

Combine 4 elements of a sorted array of size 7 and a sorted array of 3 elements to make a sorted array.

  • Insert the 3 elements of the smaller array into the larger array

  • Sort the larger array using any sorting algorithm

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Q7. How to design a search engine? If each document contains a set of keywords, and is associated with a numeric attribute, how to build indices?

Ans.

To design a search engine with keyword-based document indexing and numeric attributes, we need to build appropriate indices.

  • Create an inverted index for each keyword, mapping it to the documents that contain it

  • For numeric attributes, use a B-tree or other appropriate data structure to store the values and their associated documents

  • Combine the indices to allow for complex queries, such as keyword and attribute filters

  • Consider using stemming or other text processing techniques ...read more

Q8. Most phones now have full keyboards. Before there there three letters mapped to a number button. Describe how you would go about implementing spelling and word suggestions as people type

Ans.

Implement spelling and word suggestions for full keyboard phones

  • Create a dictionary of commonly used words

  • Use algorithms like Trie or Levenshtein distance to suggest words

  • Implement auto-correct feature

Sdet Jobs

SDET 1-4 years
SAS Research and Developement (India) Pvt Ltd
4.4
Pune
Cognizant is Hiring For SDET!! 6-11 years
Cognizant
3.8
Chennai
SDET (Selenium + Java) 2-5 years
Diamond pick
4.1
Bangalore / Bengaluru

Q9. what are the basic features you will add into your own test framework

Ans.

A test framework should have features like test case management, test data management, reporting, and integration with CI/CD tools.

  • Test case management: Ability to create, organize, and execute test cases.

  • Test data management: Ability to manage test data and generate test data sets.

  • Reporting: Ability to generate detailed test reports with metrics and logs.

  • Integration with CI/CD tools: Ability to integrate with tools like Jenkins for continuous integration and delivery.

  • Paralle...read more

Q10. Have you worked on any automation framework or not?

Ans.

Yes, I have worked on automation frameworks.

  • I have experience in developing and maintaining automation frameworks using tools like Selenium, TestNG, and Cucumber.

  • I have also worked on customizing existing frameworks to meet specific project requirements.

  • I am familiar with both data-driven and keyword-driven frameworks.

  • I have integrated automation frameworks with CI/CD pipelines for continuous testing.

  • One example of a project where I worked on an automation framework was for a...read more

Q11. How do you find if a string is a palindrome or not?

Ans.

To check if a string is a palindrome, compare the first and last characters, then move towards the center.

  • Remove all non-alphanumeric characters and convert to lowercase

  • Use two pointers, one starting from the beginning and the other from the end

  • Compare the characters at both pointers, move towards the center until they meet

  • If all characters match, the string is a palindrome

Q12. Given an array of integers which is circularly sorted, how do you find a given integer

Ans.

To find a given integer in a circularly sorted array of integers, use binary search with slight modifications.

  • Find the middle element of the array.

  • If the middle element is the target, return its index.

  • If the left half of the array is sorted and the target is within that range, search the left half.

  • If the right half of the array is sorted and the target is within that range, search the right half.

  • If the left half is not sorted, search the right half.

  • If the right half is not so...read more

Q13. Given a singly linked list, write a recursive method to reverse every 3 nodes in the list. He asked me to inform if I have seen the question

Ans.

Reverse every 3 nodes in a singly linked list using recursion.

  • Create a recursive method that takes the head of the linked list as input.

  • If the head is null or there are less than 3 nodes remaining, return the head.

  • Reverse the first 3 nodes by swapping their pointers.

  • Recursively call the method on the next 3 nodes and update the pointers accordingly.

  • Return the new head of the reversed linked list.

Q14. How would you determine if someone has won a game of tic-tac-toe on a board of any size?

Ans.

To determine if someone has won a game of tic-tac-toe on a board of any size, we need to check all possible winning combinations.

  • Create a function to check all rows, columns, and diagonals for a winning combination

  • Loop through the board and call the function for each row, column, and diagonal

  • If a winning combination is found, return the player who won

  • If no winning combination is found and the board is full, return 'Tie'

  • If no winning combination is found and the board is not f...read more

Q15. Maximum Subsequent distinct & contiguous sub array in a character array

Ans.

Find the maximum subsequent distinct and contiguous subarray in a character array.

  • Use a sliding window approach to iterate through the array.

  • Keep track of the distinct characters in the current subarray.

  • Update the maximum length and subarray as necessary.

Q16. How to achieve parallel execution of test cases in testNG?

Ans.

Parallel execution of test cases in TestNG can be achieved using TestNG's parallel attribute in the testng.xml file.

  • Set the 'parallel' attribute in the testng.xml file to 'methods', 'classes', or 'tests' to specify the level of parallelism.

  • Use the 'thread-count' attribute to specify the number of threads to be used for parallel execution.

  • Ensure that the test classes are thread-safe to avoid any conflicts during parallel execution.

Q17. Write test cases of an API that creates User's profile by accepting First name, Last name and mobile number

Ans.

Test cases for API creating User's profile with First name, Last name, and mobile number

  • Verify that a user profile is created successfully with valid First name, Last name, and mobile number

  • Test with invalid First name (empty, special characters, numbers)

  • Test with invalid Last name (empty, special characters, numbers)

  • Test with invalid mobile number (empty, alphabets, special characters, less than 10 digits)

  • Verify that duplicate profiles are not created for the same mobile num...read more

Q18. Given two files that has list of words (one per line), write a program to show the intersection

Ans.

Program to find intersection of words in two files

  • Read both files and store words in two arrays

  • Loop through one array and check if word exists in other array

  • Print the common words

Q19. How do you find if given two linked lists intersect or not

Ans.

To find if two linked lists intersect, traverse both lists and compare their tail nodes.

  • Traverse both linked lists and find their lengths

  • If the lengths are different, move the longer list's head pointer to the difference in length

  • Now traverse both lists and compare their nodes until a common node is found

  • If no common node is found, the lists do not intersect

Q20. What are the reasons for 500 - Internal Server Error

Ans.

500 Internal Server Error is a generic error message indicating a problem with the server.

  • Server misconfiguration

  • Server overload

  • Programming errors in server-side code

  • Database connection issues

  • Insufficient server resources

Q21. Given an array of numbers, replace each number with the product of all the numbers in the array except the number itself *without* using division

Ans.

Replace each number in an array with the product of all other numbers without using division.

  • Iterate through the array and calculate the product of all numbers to the left of the current index.

  • Then, iterate through the array again and calculate the product of all numbers to the right of the current index.

  • Multiply the left and right products to get the final product and replace the current index with it.

Q22. Program to find the angle between the hands of a clock. Input- the time. Expected output- Angle in degrees

Ans.

Program to find the angle between the hands of a clock given the time.

  • Calculate the angle of the hour hand from 12 o'clock position

  • Calculate the angle of the minute hand from 12 o'clock position

  • Calculate the absolute difference between the two angles

  • If the difference is greater than 180 degrees, subtract it from 360 degrees

  • Return the absolute value of the difference as the angle between the hands

Q23. Write a program to find depth of binary search tree without using recursion

Ans.

Program to find depth of binary search tree without recursion

  • Use a stack to keep track of nodes and their depths

  • Iteratively traverse the tree and update the maximum depth

  • Return the maximum depth once traversal is complete

Q24. Write a program to reverse the words in a string I/P: My name is abc O/P: abc is name My

Ans.

Program to reverse words in a string

  • Split the input string into an array of words

  • Reverse the array of words

  • Join the reversed array back into a string

Q25. Do you use console to locate elements in a web page?

Ans.

Yes, I use console to locate elements in a web page for debugging and testing purposes.

  • Yes, I use console commands like document.querySelector() or document.getElementById() to locate elements on a web page.

  • Console is helpful for quickly testing and verifying element selectors before implementing them in automated tests.

  • Using console to locate elements can help in identifying issues with element selection and improve test script efficiency.

Q26. Do you use the console to locate elements in web page?

Ans.

Yes, I use the console to locate elements in web pages for debugging and testing purposes.

  • I use the console to inspect elements and identify unique attributes like IDs, classes, or XPath.

  • I can use commands like document.getElementById(), document.querySelector(), or $() to locate elements.

  • I also use the console to test CSS selectors and verify if elements are being correctly identified.

Q27. Write an extended method, which will accept locator and timeout, if method is visible before timeout, return success else return failure

Ans.

Create a method to check if element is visible within a specified timeout

  • Create a method that accepts a locator and timeout as parameters

  • Use a loop to check if the element is visible within the specified timeout

  • Return success if the element is visible before timeout, else return failure

Q28. Create a cache with fast look up that only stores the N most recently accessed items

Ans.

Create a cache with fast look up that only stores the N most recently accessed items

  • Implement a hash table with doubly linked list to store the items

  • Use a counter to keep track of the most recently accessed items

  • When the cache is full, remove the least recently accessed item

Q29. Describe recursive mergesort and its runtime. Write an iterative version in C++/Java/Python

Ans.

Recursive mergesort divides array into halves, sorts them and merges them back. O(nlogn) runtime.

  • Divide array into halves recursively

  • Sort each half recursively using mergesort

  • Merge the sorted halves back together

  • Runtime is O(nlogn)

  • Iterative version can be written using a stack or queue

Q30. Find the maximum rectangle (in terms of area) under a histogram in linear time

Ans.

Find the maximum rectangle (in terms of area) under a histogram in linear time

  • Use a stack to keep track of the bars in the histogram

  • For each bar, calculate the area of the rectangle it can form

  • Pop the bars from the stack until a smaller bar is encountered

  • Keep track of the maximum area seen so far

  • Return the maximum area

Q31. Jenkins Setup and how to configure a job and update the report to the team.

Ans.

Jenkins setup involves configuring jobs and updating reports for the team.

  • Install Jenkins on a server or local machine

  • Create a new job by selecting 'New Item' and choosing the job type

  • Configure the job by setting up build triggers, source code management, build steps, and post-build actions

  • Add plugins for reporting tools like JUnit or HTML Publisher to generate reports

  • Update the report by viewing the job's build history and clicking on the specific build to see the report

Q32. second round : Automating API for retrieving the possible AWS service IP allocations

Ans.

To automate API for retrieving AWS service IP allocations, we can use AWS CLI or SDKs.

  • Use AWS CLI to retrieve IP allocations for a specific service

  • Use AWS SDKs to programmatically retrieve IP allocations

  • Create automated tests to ensure IP allocations are correct

  • Use tools like Postman to test API endpoints

Q33. How will you Handle/ Locate Dynamic Web Elements in a Web Table?

Ans.

To handle dynamic web elements in a web table, I will use techniques like XPath, CSS selectors, and dynamic element identification.

  • Use XPath to locate elements based on their attributes or position in the DOM

  • Utilize CSS selectors to target specific elements based on their styling

  • Implement dynamic element identification techniques to handle elements that change on page reloads or updates

Q34. What is the difference between Array and ArrayList?

Ans.

Array is a fixed-size data structure while ArrayList is a dynamic-size data structure in Java.

  • Array is a static data structure with a fixed size, while ArrayList is a dynamic data structure that can grow or shrink in size.

  • Arrays can hold primitive data types and objects, while ArrayList can only hold objects.

  • Arrays require a specified size during initialization, while ArrayList can dynamically resize itself.

  • Arrays use square brackets [] for declaration, while ArrayList is a p...read more

Q35. To design a automation framework what could be approach

Ans.

Approach for designing an automation framework

  • Identify the scope and requirements of the framework

  • Choose a suitable programming language and tools

  • Design the framework architecture and modules

  • Implement the framework and write test scripts

  • Integrate the framework with CI/CD pipeline

  • Continuously maintain and update the framework

Q36. Efficiently implement 3 stacks in a single array

Ans.

Implement 3 stacks in a single array efficiently

  • Divide the array into 3 equal parts

  • Use pointers to keep track of top of each stack

  • Implement push and pop operations for each stack

  • Handle stack overflow and underflow cases

Q37. Amazon: Add Cart feature - Write Selenium code

Ans.

Use Selenium to automate adding items to cart on Amazon website.

  • Locate the 'Add to Cart' button on the product page using Selenium's findElement method

  • Click on the 'Add to Cart' button to add the item to the cart

  • Verify that the item has been successfully added to the cart by checking the cart contents

Q38. Write a program to count the character in a string

Ans.

A program to count the characters in a string

  • Iterate through each character in the string and increment the count for each character

  • Use a hashmap to store the count of each character

  • Handle edge cases like empty string or null input

Q39. What is the difference between Git and GitHub?

Ans.

Git is a version control system used for tracking changes in code, while GitHub is a platform for hosting Git repositories and collaborating on code.

  • Git is a distributed version control system that allows developers to track changes in code and collaborate with others.

  • GitHub is a web-based platform that provides hosting for Git repositories, allowing developers to store, share, and collaborate on code.

  • Git can be used locally on a developer's machine, while GitHub is a cloud-b...read more

Q40. Current Technology i am working in

Ans.

I am currently working with Java and Selenium for test automation.

  • Using Java programming language for writing test scripts

  • Using Selenium WebDriver for automating web applications

  • Integrating with CI/CD tools like Jenkins for continuous testing

  • Working with frameworks like TestNG for test management

  • Using tools like Maven for project management

Q41. Make a stack using 2 given queue

Ans.

Create a stack using 2 given queues.

  • Push elements into one queue until it is full.

  • When the first queue is full, push new elements into the second queue.

  • To pop an element, remove all elements from the non-empty queue except the last one.

  • Switch the non-empty queue to the other one when it becomes empty.

Q42. How do you automate email and one time passcode?

Ans.

Automating email and one time passcode involves using automation tools and scripting to send emails and generate passcodes.

  • Use automation tools like Selenium or Puppeteer to automate the process of logging into email accounts and sending emails.

  • Utilize scripting languages like Python or JavaScript to generate one time passcodes and send them via email.

  • Implement API calls to interact with email servers and send emails programmatically.

  • Consider using third-party services like T...read more

Q43. How do you compare two databases and two files?

Ans.

Comparing two databases and two files involves analyzing their structure, content, and integrity.

  • Compare the schema of the databases to ensure they have the same tables, columns, and relationships.

  • Check the data in the databases and files to identify any discrepancies or missing information.

  • Use checksums or hash functions to compare the contents of the files for differences.

  • Consider using tools like SQL queries, file comparison software, or scripting languages for efficient c...read more

Q44. How do you exit recursion in programming?

Ans.

To exit recursion in programming, a base case is defined to stop the recursive calls.

  • Define a base case that will stop the recursive calls.

  • Ensure that the base case is reached during the recursion.

  • Return a value or perform an action when the base case is met.

Q45. how will you integrate selenium framework with jenkins

Ans.

Integrating Selenium framework with Jenkins involves setting up Jenkins job to run Selenium tests.

  • Install Jenkins on the server

  • Install necessary plugins like Selenium plugin

  • Create a Jenkins job for running Selenium tests

  • Configure the job to execute Selenium tests using the Selenium framework

  • Set up build triggers and post-build actions as needed

Q46. WHAT IS OOPS, INHERITANCE, STATIC DYNAMIC BINDING

Ans.

OOPS is Object-Oriented Programming, Inheritance is the ability of a class to inherit properties and behavior from another class, Static Binding is resolved at compile time, Dynamic Binding is resolved at runtime.

  • OOPS stands for Object-Oriented Programming, which is a programming paradigm based on the concept of objects.

  • Inheritance is a feature in OOP that allows a class to inherit properties and behavior from another class.

  • Static Binding is also known as early binding, where...read more

Q47. Write a Java program to find missing numbers in an array.

Ans.

Java program to find missing numbers in an array

  • Iterate through the array and create a HashSet to store all numbers

  • Iterate from 1 to the maximum number in the array and check if each number exists in the HashSet

  • If a number is not found in the HashSet, it is a missing number

Q48. UI test cases of Upload document

Ans.

UI test cases for uploading a document

  • Verify that the 'Upload' button is functional

  • Check if the correct file types are allowed for upload

  • Ensure that the progress bar is displayed during upload

  • Confirm that the document is successfully uploaded and visible on the UI

Q49. What are the variables in Postman?

Ans.

Variables in Postman are used to store and reuse values throughout requests and scripts.

  • Variables can be defined at different scopes such as global, collection, environment, and local.

  • Variables can be set using the syntax {{variable_name}}.

  • Variables can be used in request URLs, headers, body, and scripts.

  • Examples: {{baseUrl}}, {{accessToken}}, {{randomNumber}}

Q50. Explain basic concept of JOINS in sql

Ans.

JOINS are used to combine rows from two or more tables based on a related column between them.

  • JOINS are used to retrieve data from multiple tables in a single query

  • There are different types of JOINS - INNER, LEFT, RIGHT, FULL OUTER

  • JOINS are based on a related column between the tables

  • Syntax: SELECT * FROM table1 JOIN table2 ON table1.column = table2.column

1
2
3
Next
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

4.1
 • 4.9k Interviews
3.6
 • 2.3k Interviews
3.7
 • 865 Interviews
3.3
 • 737 Interviews
4.0
 • 307 Interviews
3.4
 • 83 Interviews
4.0
 • 70 Interviews
4.1
 • 24 Interviews
View all

Calculate your in-hand salary

Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary

Sdet Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter