Atlassian Interview Questions
Practice with real Atlassian interview questions
01
A Software Engineer was asked
Asked in 2024
Q. Explain the differences between stacks and queues. Provide a code example of each data structure in JavaScript.
Ans. Stacks and queues are fundamental data structures that manage collections of items, but they operate differently. A stack follows the Last In, First Out (LIFO) principle, meaning the last item added is the first one to be removed. A queue follows the First In, First Out (FIFO) principle, where the first item added is the first one to be removed.
Here’s a code example of a stack implemented in JavaScript:
And here’s an example of a queue:
The stack provides methods to add (
push), remove (pop), and view the top element (peek), while the queue provides methods to add (enqueue), remove (dequeue), and view the front element (front). Understanding these data structures is crucial for efficient algorithm design and performance optimization.Software EngineerCore Concept
02
A Software Engineer was asked
Asked in 2024
Q. Explain the use of SQL subqueries and nested queries. Provide an example that retrieves employees who earn more than the average salary in their department.
Ans. Subqueries and nested queries in SQL allow you to execute a query within another query. A subquery is often used in the WHERE clause to filter results based on the output of another query.
Here’s an example showing how to retrieve employees who earn more than the average salary in their department:
In this example, the inner query calculates the average salary of employees in the same department as the outer query’s current employee (
e). The outer query then filters employees whose salary exceeds that average.
This structure allows for powerful data retrieval while maintaining clarity and organization in complex queries. It is important to ensure that the subquery returns a single value when used in a condition like this to avoid errors.
Edge cases to consider include departments with no employees, which would result in a NULL average. You may want to handle this with additional conditions to ensure your query returns valid results.Software EngineerCore Concept
