Technical Questions asked in Hewlett Packard

fb ad
  1. Memory is allocated from_______________for each and every malloc function call
    1. Stack
    2. Heap
    3.  Static memory area
    4. Cache

    Answer : Option B.
  2. When is a static variable initialized?
    1. Every time the function containing it is called.
    2. When it is globally declared
    3. Only when declared within a function.
    4. Only the first time the function containing it is called

    Answer : Option D.
  3. What would be the output of following code?
    #include
    int main(int argc,char **argv)
    {
    int iVar=0, iCnt, aiArr[] = {56,23,4,89,-200,34};
    for(iCnt = 1; iCnt <6; iCnt++)
    { if(aiArr[iCnt] < aiArr[iVar])
    iVar = iCnt;
    }
    printf("%d",iVar);
    return 0;
    }
    1. 4
    2. 89
    3. 3
    4. -200

    Answer : Option A.
  4. Which of the following is not a type of constructor? 
    1. Copy constructor
    2. Friend constructor
    3. Default constructor
    4. Parameterized constructor

    Answer : Option B.
  5. Under which of the following Big O notation it is suggested to review design of algorithm?
    1. O(n2)
    2. O(nlogn)
    3. O(n)
    4. O(2n)

    Answer : Option D.
  6. Which of the following is true about linked lists? 
    1. It can be considered as series of nodes
    2. Each node has a single pointer to the next node
    3. In the last node there is a null pointer
    4. All of these

    Answer : Option D.
telegram_ad
Rate Us
Views:25046