Sdet-I
20+ Sdet-I Interview Questions and Answers

Asked in Amazon

Q. Given a binary tree, count the number of occurrences where there are two nodes with the same horizontal distance. To make it clearer, if we assume each node in a cell of a matrix, then count the number of occur...
read moreCount occurrences of two nodes with same horizontal distance in a binary tree
Traverse the tree using BFS or DFS and keep track of horizontal distance of each node
Store nodes with same horizontal distance in a hash table and increment count if collision occurs
Recursively traverse left and right subtrees with updated horizontal distance
Time complexity: O(n), Space complexity: O(n)

Asked in Amazon

Q. Given an array and a number, check whether there are any 3 elements in the array which add up to the given number
Check if any 3 elements in an array add up to a given number
Sort the array in ascending order
Use nested loops to iterate through all possible combinations of 3 elements
Check if the sum of the 3 elements equals the given number
Return true if a match is found, else false
Sdet-I Interview Questions and Answers for Freshers

Asked in Amazon

Q. What factors would you consider from both a developer's and user's perspective when developing a computer-aided competitive examination application like CAT or GMAT?
Considerations for developing an application for computer aided competitive exams
User-friendly interface for easy navigation
Accurate and reliable question bank
Timed tests to simulate real exam conditions
Option to save and resume tests
Detailed performance analysis and feedback
Compatibility with different devices and operating systems
Regular updates and bug fixes
Developer should consider the security of the application to prevent cheating
User perspective: The application should...read more

Asked in Amazon

Q. Given a singly linked list, write a recursive method to reverse every 3 nodes in the list.
Reverse every 3 nodes in a singly linked list using recursion
Create a recursive function that takes in a node and a count
If count is less than 3, return the node
Reverse the first 3 nodes and call the function recursively with the 4th node and count 1
Connect the reversed nodes to the rest of the list
Return the new head of the reversed list

Asked in Sony India Software Centre

Q. Write a Java program to add the digits of a given number.
Java program to add digits of a given number
Convert the number to a string
Iterate through each character and convert it back to an integer
Add all the integers together

Asked in Sony India Software Centre

Q. Write a Java program to find all palindrome strings from an array of strings.
Java program to find tall palindrome strings from an array of strings
Loop through the array of strings
Check if each string is a palindrome
Keep track of the tallest palindrome strings found
Sdet-I Jobs


Asked in Sony India Software Centre

Q. Write code to reverse a string while preserving the order of words.
Code to reverse a string while preserving word positions
Split the string into words using space as delimiter
Reverse the order of words
Join the words back into a string with space as delimiter

Asked in Amazon

Q. Write some test methods for stress testing of the Furniture class.
Test methods for stress testing of Furniture class
Create a large number of Furniture objects and check for memory leaks
Simulate heavy usage by continuously calling methods and check for performance issues
Test the Furniture class with maximum allowed input values and check for any errors or crashes
Share interview questions and help millions of jobseekers 🌟

Asked in Amazon

Q. Given a linked list, write a program to check if it is a palindrome.
Program to check if a linked list is a palindrome
Traverse the linked list and push each element onto a stack
Traverse the linked list again and compare each element with the top of the stack
If all elements match, the linked list is a palindrome

Asked in Amazon

