Software Engineer Test 1 Solution
Software Engineer Test 1 Solution
Ans: -(c)throw
6. What is the process of defining a method in a subclass having same name &
type signature as a method in its superclass?
a) Method overloading
b) Method overriding
c) Method hiding
d) None of the mentioned
Ans:-(b) Break halts the execution and forces the control out of the loop
Code: -
import java.util.ArrayList;
import java.util.LinkedHashSet;
10. Given a sorted array of distinct integers and a target value, return the index if the
target is found.
If not, return the index where it would be if it were inserted in order. You must write
an algorithm with O(log n) runtime complexity.
Input: nums = [1,3,5,6], target = 5
Output: 2
Code: -
public class Main {
public static void main(String[] args) {
int[] nums = {1, 3, 5, 6};
int target = 5;
System.out.println(searchInsert(nums, target));
}
Which MySQL function would you use to concatenate strings from multiple rows into
a single string?
GROUP_CONCAT
Which SQL keyword is used to define a window function?
In a SQL query containing multiple clauses (e.g., SELECT, FROM, WHERE, JOIN, GROUP
BY, ORDER BY, what is the typical execution order?
In MySQL, which of the following commands can be used to remove an index from a
table?
DROP INDEX
DELETE INDEX
SQL Questions
What is the primary purpose of the CASE WHEN statement in SQL?
Which JOIN type in MySQL is suitable for combining rows from two tables even if
there is no match found in the other table?
In SQL, what is the typical syntax for using the LAG function?
SQL Questions
Question 1:
Consider the following scenario where you have a table named
"employees" in a MySQL database. The table has the following structure:
Now, imagine you frequently execute the following query to retrieve employees
earning a salary greater than a specified amount within a particular department:
Based on the provided query, which column or columns would you recommend
indexing on the "employees" table to optimize the query's performance? Write the
index structure and explain your reasoning.
Question 2
The ideal time between when a customer places an order and when the order is
delivered is below or equal to 45 minutes.
You have been tasked with evaluating delivery driver performance by calculating the
average order value for each delivery driver who has delivered at least once within
this 45-minute period.
SQL Questions
Your output should contain the driver ID along with their corresponding average
order value. Table: Delivery_details Create Table Query
SQL Questions