Showing posts with label MCA 04-07. Show all posts
Showing posts with label MCA 04-07. Show all posts

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.


Adobe Interview of Manmohan

Written test for DS and C paper has changed but Quantitative and Analytical are still the same.

DS Paper:
1) Nodes are given in order, make the BST for these nodes
2) Hash function was given had to find which numbers map to the same key
3) Using Boolean operators solve a boolean expression
4) LCA for a BST write code.
5) Base conversion from a 14-base to 7-base
6) Paranthesis matching problem which DS would be best and why
stack was the answer. (tree, stack, queue, linklist were choices)
7) Prefix expression was given had to find the value for given A and B
8) Dont remember
9) Dont remember
10)Some assembly lang program was given need to find whats the behaviour of the program
It was some recursive routine.

C paper:
1) Difference between 2 statments actually they were some pointer to function
2) int *i,*j;
i = (int*) 60;
j = (int*) 20;
printf("%d",i-j);
3) Middle node of link list
4) Missing number find in array in o(n) time number in the range 1-n-1
5) Gcd or 2 numbers
6) Reverse a doubly link list
7) Call statements for a function named crazy(int n, int a, int b)
void Crazy(int n, int a, int b)
{
if(n==0)
return;
Crazy(n-1, b+n, a);
printf("%d %d %d\n", n,a,b);
Crazy(n-1, b, a+n);
}
8) Find 2's compliment of a number which is given in string form
9) MACRO were defined for SUM(a, b) and MULT(a, b)
then printf the result of some expression formed by using these MACROs
10)
file1.c
int myarray[10];

file2.c
extern int* myarray;
void foo()
{
myarray[0] = 0;
}
What problems this program might have and under what conditions?


Technical Interviews

Round1:
1) char* ftoa(float f, int d);
d: number of digits after decimal place that needs to be printed
2) Minesweeper game discussed logic and strategies
3) Tower of Hanoi for N discs, What if the disks are not sorted
4) Max subarray sum problem

Round2:
1) Levelwise traversal
2) Virtual Destructor
3) Nth node from the end of the list
4) Mirror image
5) Power of 2
6) Puzzle a rectangle is given u take out a smaller rectangle from it.
Now divide the rectangle bigger one into 2 equal parts using a single straight line.
7) A mooon shape was given and using 2 lines needed to divide it into 6 parts.
8) Question on polymorphism and other basic question on c++.
9) Container class interfaces and all what all will u have.
10) Permutation and given an API that checks if the word is valid or not.

Round3:
1) 5 5 5 5 5 = 37 puzzle
2) Reverse a link list
3) Power of 2 or not
4) Count number of 1's set bit in an integer
5) Apple, Orange and Mix Puzzle
6) C++ questions tell the output of the program
7) Find repeated number in an array of size n, numbers in the range 1-n-1
8) 8 balls one of them is lighter than others find in 2 weighings
9) What is reference and pointer

Round4:
It was an HR round very long and interesting

Round5:
1) Stack implementation, implement a queue using stack this interface
2) Spiral printing of a matrix m*n
3) Some memory manager kind of thing discussion. Memory allocator and deallocator for efficiently using the memory.

Adobe Interview of Ruchi Sharma

****ROUND 1****

1) Reverse a linklist.

2) Find whether two given linklists of any length merge at a point or not.

3) Print binary representation of a given integer.

4) Code to find all permutations of a given string.

5) puzzle : 5 5 5 5 5 = 37 use any arithmetic operators on LHS to make 37 .

6) puzzle:
given : -20 = -20
to prove : -4=-5.
4-5 steps were given to prove this. I had to find which step was wrong.

7) puzzle : 5 bags each having balls of same weight except one bag. find the bag having the odd ball.

8) Two C++ questions..find output.


****ROUND 2****

1) Given an integer, write code to find max and minimum value it can store.The number of bytes of the integer
is also unknown and no lib func is to be used.

2) An array has numbers in unsorted order n no fix range.any number can be repeated any number of times.
Extract unique elements from the array.

3) 4 tumblers A, B , C , and D of max capacity 10ml,10ml,4ml and 5 ml milk respectively.
make 2ml each in C and D without losing milk.

4) Discussion regarding project.


****ROUND 3****

1) Given a number N.Write a code to Print all primes in the range 2 to N.Optimise it also.

2) Given an array having positive and negative numbers. Find a contiguous sequence having max sum.

3) HAT puzzle : A team of N players, where N is at least three, are randomly assigned hats that
are equally likely to be white or black, under conditions such that:

- Each team player can see the hats of the other team members, but cannot see their own hat.
- Team members cannot communicate in any way.
- The jailor will ask each prisoner the color of his hat.
- If he got wrong ans the prisoner would be killed.

Find the strategy followed by prisoners to minize no of deaths.


4) Discussion regarding project.

Friday, August 29, 2008

Trilogy Interview of Manmohan

Hi these are the question asked to me in Trilogy Interview.
Hope these questions help you too :D All the best :)


1st Round

Only postorder of bst given regenerate the tree
Approach
Code
Complexity
Optimization improve the order of ur solution


2nd Round

1) Spiral printing n*n matrix not m*n actually discussed for that also but coded for n*n only

2) LCA least common Ancestor

3rd Round

LinkList merging Y shaped find the common point or merging point
char array is given find the first repeating character in the array

eg. char a[ ] = "abcdcad"

return "a" here...not "c"

Reverse link list: Code and explanation of calls made
Test case : when llist contains a loop then it will fail then what will u do

