Monday, March 16, 2009

Kuliza Interview of Sangeeta Pillai

It was a telephonic interview.

They wanted recruitment for the post for Database Developer, however once they interviewed me; they said that later my domain might be switched over for development related to web-application. Hence my interview largely focused on DBMS and Java.

(Main focus for Database was oracle)

  1. They gave me set of tables each having around 3 to four attributes and asked me to write a Query, which updated certain tables from the set based on a condition in one of the table. Basically they wanted me to use triggers.
  2. There were certain questions related to decode.
  3. Next Question was to create a cursor and write procedure for the same. She wanted an optimized solution for the same that is using nested tables.
  4. What is an Optimizer and how does it work?
  5. Granting and revoking privileges to users in Oracle
  6. What are Transactions?
  7. Data structure used in RDBMS
  8. Insertion in b+ tree with code.

Once these set of questions were over they gave me a break of 5 minutes and called again. This time another person was on the other end. He asked me about my interests in Java and also the work I was doing in Trilogy.

He asked the following Questions:

  1. Implementation of Multiple Inheritance in java.
  2. Difference between String and String buffer in java
  3. Garbage Collection in java and how does it work?
  4. Making objects in JavaScript and using them
  5. Use of ‘packages’ and ‘import’ in java.


Next was the HR Round Questions, which was largely focused on ‘Why Kuliza?’ and ‘why the switch from Trilogy and what about my other on campus placements? ’

Thursday, January 22, 2009

Adobe Interview of Vikalp Gupta

Hello All,

Below are the questions that were asked to me in the interviews for the development profile in Adobe Systems. Hope you will find these questions helpful while preparing for Adobe (or any other company).


First Tech Interview: -
--> Tell me about yourself.
--> Why you want to switch so early (as I have just 7 months experience in Aricent).
--> Why Adobe.
--> What is your rank in the batch. Bade saare fadde maarke maine is question ko answer kiya tha as, rankwise, I told him that I will be in the bottom 10 in my class. Then he asked why shouldn't we hire toppers. To kuch na kuch fadde maarke maine use chup karvaya.
--> There is a matrix of N*N order. You are given two values, i and j. Find out whether the pair (i, j) represents any of the 4 corner elements in single 'if' condition.
--> 100 doors puzzle. There are 100 doors. Initially they are all closed. In ith pass, the state of all the doors that are divisible by 'i' is flipped, where i continues from 1 to 100. After 100th pass, which all doors will be in open state.
--> There is an input string such that there is only single blank space between each word. There is no other whitespace character except for space. No trailing and leading spaces either. You have to take out the tokens from the string with minimum memory requirements. I gave many solutions but after each solution, he added one or more constraints. Actually what he wanted was that the signature of the function should be like:
char** Tokenize(char *input_string)
He wanted that the memory for each token should be allotted only inside the function. You cannot count the number of words. You have to do this only in single traversal of characters of the input string. He wanted that after calling this function, user should be able to print any token in order(1). Yes, you can modify the input string.
--> What all data structures you have heard of. What is the best data structure to implement dictionary. How will you do it.
--> What is malloc. What is calloc. What is the difference between the two. If they perform the same type of function, then why to use calloc. What was the need for creating and standardizing calloc when we can use malloc.


Second Tech Interview: -
--> Tell me about yourself.
--> Tell me about your project that you are currently working upon in Aricent.
--> Then he asked some project specific things like what are the different protocols, their position in the network, their usage, my contribution in the project etc.
--> What is an XML file. You are given an XML file. You want to store it in memory. What data structure will you use for the same, so that different queries based on that XML file can be answered most efficiently.
--> What is the best data structure to implement dictionary. How will you do it (not complete code but just the data structure and the algo).
--> Then he drew a graph and asked me to do the Depth First Traversal of the vertices of the graph.
--> Then he asked me to write the code for the same (Depth First Traversal).
--> Different ways of inter process communications.
--> What are unnamed pipes.
--> What is the corresponding IPC mechanism in windows. (Actually he wanted to get sockets as the answer as We have used sockets in the simulation of FTP in fourth semester).
--> What is fsck in unix. What were some of the inconsistencies you handled in it and how.
--> One or two more questions were there which I dont remember.