Q. Given an array, fill another array such that each element contains the next greater element in the original array, using a stack data structure.
Use a stack to find the next greater element for each item in an array efficiently.
Initialize an empty stack and an output array of the same size as the input.
Iterate through the array from right to left.
For each element, pop elements from the stack until you find a greater element or the stack is empty.
If the stack is not empty, the top element is the next greater element; otherwise, it's -1.
Push the current element onto the stack for future comparisons.
Example: For input [4...read more

Asked in Amazon

Q. Write a method to check whether two binary trees are mirrors of each other.
Check if two binary trees are mirrors by comparing their structure and node values recursively.
Two trees are mirrors if their root nodes are equal.
The left subtree of one tree must be a mirror of the right subtree of the other tree.
Recursively check the left and right subtrees for both trees.
Example: Tree A (1, 2, 3) and Tree B (1, 3, 2) are mirrors.

Asked in Amazon

Q. Write a method to print the boundaries of a binary tree.
This method prints the boundary nodes of a binary tree in a specific order.
1. Start from the root node and print it.
2. Print the left boundary (excluding leaf nodes).
3. Print all leaf nodes from left to right.
4. Print the right boundary (excluding leaf nodes) in reverse order.
Example: For a tree with root 1, left child 2, right child 3, the output would be: 1, 2, 4, 5, 3.

Asked in Sony India Software Centre

Q. Write code to print all the main diagonal elements of a given 2D array.
Code to print main diagonal elements of a 2D array
Loop through rows and columns of the array
Print elements where row index equals column index

Asked in Amazon

Q. Given a number, find the nearest perfect square using a modified binary search algorithm.
Given a number, find the nearest perfect square using modified binary search.
Start with low=0 and high=num.
While low<=high, find mid=(low+high)/2.
If mid*mid==num, return mid.
If mid*mid
If mid*mid>num, update high=mid-1.
Return the closest perfect square to num.

Asked in Cognizant

Q. What is the difference between DELETE and TRUNCATE?
Delete removes specific rows from a table while truncate removes all rows from a table.
Delete is a DML command while truncate is a DDL command.
Delete can be rolled back while truncate cannot be rolled back.
Delete is slower than truncate as it logs each row deletion while truncate does not.
Delete can have a WHERE clause to specify which rows to delete while truncate deletes all rows.
Example: DELETE FROM table_name WHERE column_name = value;
Example: TRUNCATE TABLE table_name;

Asked in Piramal Group

Q. Given a binary string, how do you toggle 0s, 1s, and 2s?
Toggle 0s to 1s, 1s to 0s, and 2s to 2s in a binary string.
Iterate through each character in the string.
If the character is '0', change it to '1'. Example: '010' -> '101'.
If the character is '1', change it to '0'. Example: '101' -> '010'.
If the character is '2', keep it as '2'. Example: '120' -> '120'.
Return the modified string after toggling.

Asked in Plivo

Q. Reverse a string while maintaining the positions of special characters and spaces.
Reverse a string while preserving the positions of special characters and spaces.
Iterate through the string from both ends using two pointers
Swap characters if both are alphabets or both are special characters
Continue until the pointers meet in the middle

Asked in Plivo

Q. Write a program to determine if given strings are an anagram.
A program to determine if given strings are an anagram.
Convert each string to lowercase and remove any non-alphabetic characters.
Sort the characters in each string.
Compare the sorted strings to check if they are equal.

Asked in Info Edge

Q. How do you create a table in a database?
To create a table in a database, use the CREATE TABLE statement.
Specify the table name and column names with their data types.
Add any constraints or rules for the table.
Example: CREATE TABLE customers (id INT, name VARCHAR(50), email VARCHAR(100));

Asked in Navi Technologies

Q. Build a framework from scratch using Appium.
To build a framework from scratch using Appium for automated testing of mobile applications.
Set up Appium server and desired capabilities
Create test scripts using Appium commands
Implement page object model for better organization
Use assertions to validate test results
Integrate with CI/CD tools for continuous testing
Handle different types of locators for elements
Implement error handling and reporting mechanisms

Asked in Dunzo

Q. I was given two matrices to solve. Can you elaborate on the problem?
The problem involves solving a question related to two matrices, likely involving operations like addition, multiplication, or comparison.
Identify the dimensions of both matrices before performing operations.
For addition, both matrices must have the same dimensions (e.g., 2x2 + 2x2).
For multiplication, the number of columns in the first matrix must equal the number of rows in the second (e.g., 2x3 * 3x2).
Consider edge cases, such as empty matrices or matrices filled with zero...read more

Asked in 3Pillar Global

Q. How would you test a Facebook login page?
To test a FB login page, I would verify functionality, security, and compatibility.
Verify login functionality by entering valid and invalid credentials
Test for security by checking for SSL encryption, password hashing, and account lockout
Ensure compatibility by testing on different browsers and devices

Asked in Simplilearn

Q. Multithreading and details conpt in java
Multithreading in Java allows multiple threads to execute concurrently, improving performance and responsiveness.
Multithreading in Java is achieved by extending the Thread class or implementing the Runnable interface.
Threads share the same memory space, so synchronization is necessary to prevent data corruption.
Java provides synchronized keyword, locks, and atomic classes for thread synchronization.
Concurrency issues like deadlock, race conditions, and thread interference can...read more

Asked in Razorpay

Q. Implement a Stack class in Java.
Implement Stack class in Java.
Create a class with an array to store elements
Implement push() method to add elements to the stack
Implement pop() method to remove and return top element
Implement peek() method to return top element without removing
Implement isEmpty() method to check if stack is empty

Asked in Navi Technologies

Q. Framework design for Appium automation.
Appium automation framework design involves selecting programming language, test framework, page object model, and reporting tools.
Select programming language (e.g. Java, Python) for writing test scripts
Choose test framework (e.g. TestNG, JUnit) for organizing and executing tests
Implement page object model for better code maintainability and reusability
Integrate reporting tools (e.g. ExtentReports, Allure) for generating test reports

Asked in ZNetLive

Q. What is the difference between findElements and findElement?
findElements returns a list of web elements matching the locator, while findElement returns the first matching element.
findElements is useful when there are multiple elements with the same locator
findElement throws NoSuchElementException if no element is found
findElements returns an empty list if no element is found
Example: List
links = driver.findElements(By.tagName("a")); Example: WebElement username = driver.findElement(By.id("username"));

Asked in Razorpay

Q. water level problem
Water level problem - how to measure water level in a tank?
Use a water level sensor
Install a float switch
Use a pressure sensor
Measure the weight of the water in the tank
Use ultrasonic sensors to measure the distance between the water surface and the top of the tank

Asked in Razorpay

Q. Given an unsorted array, find the median of it.
Finding the median value from an array of strings.
Sort the array in ascending order
If the array length is odd, return the middle element
If the array length is even, return the average of the middle two elements
Interview Experiences of Popular Companies





Top Interview Questions for Sdet-I Related Skills



Reviews
Interviews
Salaries
Users