1) Then find the loop

2) Remove the loop then reverse the list using this function

3) Camal Banana puzzle 4000 banana and 1000 km and 1000 banana max limit per trip
What is the maximum number of bananas u can take to the other side.
4) Pure virtual function

5) Sinlgeton class Implementation

6) Diameter of a tree: Code and Complexity


4th Round

1) 1-d array given find the sum of the elements between 2 indices say i and j in constant time
eg. a[] = "1 4 2 5 6 3"
and if i = 2 and j = 4 then it should return the sum 4+2+5 from the array in constant time .
U need to do some preprocessing on array for this
2) Now the same for a 2-d array. Now two indices are given say (i1,j1) and (i2,j2)
Find the sum of elements of the rectangle formed by these indices in constant time again do some preprocessing computation for this and return the result in constant time.
3) check IsBst() check if a binary tree is bst or not
do it in o(n) now
do it in o(n) with o(1) space complexity now
4) 2 candles each burns 1 hr Measure 45 minutes

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?

Saturday, July 1, 2006

Flextronics Interview of Viresh Madan

I went for my interview immediately after lunch so the panel was pretty relaxed and cool at that time. There were two people in my panel. One was male and other was a lady.

First thing they asked me was about myself – tell every good point u want to tell about yourself as this is the starting point and interview is in your control at this moment.

Don’t you think that internet surfing should be your hobby. I said I have not some obvious things in my resume.

I told him everything about myself and my family and my achievements in past.

Remember if u r telling them your strengths then u should always have example to justify your statement.


TECHNICAL

Now he asked me about my favorite subject. I said operating systems.

OS
  • There is a concept where these systems get stuck. I mean no process is able to move forward in execution and system is stuck. What’s that? Deadlock (Answer)
  • So what are the different ways to get rid of this problem?
  • Do you know what is bankers algorithm?


DS and Algos
  • Write a program to insert a node in a linked list. (Sorted)
  • I used malloc in my program so he asked where this space initialized comes from.(stack or heap) – Heap (Answer)

Networks
  • What is circuit switching, packet switching????
  • What is used in telephone and internet???
  • Give me complete description of how landline works and how mobile works?
  • TCP Vs UDP
  • OSI model
  • 4 primitives of OSI model


Software Engineering
  • Do you know what is SDLC?????
  • What are the different phases??
  • Tell me something about testing??
  • Different phases of testing??
  • Do you know about load testing??
  • Try n think about it and tell what the world load suggests you.


Then General
  • Do you know any body in Flextronics?
  • Why do u want to join flextronics?

Human Resources
  • Hi Viresh, So tell me about yourself.
  • Your marks at all levels
  • Why do you want to join flextronics
  • What will you do of your first salary – then he streched this issue that why will u give it your dad and not to mom. Is there some hierarchy?? Is your dad leading you all??
  • Tell me something about which you feel proud of??
  • Tell me something good about u? I said I can make people laugh in no time so he said how will this help our company. I said I can make the moment light in seconds. He said do you think you will get enough time to crack a joke. I said I think I can spend 1 min of 60 minutes and so on..
  • Tell me something bad about you. I said nothing bad.. I mean nothing special to be mentioned.. Like others I too get nervous before interview and all that.

I WAS SELECTED

Flextronics Interview of Tarun Gupta

Hi people

This is the set of questions asked to me in the Flextronics interview.

Technical

Networks


  • What is MAC layer,LLC layer

  • What is a MAC address

  • Sliding window protocols

  • Selective repeat

  • VC subnet and datagram subnet

  • Voice over IP

  • Packet switching Vs Circuit switching

  • PSTN

  • CSMA/CD,CSMA/CA




OS

  • Synchronization, mutex, semaphores, monitors

  • Critical section

  • IPC and ways to achieve it, their adv and disadv



C++

  • Operator overloading

  • Can friend function be virtual

  • Can virtual function be private

  • Can a derived pointer point to a base object
  • Upcasting

  • RTTI

  • VTABLE, VPTR etc.



HR Round

  • Strengths

  • What would your friends say about you

  • What would you do if something wrong is happening in your office and you want to rectify it but your hands are tied

  • Would you like to be a manager

  • Family background

  • Asked me to ask some questions



The most important thing in HR is to have good communication skills, eye contact and confidence. Always have a good justification of your answers and try to avoid slangs. Be positive and don’t forget your basic courtesies like a firm handshake, thanks etc.

BEST OF LUCK.

Tarun

Flextronics Interview of Varun Aggarwal

Tech
1. What is your favorite subject?
2. Given a pointer to a node in the linked list, the head pointer is not given and you have to remove the node from the linked list. How?
3. Swap two numbers say a and b, using only one statement in c++.
4. What is the use of trees(any tree binary, BST, B-tree or B+ tree)?
5. Stages of SDLC.
6. What is thrashing?
7. What is SIGBUS error in unix/linux?( I told them i never heard this, and they accepted it. Don't worry about it)
8. Which error do you get most in gcc?Why does it appear?



HR
1. Tired?(i had been waiting for the interview, since 1p.m., and i was called at 8:30p.m.) i I answered yes, because i could see even she was tired.
2. define yourself in one line.
3. why should we choose you to be at FSS, there are n number of people outside?
4. what do you look for, in a company to decide if you want to join it or not?
5. what if we appoint you today, and some other co. with bigger name and package comes? Would you consider that?
6. Percentages in every semester.