Third Tech Interview: -
Is bande ne meri bahut buri tarah se maari thi, kya nahin poochha tha isne, dimaag kharab ho gaya tha is interview ke waqt to. Us din saare interviews hone ke baad mujhe lag raha tha ki agar nahin hua to isi interview ki wajah se nahin hoga kyunki jisne yeh interview liya tha, he was the hiring manager.
--> Why you want to switch so early (is question par hi usne kam se kam 10-15 min argue kiya hoga and literally bahut sunaya tha)
--> Diference between C and C++ (apart from OOPS and Generic programming).
--> Difference between malloc and calloc.
--> Difference between malloc and new and free and delete.
--> Which is better, malloc or new. And why.
--> Different mechanisms for IPC.
--> What are pipes. What are sockets.
--> What are events in Windows applications. Is question par maine kaha ki mujhe kuch nahin aata windows application ka, humne bahut basic kiya hai is subject mein, to usne kaha ki kitna basic, just the hello world program.
--> What is the unix file system.
--> What is FAT. What is the first block in FAT.
--> What is webmail (our oracle project in fourth semester). Explain it.
--> Draw the OSI model in networking.
--> Draw the corresponding TCP/IP model and map the diferent layers withOSI model.
--> Whats the use of MAC address.
--> What are IP addresses.
--> What is TCP and What is UDP.
--> FTP works over what. TCP or UDP. And why.
--> What is ping command.
--> ping works over what. TCP or UDP. And why.
--> Shayad usne kuch class hierarchies par poochha tha.
--> Explain your project.
--> What is dll.
--> What is the difference between dynamic linking and static linking.
--> How do you do static linking.
--> How do you do dynamic linking in windows (There are 2 methods, mujhe ek pata tha, but he asked the second method too).
--> 2-3 questions aur the but woh yaad nahin. Actually main jo bhi bol raha tha, koi bhi ek word pakad kar woh shuru ho jaata tha.


Fourth Tech Interview: -
--> Why do you want to apply for Adobe.
--> In classes, how do you declare and define const and static data members.
--> What do you mean by initializer lists.
--> What all type of data members can be initialized by using initializer lists.
--> Order of calling of constructors in class hierarchy.
--> Order of calling of destructors in class hierarchy.
--> What do you mean by virtual function.
--> Can a destructor be virtual. Why or why not. Give example to show the usage of virtual destructors.
--> What are inline functions.
--> Is it possible to have a virtual inline function. Why or why not.
--> What will happen if you do 'delete this ;' inside the destructor of the class.
--> What is upcasting.
--> Suppose there is a Base class and a class Derived from the Base class. Suppose you do:
Base* ptr = new Derived;
and then you do delete ptr ;
Then which class' destructor will be called.
--> You are given a BST. Find the least common ancestor. Give the algo.
--> Two linked lists are merged at some point. Find that point of merging. Write complete code for that.
--> Again IPC mechanisms.
--> Again pipes and sockets.
--> One puzzle: There is a bag containing 50 Red and 50 Blue balls. A coin is tossed. If head then do nothing and if tail, a ball is taken out from the bag without looking into the bag. You do this tossing of coins three times. What is the probability that after tossing the coin three times, you get three red balls.


HR Interview: -
--> Tell me about yourself.
--> Why Adobe.
--> Why should we hire you.
--> Three things your manager will say about you.
--> Where do you see yourself three years down the lane.
--> The areas in you which needs improvement.
--> What is the relation between degree fahrenheit and degree celsius.
--> At what temperature is degree fahrenheit same as dgeree celsius.
--> Multiply 125 with 125 in the fastest way you can.
--> One puzzle:
6 6 6 = 6
7 7 7 = 6
8 8 8 = 6
9 9 9 = 6
Use any mathematical operator or any thing you have learnt in maths to make the LHS and RHS equal.


Fifth Tech Interview: -
--> What is OMA (Open Mobile Alliance). What do they do. (Actually it was related to our training time project in Aricent).
--> Explain the webmail.
--> Your role in webmail.
--> How you communicated with the Database.
--> Explain what you did in the simulation of FAT (Explain each and everything in that). He asked me to give an example of how different data structures were used.
--> Explain ther file system of Unix.
--> What are inodes.
--> What is super block.
--> Is there any pointers involved in the inodes.
--> Explain FTP.
--> What are sockets.
--> What are the actual APIs you used in sockets (like listen, connect, open etc).
--> Is 'listen' function is used on the client too.
--> How did you handled multiple client requests.
--> Did you use same port number for both receiving requests and sending responses on the server (in FTP).
--> He asked me to explain our project, in detail, that we did in training period in Aricent.
--> Explain your current project.
--> 2-3 questions on pointers.
--> Usage of unions (yeh mujhe nahin aata tha).
--> My family background.

