Sunday, February 18, 2007

Adobe Interview of Varun Aggarwal

Written

Section 1 : Algorithm 10 Ques Time : 40 mins
Section 2 : C 10 Ques Time : 40 mins

I can recall only 16 ques out of 20. These may help you.
I solved 8/10 in Section one and 9/10 in Section two.
You have to solve them very fast else u'll miss some of them.

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.


Round 1
1. Write a class Student with just one private member, char* name. Also write the copy constructor, overload the "=" operator and write destructor.
2. Write code to find if a Binary Tree is BST or not.
3. U have a server which is getting many requests. More then the number of threads it can spawn. What will u do with the requests for which u don't have threads.
4. Write prototype for printf. If u have to write your own printf and u don't have va_arg how would you get the arguments in the variable list?

Round 2
1. What is your project about? Why did u choose the DS for your project? Write the definition of the structure used in it.
2. How would you maintain a variable size array. The size can increase at the run time. Optimize it to make iterator operation quick.
3. Write solid secure code to getElemAtIndex(int i) for the above DS.
4. What are your interests?

Round 3
1. Least Common Ancestor.
2. Array with n+1 elements. Only one elem is repeated, how would u find the elem?
3. Write a generic Swap function. It may be called for any structure. Also the number of bytes in the structure is given.
4. Write the code similar to malloc. void* myMalloc(int n). n is the num of bytes to allocate. You are given a void* f pointer that points to the location free in the memory.
5. Tell me something about yourself.

Round 4
1. Write the function my2DAlloc.
2. The function makes numOfRows+1 calls to malloc. Reduce it further. Finally we reduced it to just 1 call.
3. Write a function to add two numbers, without using any arithmetic operator. Even the ++ in for statement is not allowed.
4. There are two processes P1 and P2. Both have int* ptr in them. Now p1 assigns ptr = 0xffff1234, *ptr = 10 and the process goes in wait state. P2 gets scheduled and it does ptr = 0xffff1234, *ptr = 100. When p1 is invoked again, what would be the value of *ptr?
5. Write code to print a binary tree in breadth first manner. Now print it in bottom up breadth first manner.
6. How will u find the size of a pointer, without using sizeof operator.



HR
1. Package - Current and Expected
2. What if offer less?
3. Notice period?
4. What if your company extends your onsite?
5. Fav subject at grad?(i said algos and HR guys don't know it)
6. Fav subject at 10th? Isaid maths and he asked me to prove Pythagoras Theorem.
7. He gave me a puzzle and said that if i do it in 5 mins i'll get the marks for Pythagoras theorem too.
8. Why do u wanna leave present Company?

No comments:

Post a Comment