Yahoo Placement Paper Whole Testpaper Chennai-04 Nov 2010

Posted by FreshersWorld

7 Jan, 2012

The process followed by Yahoo India was

1) Short listing on basis of CGPA 2) Written Test 3) Interview

Shortlisted on the basis of CGPA

Written Test:

Questions: 25 questions time 1 hour. All Questions are multiple types

1. Teacher asked the students to find the cube root of a natural number but she did not mention the base. Students assumed the base found the cube root. Each student got an integer. Find the sum of digits of that number. A. 0 B. 1 C. 6 D. 7 E. 8

2. What is the difference of last two digits of N where N=7^2010

a. 1 b.3 c.5 d.7 e.9

3. Find the first non Zero digit in 67!(Factorial)

a. 3 b.4 c.5 d.6 e.7

4. Suppose here are n processes in the system and each one needs k instances of a resources to complete. What would be the minimum number of resources that you should keep in the system to ensure no deadlock in the system.

a. n*k b. n*k-n+1 c. n*k+1 d. n*k*k e. None of the above

5. If we have a ring counter of 4 bits, with an initial state of 1000, what is the modulus of the counter? a. 16 b.8 c.32 d.4 e. Node of the above

6. Which of the following masks can be used to zero out alternate bits of a 16 bit number? a. 0101 b. AAAA c. FFFF d. EEEE e. BBBB

7. We define a function below. What is the value returned by this function: express your answer as a function of n?

unsigned int func(unsigned int n) { unsigned int r=0; unsigned int i,j,k; for(i=1;i<=n;i++) for(j=1;j<=i;j++) for(k=j;k<=i+j;k++) r++ return r; }

a. func(n)=summation of i*(i+1) with i varing from 1to n b. func(n)=n*n+1 + n*n-1 c. func(n)=func(n-1)+n*n+n with func(n)=0 d. func(n)=func(n-1)+n*n+2 with func(n)=0 e. both a and c.

Question 8: Which of the following statements about the datagram sent by a node in a network using IPv4 protocol is (are) true?

i. Datagrams at the source must be the size of the smallest maximum transmission unit (MTU) of alla the links on a path to the destination ii. Datagrams may be fragmented during routing iii. Datagrams are re-assembled at the destinations A. I only B. II only C. III only D. I and III E. II and III

Question 9: In a pipeline RISC computer all arithmetic instructions have the same CPI(Cycles per instructions), which of the following actions would improve the execution time of a tpical; program?

i. Instructions the clock cycle rate ii. Disallowing any forwarding in the pipeline iii. Doubling the sizes of the instruction acache and the data cache without changing the clock cycle time

A. I only B.II only C.III only D. I and II E. I and III

Question 10: Let n(1), n(2), n(3)?. n(t) be positive integers. What is the minimum number N of objects to ensure that if N objects are placed into t boxes, for some I in [1,t], box I contains at least n(i) objects?

i. n(1)+ n(2)+ n(3)+?.+ n(t) ii. n(1)+ n(2)+ n(3)+?.+ n(t)+t-1 iii. n(1)+ n(2)+ n(3)+?.+ n(t)-t iv. n(1)+ n(2)+ n(3)+?.+ n(t)-t-1 v. n(1)+ n(2)+ n(3)+?.+ n(t)-t+1

Question 11. #define scanf ?%s is a string? Main(){ Printf(scanf,scanf); } What is the output? A. Ccompiler error B. scanf is a string C. %s is a string is a string D. %s is a string

Question 12. #define boo(x) x/4 Main(){ Int I; I=64/boo(4); Printf(?%dn?,i); } A. Compiler time error B. 16 C. 64 D. 20 E. Divide by Zero Error

