Home / Placement Papers / HP / Technical Questions Asked In Hewlett Packard

Technical Questions Asked In Hewlett Packard

Technical Questions

1.Memory is allocated from_______________for each and every malloc function call

A.Stack
B.Heap
C.Static memory area
D.Cache

Answer & Explanation

Answer : Option B.

2.When is a static variable initialized?

A.Every time the function containing it is called.
B.When it is globally declared
C.Only when declared within a function.
D.Only the first time the function containing it is called

Answer & Explanation

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;
}

A.4
B.89
C.3
D.-200

Answer & Explanation

Answer : Option A.

4.Which of the following is not a type of constructor?

A.Copy constructor
B.Friend constructor
C.Default constructor
D.Parameterized constructor

Answer & Explanation

Answer : Option B.

5.Under which of the following Big O notation it is suggested to review design of algorithm?

A.O(n2)
B.O(nlogn)
C.O(n)
D.O(2n)

Answer & Explanation

Answer : Option D.

6.Which of the following is true about linked lists?

A.It can be considered as series of nodes
B.Each node has a single pointer to the next node
C.In the last node there is a null pointer
D.All of these

Answer & Explanation

Answer : Option D.

Check Also

Hewlett Packard Reasoning Questions

Hewlett Packard Reasoning Questions 1.The base of a rectangle is seven times the height. If …

Leave a Reply

Your email address will not be published. Required fields are marked *