These TCS Senior QA interview questions are typical of a first technical round for experienced manual and automation testers: a self-introduction, SQL, Java collections and exceptions, Selenium waits and element handling, testing types and regression selection. Each answer below is short enough to say in an interview, with code where the interviewer usually expects it. Interview content varies by team and project, so treat this as a realistic practice set rather than a fixed list.
Introduction and Project
1. Tell me about yourself and your roles and responsibilities.
Keep it to about a minute: years of experience, manual and automation skills, your current project and what you own in it. For example: “I have four years of experience in manual and automation testing. I work on a web application in an Agile team, where I analyse user stories, write and execute test cases, automate regression suites with Selenium, Java and TestNG, test APIs with Postman and REST Assured, and validate data with SQL. I take part in sprint ceremonies and focus on finding critical defects early.” End with what you're looking for next.
SQL
2. Find the second-highest salary from an employee table.
-- Works in every database; returns NULL if there is no second salary
SELECT MAX(salary) AS second_highest
FROM employee
WHERE salary < (SELECT MAX(salary) FROM employee);
-- Nth highest with a window function (here N = 2)
SELECT DISTINCT salary FROM (
SELECT salary, DENSE_RANK() OVER (ORDER BY salary DESC) AS rnk FROM employee
) t WHERE rnk = 2;Mention that DENSE_RANK handles ties: two employees on the top salary still leave the next distinct salary at rank 2.
3. Explain joins and the different types of joins.
A join combines rows from two tables using a related column. INNER JOIN returns only matching rows; LEFT JOIN returns all rows from the left table plus matches (NULL where none); RIGHT JOIN is the mirror image; FULL OUTER JOIN returns all rows from both; CROSS JOIN returns every combination; a self join joins a table to itself, for example employees to their managers. See SQL joins explained.
Java
4. What is LinkedHashMap and when do you use it?
A HashMap that also remembers insertion order (or access order, if configured). Use it when you need map lookups and a predictable iteration order, for example storing test data read from a file in the same order as the file, or building an LRU cache with accessOrder = true and removeEldestEntry.
5. What is the difference between an exception and an error?
Both extend Throwable. An Exception is a condition a program can reasonably handle, such as a missing file or invalid input. An Error signals a serious JVM problem such as OutOfMemoryError or StackOverflowError that applications shouldn't try to catch.
6. What is the difference between checked and unchecked exceptions?
Checked exceptions (IOException, SQLException) must be caught or declared with throws; the compiler enforces it. Unchecked exceptions extend RuntimeException (NullPointerException, all Selenium exceptions) and aren't enforced. More in exception handling in Java.
Selenium
7. What is the difference between findElement and findElements?
findElement returns the first matching element and throws NoSuchElementException if none exists. findElements returns a list, empty when nothing matches, so it is the right way to check whether an element is present.
8. If an XPath matches two elements, does findElement throw an exception?
No. It returns the first match in document order. That is exactly why non-unique locators cause tests to act on the wrong element without failing; check uniqueness in DevTools before using a locator.
9. Implicit wait vs explicit wait?
An implicit wait is a global timeout applied to every findElement and only waits for presence. An explicit wait (WebDriverWait) waits for a specific condition on one element, such as visibility or clickability. Prefer explicit waits and don't mix the two, because the timeouts combine unpredictably.
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
wait.until(ExpectedConditions.elementToBeClickable(By.id("submit"))).click();
10. How do you automate a calendar (date picker)?
If it's a native <input type="date"> or accepts typing, send the date as text. For a custom widget, open it, move month by month until the header shows the target month, then click the day:
driver.findElement(By.id("travelDate")).click();
while (!driver.findElement(By.cssSelector(".ui-datepicker-title")).getText().equals("December 2026")) {
driver.findElement(By.cssSelector(".ui-datepicker-next")).click();
}
driver.findElement(By.xpath("//a[@class='ui-state-default' and text()='25']")).click();Add a maximum number of clicks to the loop so a wrong target can't loop forever.
11. How do you get the text typed into a text box?
getText() returns visible inner text, which is empty for inputs. Read the value instead: element.getAttribute("value") (or getDomProperty("value") in Selenium 4).
12. How do you enter text into a JavaScript prompt alert?
Alert alert = new WebDriverWait(driver, Duration.ofSeconds(5)).until(ExpectedConditions.alertIsPresent());
alert.sendKeys("Asha");
alert.accept();sendKeys only works on prompt alerts; simple and confirm alerts only support accept(), dismiss() and getText().
13. What are relative locators?
Selenium 4 locators that find an element by its position relative to another: above, below, toLeftOf, toRightOf and near, for example RelativeLocator.with(By.tagName("input")).below(By.id("email-label")). Useful for forms without good attributes, but they depend on layout.
Testing Concepts
14. Explain black-box and white-box testing.
Black-box testing checks behaviour against requirements without looking at the code (functional, system, acceptance testing). White-box testing uses knowledge of the code to design tests for paths, branches and conditions (mostly unit tests). Grey-box testing combines both, for example using the database schema to design functional tests.
15. Smoke testing vs sanity testing?
Smoke testing is a broad, shallow check that a new build is stable enough for further testing. Sanity testing is a narrow, focused check that a specific fix or change works, usually on a stable build.
16. How do you pick test cases for regression testing?
Start with the areas the change touches and their dependencies, then add critical business flows, areas with frequent past defects, and core smoke tests. Use risk to decide depth when time is short, and keep the automated regression suite for the full baseline.
How to Prepare
- Practise the SQL and Java answers by writing them, not just reading them.
- Prepare one real example each for a critical bug, a flaky test you fixed and a regression you planned.
- Revise the Selenium questions for 3 years of experience and manual testing questions for 3 years.
FAQs
What does a TCS QA technical round cover?
Usually your project and responsibilities, SQL queries, core Java, Selenium element handling and waits, and testing fundamentals such as testing types and regression selection.