Question 13. What the following C function will do? Unsigned int bitwise(Unsigned int x) { Unsigned int r=x &-x; Unsigned int l x+=r if(0==l) return 0; l=x &-x; l-=r; while(0==(l&l) { l>>=1; } Return x|(l>>1); } A. Return the greatest integer smaller then x B. Returns x/2 C. Returns the smallest integer greater than x with the some number of bits set D. Returns the smallest integer greater than x with less number of bits set E. None of the above

Question 14. Int i Void intcrement(int i) { I++ } Int main() { For(i=0;i<10; increment(i)) { } Printf(?i=%d?,i); Return 0; } Predict the output of the above C ode A. I=10 B. I=9 C. I=11 D. Compiler Error E. None of the above

Question 15. Consider the following C program Main() { Int i=0; I++; Fork(); Printf(?d?,i); I++; Fork(); Printf(?d?,i); }

What is the maximum value of the I that will be printed? A. 0 B. 7 C. 5 D. 2 E. 10

Question 16.

What will be printed by the code below? #include Using namespace std; Template Void swap( T *a, T *b){ Temp =*a; *a=*b *b=temp; } Int main(){ Char hello[]=?hello?; Char world[]=?world?; Swap((char *)&hello, (char **)&world); Cout< Consider a Binary Tee represented as a 1-indexed array(where the children of an element L are at indexes L and 2*L+1, elements at index is the root), with elements 1,2,3,4,5,6,7 in that order. If the post order traversal of the array gives ab-cd*+, the the lebel on the nodes 1,2,3,4,5,6,7 can be

A. +,-,*,a,b,c,d B. a,-,b,+,c,*,d C. a,b,c,d,-,*,+ D. -, a,b,+,*,c,d E. none of the above

Question 18. A hypercube is defined as follows: A hypercube of dimension 0 has only a vertex. To construct a hypercube of N dimentions, take two N-1 dimentional hypercubes, and attach edges between corresponding nodes of each of these hypercubes. How many colors will you need to color the EDGES of an N dimentional hypercube such that no two edges of the same color share a common vertex?

A. 2 B. 2^N C. N D. N^2 E. Node of the above

Question 19. Find the complexity function F(n)=2F(n/2)+10n, if n>1 F(n)=1, if n=1 A. n^2 B. n(logn)^2 C. n D. nlogn E. None of the above

Question 20. In each step of insertion sort algorithm, a new elemennt has to be inserted into an already sorted subarry. Instead of using sequential search to determine the location of new element which takes O(n) time( Which makes the overall cpmplexity O(n^2) ), We can use bunary search since the subarray is sorted, which will take O(logn) time. By using this techinue, we can reduce the complexity of insertion sort from O(n^2) to

A. O(nlogn) B. O(n) C. O(logn) D. O(n^2) E. O(1)

Question 21. Cossider the following procedure: f(n) for i=1 to n dp j=n while j>i do j=j-1 end while end for Assume the above procedure are only an integer n>0; What is the time complexity in n for the procedure above:

A. O(nlogn) B. O(n) C. O(n^2) D. O(N^3) E. O(1)

Question 22.

The worst case time complexity of finding 5th smallest number in sa list of 50000 randomly chosen numbers.

A. O(1) B. O(n) C. O(logn) D. O(n^2) E. O(nlogn)

Question 23.

Consider the problem of sorting (in ascending order ) of an array of numbers, each number being the range(50,000 5000,000). What sorting algorithm is the best choice for the above problem. What is the best case time complexity of sorting achievable for this problem?

A. Merge sort B. Insertion Sort C. Quick Sort D. Counting sort E. Bubble SOrt

Question 24.

Two matrices M1 And M2 are to be stored in an Array A and b respectively. Each Array can be stored either in row major r column major order in contiguous memory locations. The time complexity to compute M1*M2 (Matrix Multipication) will be

A. Best if A is in row-major and B is in Column Major Order. B. Best if both are in row major C. Best if both are in column major D. Independent of the storage scheme. E. None of the above

Question 25.

An large array[]1?n] with N slots is filled only up to positions n for the n very less than N. To start with we do not know n. To locate an empty slot, we check A[j] for j=2^[2^i] in step i. What is the fewest number of steps in which we are guaranteed to find an empty slot?

A. O(n) B. O(log n) C. O(logN) D. O(loglog n) E. O(loglogN)

Ad Blocker Detected

We have noticed that you have an ad blocker enabled which restricts ads served on the site.
Please disable it to continue using Downloadmela.

2) Written Test

3) Interview

Written Test:All Questions are multiple types

A. 0 B. 1 C. 6 D. 7 E. 8

5. If we have a ring counter of 4 bits, with an initial state of 1000, what is the modulus of the counter?

a. 16 b.8 c.32 d.4 e. Node of the above

6. Which of the following masks can be used to zero out alternate bits of a 16 bit number?

a. 0101 b. AAAA c. FFFF d. EEEE e. BBBB

{

unsigned int r=0;

unsigned int i,j,k;

for(i=1;i<=n;i++) for(j=1;j<=i;j++) for(k=j;k<=i+j;k++) r++ return r; }

a. func(n)=summation of i*(i+1) with i varing from 1to n

b. func(n)=n*n+1 + n*n-1

c. func(n)=func(n-1)+n*n+n with func(n)=0

d. func(n)=func(n-1)+n*n+2 with func(n)=0

e. both a and c.

Question 8:Which of the following statements about the datagram sent by a node in a network using IPv4 protocol is (are) true?

i. Datagrams at the source must be the size of the smallest maximum transmission unit (MTU) of alla the links on a path to the destination

ii. Datagrams may be fragmented during routing

iii. Datagrams are re-assembled at the destinations

A. I only B. II only C. III only D. I and III E. II and III

Question 9:In a pipeline RISC computer all arithmetic instructions have the same CPI(Cycles per instructions), which of the following actions would improve the execution time of a tpical; program?

i. Instructions the clock cycle rate

ii. Disallowing any forwarding in the pipeline

iii. Doubling the sizes of the instruction acache and the data cache without changing the clock cycle time