All the Best... :)

Adobe Interview of Sanyam Jain

Written exam

First paper consisted of a Quantitative and Logical Aptitude for duration of 45 minutes.
Second was of Engineering – 45 minutes
Third was C programming – 45 minutes

Ques 1.
Write setnum(x,p,y,n)
The LSD bits starting p from left in x are replaced with rightmost n bits in p.
Rest bits in x are unchanged.

Ques 2.
Write a program to find the depth of Binary Tree

Ques 3.
In Binary Search code, reduce the number of comparisons in while loop from two to one. Write the code.

Ques 4.
Difference between char arr[] = "string" and char *arr = "string".

Ques 5.
Points P1(x1,y1) and P2(x2,y2) are given. drawPoint(x,y) API is given. Write drawLine API taking P! and P2 as input and draw a line from P1 to P2.

Ques 6.
What are bit fields. Give example, when they are used.

Ques 7.
What are data break points. When do we use them.

Ques 8.
Write code to evaluate ReversePolish.
Input : 123+*
Output : 1*(2+3)

Ques 9.
Hex no. is given in string for (0x or 0X optional). Write code to get the integer value.

Ques 10.
Binary Search tree is given. Find the 4th smallest value node.

Ques 11.
Infix expression is given. Draw binary tree. Find postfix expression.

Ques 12.
Memory is maintained as stack type
Assembly Instructions are given :
Load : value
Store : value
Swap : top two values are swapped in memory
Add : top two values are added and replaced by sum
Diff : top value is subtracted from second top and replaced by difference
Label : define label
JMP : jump to label if true condition else give the top value

Write Instruction code for :

A = 300
for(i = 10; i> 0;i++)
A=A +200;

Ques 13.
Given computers C1 - Cn. Given k (L1 - Lk)direct links between computers. Links are transitive. Find whether all computers are connected.

Ques 14.
T1 : write to memory queue
T2 : read from memory queue and print

Create Event : event name
Enter Critical Section :
Exit Critical Section :
Wait Event :
Use instructions to wite code for two events with semaphore.

Ques 15.
Condition for stack are given in wrong order.
PUSH Stach[i] = A i = i - 1
POP i = i + 1 A = Stack[i]

Arrange in proper order

Ques 16
Implement int **my2DAllocate(int rows, int columns); to allocate memory for 2D array and return the int ** pointer.

Ques 17
Given a code in assembly language.. Find the output.



Interview Round 1

1. Introduce yourself. Discussion about the current project.
2. Allocate the memory to a 2D array. Free the allocated memory.
3. Puzzle : There are 100 floors and you have 3 eggs. You need to find the minimum floor from where the egg will break.
4. Puzzle 2 : Given 1000 bottles of wine. Out of these one is poisoned. You have n number of prisoners. Find the poisoned bottle by testing on the prisoners so that there is minimum death of prisoners.
5. Form mirror of a binary search tree.



Interview Round 2

1. Introduce yourself. Why do you want to join Adobe?
2. Static Linking and Dynamic Linking
3. Command to link a .so object.
4. Make file of your project
5. Process Vs Threads
6. Memory map of a process in execution
7. Java Script Vs C/C++
8. Implement strtok
9. String matching problem pseudo code
10. Difference between debugging mode binary and release mode binary.
11. What are stored procedures in Oracle?



Interview Round 3

1. Introduce yourself
2. Implement realloc. Please take care of the hypothetical situation that the memory allocated in realloc may overlap with the existing memory.
3. Puzzle : Given n numbers from1to n. One number is removed from these and a number is added. This leads to a duplicate in the list. You need to find out the duplicate and the original number
4. Puzzle : Given three boxes labeled Oranges, Mangoes and Oranges/Mangoes ,with the fruit they contain.. Now the labels are jumbled so that the if box is labeled Mango then it doesn’t contain mango. Correctly place the labels.
5. Question on object slicing and run time polymorphism in C++
6. Why do we pass the argument in copy constructor by reference?
7. Where do we require Copy constructor?
8. If we give only the parameterized constructor of a class. What will happen?
9. Difference between reference and pointer? In which scenarios we prefer pointers instead of reference.


Interview Round 4

