Saturday, March 28, 2015

Cavium Network, Brocade & Broadcom Interview Questions





Kindly find below the Interview questions asked in "cavium network, Brocade, Broadcom" company. Basically I haven't remember which question asked in which company and in which round, So instead or sharing company wise and round wise, I am sharing a collection of question by topics.

We hope It will help, job seeker to crack the Interview.... 

VLAN:
=====

1. What is use for VLAN_XLATE table, How it work? Design a data structure for VLAN_XLATE table?
2. How do you stop learning per VLAN bases? Where do you apply in pipeline? 

QoS:
===

Mapping:
========

1. How mapping is work?
2. How do create Decoding and Encoding profile?
3. Is there way to modify a packet internal priority?

Police and Shape:
================

1. Were do use police?
2. Were do use shape?
2. Why police is used at ingress and what is the burst and inter packet delay will be handled by police?
3. Why shaping is used at egress, Why can't be ingress? 
4. Write algorithm for police and shape?  

Bandwidth and Shape :
=====================

1. Configure minimum guaranteed bandwidth on Queue0 70% and Queue1 30% and level 1 scheduler shape with 10%, 
    Generate both the traffic 50:50 percent from ingress, what will be the expected output?
    
LAG:
====


C:
===

1. Write a program to toggle a bit location n and m (toggle_bits(int data, int n_loc, int m_loc))?
2. Find a second largest number in array ?
3. int i = 10 and int j, which is declaration and which is definition ?
4. Add a 2 number with out using + operator ?
5. Multiply a number with 8 with out using * operator ?
6. int * ptr = 1000; char *ch = 1000; int **pptr = 1000; void *vd = 1000; ptr++, ch++, pptr++, vd++; printf("all value ") ?
7. Write a program to print range value separated(using -)and single value separated(using ,)in following format(2,4,6-9,11,)?
8. Write a program to insert_sorted_list(),delete_sorted_list(), delete_entire_list() and write program to test inset, delete and delete entire ?
9. Add a given number using program a + b ? (indirectly mean of this question handle overflow) ?
10. Define a data structure for the node should contain list, left child and right child ?
11. Define a data structure for to implement malloc ?
12. Write link list library for insert/delete ?
12. Write a program to delete a n'th node from last ?

                                   10
                                       
                              6         15
                              
                            3   8    12    18 
                            
            output:|------------------------------|    
                   |-> 3->6->8->10->12->15->18----|

  
int Add(int x, int y)
{
   int carry;
    // Iterate till there is no carry 
    while (y != 0)
    {
        // carry now contains common set bits of x and y
        carry = x & y; 

        // Sum of bits of x and y where at least one of the bits is not set
        x = x ^ y;

        // Carry is shifted by one so that adding it to x gives the required sum
        y = carry << 1;
    }
    return x;
}

int 
mask_bits(int data, int s_bit, int e_bit) 
{
  int n_mask = 0, mask = 0;
  int n = 0;
  n_mask = ((e_bit - s_bit)+1);
  n =(0x1<<n_mask);
  mask = ~((n-1) << (s_bit-1));
  data =  data & mask;
  return data;
}

23. Reverse ever alternate node in a link list. mean List: 1->2->3->4->5->6->   after reverse 2->1->4->3->6->5->
     Reverse_Alternate_Node(LIST ** head)
       {
         LIST *prev = *head;
         LIST *curr = NULL;
         LIST *to_be_link = NULL; 
         
         if(!prev) return ;
         curr = prev->next;
         
         while(curr) {
          to_be_link = curr->next;
          curr->next = prev;
          prev = to_be_link;
          to_be_link = curr->next;
          if(!prev) break;
            curr = prev->next;
          if(curr) to_be_link->next = curr;    
         }
         
         if(to_be_link) to_be_link->next = prev; 
         return ;
       }
       
24. N number of element("ab", "zb", "cd", "wx", "ab","gv","cd",..."ab", ...."cd") stored in a contagious memory. Element size is 2 byte character.
    Remove the alternate repeated elements(("ab", "zb", "cd", "wx", "--","gv","--",..."ab", ...."cd")). 
    Write an algorithm should meat time complexity O(1) and space complexity constant. 
     > Solution 1: 2 dimension array (array[26][26]) require 676 byte storage.
     > Solution 2: Use Bit-map(size = ((26*26)/8)+1; bitmap[size];) requite 85 byte storage
                    /*Bit map location is calculate with the assumption, 
                      bitmap- 0 bit is map to "aa" 26 bit is map to "ba" so on..*/
                    void
                    get_bitloc(char *str, int *array_loc, int *bit_loc)
                     {
                       /*Assume always str, array_loc and bit_loc is valid*/
                       int base = str[0] - 'a';
                       int base_bit_pos = (base*26)%8;
                       int bit_pos  = (str[1] - 'a');                       
                       *array_loc = (base*26)/8;              
                        base = base_bit_pos + bit_pos;
                       *array_loc += (base/8); 
                       *bit_loc = (base%8);
                     }
                    /*First visit a set a bit second visit unset a bit and remove the element from storage.*/
                    int remove_element(char **mem)
                        {
                           int loc = 0, bit_loc = 0;
                           int is_set = 0;
                           char *ptr[2] = *mem;
                           while(ptr) {
                             get_bitloc(ptr, &loc, &bit_loc);
                             is_set = bitmap[loc]&(0x80>>bit_loc);
                             if(is_set) { remove content in memory}
                             bitmap[loc] = bitmap[loc]^(0x80>>bit_loc);     
                             ptr++;
                           }
                        }
     
    
25. N step staircases are there where you can claim 1 or 2 step at time. How many possible way to reach you a top.
     Solution:
      > if N = 1 , Possible way(1) = 1
      > if N = 2 , Possible way(2) = (1,1) (2)
      > if N = 3 , Possible way(3) = (1,1,1) (2,1) (1,2)
      > if N = 4 , Possible way(5) = (1,1,1,1)(2,1,1) (1,2,1) (1,1,2) (2,2)
      > if N = 5 , Possible way(8) = (1,1,1,1,1) (2,1,1,1)(1,2,1,1) (1,1,2,1) (1,1,1,2) (2,2,1) (2,1,2) (1,2,2) 
      int 
      Fibonacci(int n)
       {
         if ( n == 0 )
           return 0;
         else if ( n == 1 )
           return 1;
         else
           return ( Fibonacci(n-1) + Fibonacci(n-2) );
       } 
       
       

LAG:
====
1. Different between LAG and ECMP ? Why they are configure directly connection node being LAG, why cannot ECMP?
    Directly connected routers can be connect way ecmp path, but there will be a unnecessarily reserve IP address which can be connect way L2 itself.  
2. What we need dynamic LAG, why cannot use static lag instead of dynamic LAG ? (Mean why we need LACP) ?
    Dynamic LAG is require to avoid loop between the node. 
              ____            ____
    example: |    |----------|    |
             | S1 |----------| S2 |
             |____|----------|____|
             
              In "S1" static lag is configured  and S2 normal STP is running on the port which is directly connected.  
3. 

L2 Learning packets indication to CPU:
*************************************

> Polling method  --> For station moument, first it will send add and delete call to CPU. 
> FIFO method     --> For station moument, send as updated.


We Heartily Thanks to Raja for Sharing his interview experience/questions with Q-4-Interview. 


If you would like to contribute, mail us your interview experience at "q4interview@gmail.com"We will like to publish it on "q4interview.blogspot.in" and let's help other job seekers.



No comments:

Post a Comment