Friday, January 2, 2015

Cavium Network Fresher Interview Question

Cavium Network Interview Questions
                        

          %%%%%%%%%%%%%%%%%
           % First Round %
          %%%%%%%%%%%%%%%%%


NOTE: There could be multiple correct answers for a question. And you are required to explain your answer.
1. Define the enum ABC having attributes POSITIVE, NEGATIVE, and ZERO such that the 'fun()' function prints Postive for a positive number, Negative for a negative number and Zero for 0.

#include<stdio.h>
enum ABC
{
__________      //First Line
__________      //Second Line
__________      //Third Line
};
void fun(int num)
{
      if(num<=NEGATIVE)
           printf("Its a negative number\n");
      else
      {
           if(num>=POSITIVE)
                  printf("Its a positive number\n");
           else
                  printf("Zero\n");
      }
}
int main()
{
     int i;
     scanf("%d",&i);
     fun(i);
     return 0;
}

(a)
enum{
ZERO;
POSITIVE;
NEGATIVE=-1;
};
(b)
enum{
POSITIVE=1;
ZERO=0;
NEGATIVE=-1;
};

(c)
enum{
ZERO=0
POSITIVE=1
NEGATIVE=-1;
};

(d)
enum{
POSITIVE=1;
NEGATIVE=-1;
ZERO;
};

2. What will be the output for the below program.
#define Y 10
#define X 1-(Y)
int main()
{
    int val;
    val=200*X
    printf("Value of val is %d\n",val);
    return 0;
}


3. What will be the output for the below program.
struct ABC
{
      int a;
      char b;
      void *c;
};
int main()
{
     struct ABC *obj=NULL;
     printf("%d: %d: %d: %d: %d\n",sizeof(obj->a),sizeof(obj->b),sizeof(obj->c),sizeof(obj),sizeof(struct ABC));
     return 0;
}

4. Design a data structure which can add 2 numbers in the range of 2127 to 2127-1
5. Using the data structure define above write a program which can add two numbers.
6. Using System Calls define printf function. Assume only one argument can be passed to this function.
7. Suppose you are having an instruction
sbn A,B,C
defined as
Memory[A]=Memory[A]-Memory[B]
if(Memory[A]<0)
    ProgramCounter=C.
Now, you are asked to write a code for moving the content of X to Y.
8. Does p,q and r point to the same location in belwo program.
#include<stdlib.h>
#include<stdio.h>
int main()
{
     int *p,*q,*r;
     p=malloc(sizeof(int));
     free(p);
     q=malloc(sizeof(int));
     free(q);
     r=malloc(sizeof(int));
     return 0;
}

9. Kindly choose for the blow program.
void fun(x)
{
    lock();
    IO_intensive();
    CPU_Intensive();
    unlock();
}
int main()
{
    fun(a);
    fun(b);
    fun(c);
    fun(d);
}

(a) Uniporcessor System will give optimal performance for this situation.
(b) Dual Core will give optimal performance for this situation.
(c) Quad Core will give optimal performance for this situation.
(d) Multicore with altered code will give optimal performance for this situation..

10. What does function 'fun' returns?
typedef struct tree* NODE
struct tree
{
    int info;
    struct tree *leftMostSibling,*rightSibling;
};
int fun(NODE root)
{
    int value=0;
    if(root)
    {
        value=1;
        value=value+fun(root->leftMostSibling);
        value=value+fun(root->rightSibling);
    }
    return(value);
}

11. What is the output of the program given below?
#include<stdio.h>
void fun(int *p)
{
     p=malloc(sizeof(int));
}
int main()
{
     int *p=NULL;
     fun(p);
     if(p)
         printf("p is not null");
     else
         printf("null");
    return 0;
}

12. Write the output for the below program.
int main()
{
    int a=0xabcdef;
    char *p;
    p=&a;
    printf("%x\n",*p);
    return 0;
}
                                 %%%%%%%%%%%%%%%%%%
                                  % Second Round %
                                 %%%%%%%%%%%%%%%%%%

1. Introduce yourself.
2. Among the subjects you read so far, which subjects you like the most.
then Why?
3. Do u have learnt Advance Operating System ? what have you learned in Advance Operating System.
4. What do you mean by Segmentation fault?How it get detected.
5. How MMU knows that the memory address being used is not in the processes range?
6. Do you know about TLB? if yes then explain it.
7. What is MMU?
8. Explain Virtual Memory.
9. Do you know execv()?
10. A code was given in which he used execv() and then asked me for the output. the code is as below.
int main()
{
    execv(".../ls",some parameters);
    printf("hello\n");
}

11. Do you like Data Structure and Algorithm?
12. Write a program to find LCA of the two nodes of a tree.
13. Write a progarm to reverse the single linklist.
14. Ask me to explain my project.
15. Do you have any question to ask?


                                 %%%%%%%%%%%%%%%%%
                                  % Third Round %
                                 %%%%%%%%%%%%%%%%%

1. Introduce yourself.
2. Ask me to introduce big endian and little endian.
3. What is the trade-off between them.
4. How to find whether a system is using little endian or big endian?
5. Is it possible to install 32 bit OS on IA64?
6. A PC with IA64, 32 bit OS will not be able to access the entire RAM(in some cases). Is it possible to access entire RAM. If yes, how?
7. Explain the concept of DMA.
8. Can DMA be in deadlock?
9. Do you have any question to ask?


                                 %%%%%%%%%%%%%%%%%%%%%%%
                                  % Fourth Round (HR) %
                                 %%%%%%%%%%%%%%%%%%%%%%%


1. Introduce yourself.
2. Asked me about the interview, how was each round
3. Do you ever had a fight?
4. From which place do u belong?
5. Given a choice to move to north (I am from UP). Will you move to north.
There were some more normal HR questions.








No comments:

Post a Comment