Pages

Friday 2 November 2012

walmart lab recent papers 2012



1. int fun(char  *array ,int n)
     {
        return (array[n]);
       }

 a.it wont work
 b.segmentation fault
 c.it will not work without size of array
 d.it does not work but we can fix

2.given array some three call functions to that functions after completing all what are values in array
   easy only but time taking

3.given a tree we can find  whether given tree is binary search tree are not in

 a.O(n)
 b.O(logn)
 c.O(n^2)
d.O(log(logn))

4.merge sort algoritham we can apply for
 
 i)singly linked list
ii)doubly linked list
iii)array

a.only iii
b.only i and ii
c.only ii,iii
d.i,ii,and iii

5.in chess tournament there are 100 players then what number of matches to find the  winner

 a.98
 b.99
 c.97
 d.95

6.f(x+f(x))=4f(x) then find f(21) ,f(1)=4

  a.64
 b.25
 c.88
 d.12

7.find x
  x=(x&0a0a0a0a0a)>>1 | (x&05050505)<<1 ;
  x=(x&0c0c0c0c0c)>>2 | (x&03030303)<<2 ;
  x=(x&0f0f0f0f)>>4 | (x&f0f0f0f0)<<4 ;
  x=x&ffff0000)>>16| (x&0000ffff)<<16 ;

above statements will

a.reverse bits of x
b.interchange bits of x
c.flip bits if x
d.none

8.n and p are greater than 1 , 5n is square of number and 75np is cube of a number then what is smallest value of n + p

a.14
b.20
c.30
d.18

9. consider two series
      17,21,25,.................................417
      16,21,26,.................................666

find the number of terms common in two series

a.19
b.79
c.78
d.20

10. a painter needs to make solution of 2 parts of paint and 1.5 parts of water . by mistake he made solution
     of 6 liters contain half paint and half water so how much amount  he should add to make in correct
    proportion

  a.one liter paint
  b.one liter water
  c.half liter paint and one liter water
  d.half liter water and one liter paint


11.there are two stacks A and B  ,from stack A you can push element to B or print to screen . from b only u can print if  A has four element and B is empty then how many number of sequence we can find in print screen

 a.14
 a.12
 c.13
 d.24
 e.none

12. for A(m,n)
   
      if m=0 and n!=0 then A(m,n) =n+1;
      if m!=0 and n=0 then A(m,n)=A(m-1,1)
      if m!=0 and n!=0 then A(m,n)=A(m-1,A(m,n-1))

then the value of A(1,1) is

a.3
b.2
c.1
d.4

13.given a singly linked list missed some code and asked to find missed code if code is for reversing linked
    list

14. given code for binary search tree and array ={1,2,3,10,4,5) asked find the output if
      bsearch(array,0,5,10)
 
   a.-1
   b.compile error
   c.4
  d.none

15. in LRU algorithm for cache replacement best data structure to read the data

     a.linked list
     b.array
     c.hash table
     d.none

coding round:

1.write a code to find diameter of given binary tree

2.write a code to
  given array a={1,2,3,4,5,6}
  and n value we have to rotate the array by n times
  ex if: n=2
  output={5,61,2,3,4}

write code for this function
int [ ] rotate_array ( int [ ] input ,int n )



   thanks for cecil and shudhan shu for giving this information