Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.
Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.
This was a technical round. The interviewer asked me some programming based questions and some questions on database management systems.



Can you do the above task in a minimum number of comparisons?
This can be solved by simply traversing the array once and updating the max and min by comparing it with every element. Steps :
1. Initialize min and max with the value of the first element of the array
2. Run a loop from index 1 to n-1 :
For every element, compare it with max and min. Update max and min accordingly.
This approach has O(n) time complexity and O(1) auxiliary space.


For the parent array {1, -1, 1}, the tree will be:-

As, parent of 0 is 'PARENT'[0] i.e. 1.
1 is the root as 'PARENT'[1] = -1.
Parent of 2 is 'PARENT'[2] i.e. 1.

From the parent array, multiple binary trees may be possible. You have to create a binary tree in such a way that these conditions satisfy:-
If the node has a left child as well as a right child, make sure the left child is smaller than the right child.
If the node has only one child, make sure it has an only left child.
For {1, -1, 1}, the accepted tree will be:-

And for {1, -1}, the accepted tree will be,

Instead of

The idea here is to repeatedly find out the children of a particular node, attach them with their 'PARENT' node and work on the child nodes separately.
This can be achieved by:-
Find out the 'ROOT' node by searching for ‘-1’ in the given 'PARENT' array. Pass this 'ROOT' node as well as the 'PARENT' array into a helper function. The helper function returns us the final 'ROOT' of the binary tree by doing the following things:- If the 'ROOT' is 'NULL', i.e. we are given the 'PARENT' array of a 'NULL' tree, returns 'NULL'. Otherwise, traverses the 'PARENT' array and finds out the children of the current 'ROOT'. Let us store 'LEFT' child in 'FIRST' and 'RIGHT' child in Second. Assigns 'FIRST' to the 'LEFT' child of 'ROOT' and recursively calls for the creation of subtree which has 'FIRST' as its 'ROOT'. Assigns Second to the 'RIGHT' child of 'ROOT' and recursively calls for the creation of subtree which has Second as its 'ROOT'. Return the 'ROOT' fetched from the helper function.
What is a primary key? What is a unique key?
A primary key is a special relational database table column(s) designated to uniquely identify each table record.
A primary key’s main features are:
1) It must contain a unique value for each row of data.
2)It cannot contain null values.
3)Every row must have a primary key value.
A unique key is a group of one or more than one columns of a table which uniquely identify database record. A unique key is the same as a primary key, but it can accept one null value for a table column. It also cannot contain identical values.
Can unique key be a primary key?
No, a unique key cannot always be a primary key as unique key can accept null values but primary key cannot.
What is foreign key? Can a foreign key be Null ?
A foreign key column in a table points to a column with unique values in another table to create a way of cross-referencing the two tables.
Yes, a foreign key can have a NULL value.
Is Normalized form is better or storing in a single table/ 2 tables is better?
Tip1 : Discuss the advantages and disadvantages of normalization.
Advantages :
1. Greater overall database organization
2. Reduction of redundant data
3.Data consistency within the database
Disadvantages :
1. Tables will contain codes rather than real data as the repeated data will be stored as lines of codes rather than the true data.
2. More tables to join as by spreading out data into more tables, the need to join table’s increases and the task becomes more tedious.
3. Data model becomes extremely difficult to query against as the data model is optimized for applications, not for ad hoc querying.
The interviewer had good work experience. She was polite and calm. After brief introduction she straight jumped into my current projects and she covered my entire CV.
Design a parking lot? Design should include :
1. Logic Flow Diagram
2. E-R diagram (very important)
3. DB tables with relations between them, preferably normalized
4. Commands for transaction with tables
Tip 1 : Make all necessary assumptions required to create the relations and tables
Tip 2 : Identify all the main entities of the database management system and their relationships with each other.
Tip 3 : For each entity, define all the necessary attributes.
This was a technical round involving questions on OOPS concepts and puzzles.
Number of squares on a chessboard
Counting and adding all squares in a 8*8 chessboard :
1 × 1 squares - 8 squares across the width and 8 squares along the length = 8 × 8 = 64
2 × 2 squares - with the size of the square increasing by 1 square the number of squares across the width will be down to 7 and the ones along the length will also be down to 7. So, there are 7 × 7 = 49 (2 × 2) squares.
3 × 3 squares - 6 squares across the width and 6 along the length = 6 × 6 = 36 (3 × 3) squares.
4 × 4 squares - 5 squares across the width and 5 along the length = 5 × 5 = 25 (4 × 4) squares.
5 × 5 squares - 4 squares across the width and 4 along the length = 4 × 4 = 16 (5 × 5) squares.
6 × 6 squares - 3 squares across the width and 3 along the length = 3 × 3 = 9 (6 × 6) squares.
7 × 7 squares - 2 squares across the width and 2 along the length = 2 × 2 = 4 (7 × 7) squares.
8 × 8 squares - 1 square across the width and 1 along the length = 1 × 1 = 1 (8 × 8) square.
Therefore, the total number of squares in a chess board = 64 + 49 + 36 + 25 + 16 + 9 + 4 + 1 = 204 squares.
If you figured that the number of squares is the summation of squares of natural numbers up to 8, thus the formula n(n+1)(2n+1)6 can be used.
What is C++?
C++ is general-purpose object-oriented programming (OOP) language developed by Bjarne Stroustrup. C++ is considered an intermediate-level language, as it includes both high and low-level language features.
Difference between deep and shallow copy?
A shallow copy of a collection is a copy of the collection structure, not the elements. With a shallow copy, two collections now share the individual elements.
Deep copies duplicate everything. A deep copy of a collection is two collections with all of the elements in the original collection duplicated.
Different versions of polymorphism? How to solve the problem of multiple inheritance?
Polymorphism is of two types :
1. Compile Time Polymorphism :
Invokes the overloaded functions by matching the number and type of arguments. The information is present during compile-time. This means the C++ compiler will select the right function at compile time. It is achieved through function overloading and operator overloading.
2. Run Time Polymorphism :
This happens when an object’s method is called during runtime rather than during compile time. Runtime polymorphism is achieved through function overriding. The function to be called is established during runtime.
What are Template classes? Write a program for operator = for template class such that it behaves differently for int and char *
Templates are a way of making your classes more abstract by letting you define the behavior of the class without actually knowing what datatype will be handled by the operations of the class. Templates can be used in conjunction with abstract datatypes in order to allow them to handle any type of data. For example, you could make a templated stack class that can handle a stack of any datatype, rather than having to create a stack class for every different datatype for which you want the stack to function. The basic syntax for declaring a templated class is as follows:
template class a_class {...};
This was a 30 minute HR round. The interviewer asked me a number of questions to know more about me.
Questions about my weakness and strength, my previous company, reason to change etc
Tip 1 : Be sure to do your homework on the organization and its culture before the interview.
Tip 2 : Employers want to understand how you use your time and energy to stay productive and efficient. Be sure to emphasize that you adhere to deadlines and take them seriously.
Tip 3 : Talk about a relevant incident that made you keen on the profession you are pursuing and follow up by discussing your education.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you remove whitespace from the start of a string?