A. I only B.II only C.III only D. I and II E. I and III

Question 10:Let n(1), n(2), n(3)?. n(t) be positive integers. What is the minimum number N of objects to ensure that if N objects are placed into t boxes, for some I in [1,t], box I contains at least n(i) objects?

i. n(1)+ n(2)+ n(3)+?.+ n(t)

ii. n(1)+ n(2)+ n(3)+?.+ n(t)+t-1

iii. n(1)+ n(2)+ n(3)+?.+ n(t)-t

iv. n(1)+ n(2)+ n(3)+?.+ n(t)-t-1

v. n(1)+ n(2)+ n(3)+?.+ n(t)-t+1

Question 11.#define scanf ?%s is a string?

Main(){

Printf(scanf,scanf);

}

What is the output?

A. Ccompiler error B. scanf is a string

C. %s is a string is a string D. %s is a string

Question 12.#define boo(x) x/4 Main(){

Int I;

I=64/boo(4);

Printf(?%dn?,i);

}

A. Compiler time error

B. 16

C. 64

D. 20

E. Divide by Zero Error

Question 13.What the following C function will do?

Unsigned int bitwise(Unsigned int x)

{

Unsigned int r=x &-x;

Unsigned int l

x+=r if(0==l) return 0; l=x &-x; l-=r;

while(0==(l&l)

{

l>>=1;

}

Return x|(l>>1);

}

A. Return the greatest integer smaller then x

B. Returns x/2

C. Returns the smallest integer greater than x with the some number of bits set

D. Returns the smallest integer greater than x with less number of bits set

E. None of the above

Question 14.Int i

Void intcrement(int i)

{

I++

}

Int main()

{

For(i=0;i<10; increment(i)) { } Printf(?i=%d?,i); Return 0; } Predict the output of the above C ode A. I=10 B. I=9 C. I=11 D. Compiler Error E. None of the above

Question 15.Consider the following C program

Main()

{

Int i=0;

I++;

Fork();

Printf(?d?,i);

I++;

Fork();

Printf(?d?,i);

}

What is the maximum value of the I that will be printed?

A. 0

B. 7

C. 5

D. 2

E. 10

Question 16.#include

Using namespace std;

Template

Void swap( T *a, T *b){

Temp =*a;

*a=*b

*b=temp;

}

Int main(){

Char hello[]=?hello?;

Char world[]=?world?;

Swap((char *)&hello, (char **)&world);

Cout<

Consider a Binary Tee represented as a 1-indexed array(where the children of an element L are at indexes L and 2*L+1, elements at index is the root), with elements 1,2,3,4,5,6,7 in that order. If the post order traversal of the array gives ab-cd*+, the the lebel on the nodes 1,2,3,4,5,6,7 can be

A. +,-,*,a,b,c,d

B. a,-,b,+,c,*,d

C. a,b,c,d,-,*,+

D. -, a,b,+,*,c,d

E. none of the above

Question 18.A hypercube is defined as follows:

A hypercube of dimension 0 has only a vertex. To construct a hypercube of N dimentions, take two N-1 dimentional hypercubes, and attach edges between corresponding nodes of each of these hypercubes. How many colors will you need to color the EDGES of an N dimentional hypercube such that no two edges of the same color share a common vertex?

A. 2

B. 2^N

C. N

D. N^2

E. Node of the above

Question 19.Find the complexity function

F(n)=2F(n/2)+10n, if n>1

F(n)=1, if n=1

A. n^2

B. n(logn)^2

C. n

D. nlogn

E. None of the above

Question 20.In each step of insertion sort algorithm, a new elemennt has to be inserted into an already sorted subarry. Instead of using sequential search to determine the location of new element which takes O(n) time( Which makes the overall cpmplexity O(n^2) ), We can use bunary search since the subarray is sorted, which will take O(logn) time. By using this techinue, we can reduce the complexity of insertion sort from O(n^2) to

A. O(nlogn)

B. O(n)

C. O(logn)

D. O(n^2)

E. O(1)

Question 21.Cossider the following procedure: f(n)

for i=1 to n dp

j=n while j>i do

j=j-1

end while end for

Assume the above procedure are only an integer n>0; What is the time complexity in n for the procedure above:

A. O(nlogn)

B. O(n)

C. O(n^2)

D. O(N^3)

E. O(1)

Question 22.A. O(1)

B. O(n)

C. O(logn)

D. O(n^2)

E. O(nlogn)

Question 23.A. Merge sort

B. Insertion Sort

C. Quick Sort

D. Counting sort

E. Bubble SOrt

Question 24.A. Best if A is in row-major and B is in Column Major Order.

B. Best if both are in row major

C. Best if both are in column major

D. Independent of the storage scheme.

E. None of the above

Question 25.A. O(n)

B. O(log n)

C. O(logN)

D. O(loglog n)

E. O(loglogN)