EY Technical Interview Questions
EY Technical Interview Questions
EY Technical Interview Questions
Experienced
1. What do you mean by “normalization”?
3. Define RDBMS?
The set of tables is stored in an organized manner in RDBMS, therefore data can be
accessed easily in RDBMS.
4. Explain the need for a lock and also explain the difference between
a shared lock and an exclusive lock?
To ensure the isolation of property holds in transactions, we need to make sure that
data items be accessed in a mutually exclusive manner. It basically means that when
one transaction is accessing a data item then no other transaction can make
changes to that data item.
Thus, to fulfil this requirement, we can allow transactions to access the data item
only if it holds a lock on that item.
A transparent DBMS is one that keeps its physical structure hidden from the users.
7. What is a deadlock?
Data manipulation language (DML) is provided for the manipulation and processing
of databases.
An interface is a blueprint for a class. It has static constants and abstract methods.
It is a way to achieve abstraction. In other words, we can say that an interface can
have variables and abstract methods but no method body.
The index is generally created at the time of the table creation in the database. For
example, in MySQL, we can use the following statements to create a table with an
index that holds two columns column1 and column2.
If want to add an index to the table, we can use the following statement:
mysql>
CREATE INDEX [index] ON [table] (column)
Here:
Store procedure specifies a type of code in SQL that can be stored by the user for
later use and can be used many times.
Syntax:
Increased productivity: The same piece of code is used again and again
which results in higher productivity.
Better performance: The calls made to the procedure are quick and
efficient as stored procedures are compiled once and stored in the
executable form which leads to better performance.
Easily maintainable: Maintaining a procedure on a server is quite easier
than maintaining its replica on a different client machine.
Security: We can restrict access to the oracle data by allowing the users to
use stored procedures within specific privileges.
13. Problem statement: You are given the head of two linked lists and
you need to determine the data present at the intersection of linked
lists. If there is no intersection between the lists then return -1.
Input Format:
Output:
Constraints:
Sample Input 1:
Sample Output 1:
Sample Input 2:
Sample Output 2:
-1
Approach
We can first determine the lengths of both lists by traversing through the lists. Note
that after the intersection the number of nodes remains the same for both the lists.
Let the lengths come out to be equal to len1 and len2. If len1 exceeds len2 then we
move the head pointer of ListNode1 by (len1 - len2) times forward otherwise len2
exceeds len1 so we will move the head pointer of ListNode2 by (len2 - len1) times
ahead.
Now we will iterate unless either of them (head1 or head2) becomes NULL or head1
and head2 pointing to the same node.
At the end of the iteration, we will check whether either of the head of lists is NULL,
if it is so then we will return -1 otherwise we will return value (data) stored at head1
or head2.
Source Code:
/**
* Definition for singly-linked list.
* struct ListNode {
* int data;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *findIntersection(ListNode *headA, ListNode *headB) {
int lenA = 0;
int lenB = 0;
/*
Find the length of both the lists
*/
while(currA || currB)
{
if(currA)
{
lenA++;
currA = currA -> next;
}
else
{
lenB++;
currB = currB -> next;
}
}
else
{
currB = headB;
currA = headA;
int difference = lenB - lenA;
while(difference > 0)
{
currB = currB -> next;
difference--;
}
}
};
1. malloc() function:
The malloc() function also known as the memory allocation function is used to
dynamically allocate a block of memory by specifying the size.
Syntax:
For example,
Since the size of int is 4 bytes. Therefore, this statement allocates 400 bytes of
memory and ptr holds the address of the first byte.
2. calloc() function:
The calloc() function also known as the contiguous allocation function is used to
dynamically allocate specified blocks of memory of a specific size.
Syntax:
For example,
17. SQL question: Problem Statement: Find the second largest value
in a specified column of a relation or table.
Input:
Output:
31000
Method 1:
Explanation:
Here, firstly we are finding the maximum value in the specified column and then we
are searching again by excluding the found maximum value.
Method 2:
SELECT name_of_column
FROM name_of_table p
WHERE 2 = (SELECT COUNT (DISTINCT name_of_column) FROM name_of_table q WH
ERE p.column_name <= q.column_name)
We have used a nested sub-query above. Note that this is a generic SQL query that
prints the nth largest value. For each record processed by the outer query, the inner
query would be executed and it will return how many records have a value lesser
than the current value. As our task here is to determine the second largest value,
therefore we will stop as soon as the inner returns 2.
18. What is a thread? Also, explain how a thread is different from the
process.
A thread represents a path of execution within a process. A process can
contain more than one thread.
Threads present in a process share a common memory space whereas
processes run in different memory spaces.