1. Introduce yourself
2. Why do you want to leave Aricent?
3. Write the program to find that the two linked lists merge at a point or not
4. Write a program to print the given number in words. For example, print 1234 as one thousand two hundred thirty four.
5. Write a code to find reverse a stack without using a stack
6. What data structure will you use to store dictionary words. Implement is efficiently so that you can find the anagrams of a word easily.



Interview Round 5

1. Introduce yourself
2. Discussion about the current project.
3. What are exceptions in C++?
4. Implement a Date class. Provide an API to the user/some module so that they can call the get the current time ands date. The API should be such that the user cannot access/modify the date class.



Interview Round 6

1. Introduce yourself.
2. Why you want to leave Aricent and join Adobe?
3. Discussion of the current project.
4. What are the default functions provided for a class?
5. Implement an employee class. Store only the name and the employee id. Write the set of basic functions.
6. Discussion about the college project on website. How did you design the database? Discussion over the normalization.
7. Implement a Student class. Each student can issue a fixed number of books. Extend it so that information for a Phd student can also be stored. Phd student can have any number of books.
8. Under what scenarios we need to define a copy construtor?
9. Implement ftoi function. How does a program execution takes place? How will you specify some precondition for a function?



Interview Round 7

1. Introduce yourself.
2. Why do you want to leave Aricent.
3. You are given a sheet and a set of shapes. You have give a layout which will yield the maximum number of pieces (containing all shapes) that can be cut from the sheet.
4. How will you find out that a point lies outside / inside a polygon.
5. Write the prototype of the function sort.



Interview Round 8

1. Introduction
2. Why you want to leave Aricent?
3. Why Adobe should hire you?
4. 3 qualities.
5. Prove Pythagoras theorem
6. 75*85 = ?? without using any calculations on the board.

Thursday, November 27, 2008

Trilogy Interview of Sandeep Jain

Written:

There were 4 questions, 3 of coding & 1 was for debugging. We were asked to write algorithm, code with comments & proper naming conventions

I attempted-
1st question completely
2nd was correct, but my approach was not the best
3rd was able to write only the initial approach about the problem
I couldn’t attempt the 4th one

So as such you guys need not worry about attempting all the questions. There were two telephonic interviews, and in both the interviews the interviewer first gave his formal introduction & then asked me for my intro.

So here goes the description...


First round tech Interview:

TRI: Tell me something about any recent project that you did, the one you like the most.
I described the GSD project, and my role in it. (GSD was the best project in terms of what I had learned)

TRI: Given a general stack implementation, can you write a function MAX(s) that returns the current maximum value in the stack?
ME: I gave him two O(n) solutions, basically to scan the array or link list used to implement the stack
TRI: Which is a better approach, array or Link list in terms of efficiency?
ME: Array, due to locality of reference
TRI: Good, but I want the MAX to be returned in O(1)
ME: (After 2 mins of thinking) Can I modify the Data Structure

Well he agreed to modify the DS but by using my approach the original push/pop operations became O(n). He had some discussions even thou he was satisfied with my approach he wanted me to improve my approach. His only requirement was to have push, pop & max functions to be O(1). I got stuck at this point. Then he gave me sample data to work upon. Using the given data I was able to correct my approach and finally gave him the correct solution.

TRI: The next problem goes like this, suppose I give you an integer array, Can you generate all triplets such that a^2 + b^2 = c^2 where a, b, c are all elements of the array?
ME: I said, I have done a similar question, where we find all pairs a[i] & a[j] such that a[i] +a[j] =X, I can you use this approach.
TRI: Ok go ahead.

I gave him an O(n^2) solution. Then I told him that I can optimize by calculating the square and replacing the contents of each element by the corresponding square. This will reduce computations regarding squaring of elements again & again. He was impressed with this approach. The problem then reduces to finding triplets such that X+Y = Z.

TRI: Can you write the code for it? Take your time & then dictate me complete error free code. (He asked me about the signature of the function, name & type of variable too.)

TRI: You must know about tree, traversals. Can you write code to perform a level wise traversal of a binary tree?
ME: Sir I know this problem, Shall I continue.
TRI: Is that so, well then just give me an overview.
I dictated him the entire code. :D

TRI: Suppose we have two nodes of a binary tree; find its least common ancestor. I hope you don’t know this one.
ME: Not, exactly, but I did this problem, a few months ago.
TRI: Ok then do it for a BST
I gave him the approach; he was satisfied with it & asked me to tell the order of the algorithm. Its O(lg N) guys.

