IBM Interview Questions
Practice with real IBM interview questions
01
A Software Engineer was asked
Asked in 2024
Q. In Java, how can you manipulate strings to reverse their content? Provide an example demonstrating both a simple method and a more efficient method using StringBuilder.
Ans. In Java, string manipulation can be performed using various techniques. Below, I will show two methods to reverse a string: one using simple iteration and another using the
StringBuilder class, which is more efficient as it is mutable.
Using StringBuilder is generally preferred for performance reasons, especially with longer strings, because it avoids creating multiple immutable string instances during the reversal process.Software EngineerCore Concept
02
A Software Engineer was asked
Asked in 2024
Q. What is a SQL subquery, and how does it differ from a nested query? Provide an example of each in the context of an IBM database.
Ans. A SQL subquery is a query nested inside another SQL query. It can return data that will be used in the main query. A nested query is often used interchangeably with a subquery, but it usually refers to queries nested at multiple levels. Here’s an example of each:
Subquery Example:
In this example, the inner query retrieves department IDs from departments located at location 1000, which are then used in the outer query to get employee details.
Nested Query Example:
This query retrieves each department name along with the count of employees in that department using a nested query for counting.
Both subqueries and nested queries are powerful tools for complex data retrieval, especially in IBM database systems where hierarchical data relationships may exist.
Software EngineerCore Concept