TRI: Well, Mr. Sandeep your interview went pretty well & that’s all I wanted to discuss. Would you like to ask me anything?
ME: I do not have any particular question. I just hope there is no problem with my call getting disconnected.



Second round tech Interview:

This was a tough one; I can’t give the entire description. But trust me I was shivering & sweating during the interview. There was only one question; I had to implement a game.

It goes something like this-
There are two 3-letter words for e.g. CAT & TRY
If you are allowed to alter any single letter then in how many steps can you convert CAT into TRY, the only constraint is that the intermediate words should be valid 3-letter words.
I asked him if we have a repository of words. He said I can assume a dictionary with all possible 3-letter words.
We discussed the algorithm for around 25-30 mins. After which I was asked to write a code for it, such that we can calculate the minimum number of steps required (as there are many chains possible or we may have none).
So return -1 if we cannot convert Source to Destination.
After 15-20 mins of coding. He further made me optimize the code. I had given him a recursive approach, which scanned the DB in a DFS manner. He made me convert my code to BFS, & then asked me to compare the two in terms of efficiency & space.

This one question covered: String matching, Hashing, General Tree, BFS, DFS, Recursion, Tail-Recursion, Tree pruning, & god knows what...
One thing was for sure I was exhausted after the interview... BUT it was an awesome experience.

All The best... :)

Monday, September 15, 2008

Adobe Interview of Rinky Gupta

Q: Given length and precision(ex: 1/8) draw scale. each unit shd have different height. Draw same as the scale we generally use.

Q: a)Implement stack.(write constructor, destructor,push,pop).
b)Implement Quesue using stack. Optimise the enqueue and dequeue operations.

Q: Difference b/w program and process. How a process executes(Interviewer was expecting program counter etc etc)


Q: There are 3 string S1, S2 and S3. Replace all occurances of S2 in S1 with S3. S3 and S2 can be of any length. Length of S2 can be greater equal or less than that of S3. Result is new string.

Q: There are n guests in a party. A guest can make any numbr of handshakes(0 to n-1) . Prove that there are atleast 2 guest having same number of handshakes.(Can be proved using induction as well as Contradiction)

Q: Difference b/w reference and pointer and where do we use each. What is advantage of 1 over other. When is the memory allocated for each.

Q: Two trains are moving towards each other with different speeds on same track. A bird is moving to and fro. Find the distance travlled by bird till the trains meet.

Q: 100 floors. 2 eggs. find the lowest floor from which the egg breaks in min number of throws.

Q: 50 Red balls and 50 blue balls. 2 empty baskets. A person has to choose 1 basket at random and then pick 1 ball out of it at random. Distribute the balls to maximise the probability of picking up red ball.

Q: Find the subsequence of max sum from array of +ve and -ve numbers.

Q: There is an array of N elements having values in range 0 to N-1. a value can be repeated any number of times. Do some preprocessing so that the count of a particular value can be determined in O(1) after preprocessing. Do not use any extra array to store the counts. Same array can be modified to strore counts for each value.

Q: A float f is given and digits d. return the string having the value with d sigits after decimal.

Q: a)Find the maximum and the min value an integer can store.
b)Implementation of sizeof.
c)Used number of bits to find the max and min value
d)Use complement to find the max value of integer(complement 0 and reset the signed bit to get max value) All these questions were linked from 1 to other.

Q: Rotate integer n bits right.

Q: Two linked lists having a common node. Find the node.

Q: 1,2,4,6 and operators + - * / . Operators can be used any number of times. Write expressions to make 24 and 25

Q: 5,5,5,5,5 and any operators. Make 37.

Q: 2 cans of 10L each full with water. An empty can of 4L and another of 5L. move 2L to each of 4and 5 can.

Q: Reverse linked list.

Q: Few questions on output of C++ codes.

Q: A chess board 8X8 given(area 64 units). 31 slabs of 2X1 each(area 62 units). Arrange slabs on chessboard such that top-left and bottom-right corners are left empty.

Q: There are 100 prisoners. The jailor will make them stand in a row 1 after other, so that each person can see the people in front of him. The he will put caps of red and black color at random on head of each prisoner. There can be any number of red and black caps. The person telling the right color of his hat would survive, others dead. One person can speak one word i.e. the color of his hat.Before the activity the prisoners can think of some protocol to be followed so that max number can survive. No one would cheat. Decide the protocol that shd be followed.