Hewlett Packard Whole-Testpaper Contributed by Najil updated on Jun 2019

HP Sample Placement Paper - HP placement Paper with Question and Answeres

Previous Paper Kolkatha 

Section A. ------50qns(general aptitude, english etc): 
Section B. ------ 10 Questions on Computer concepts. 
Section C. ------ 30 Questions on C 


1. WAP find and replace a character in a string.

2. WA function to perform the subtraction of two .
Eg:char N1="123",N2="478", N3=-355(N1-N2).

3. WAP dynamically initialize a 2 dimensional array 
Eg:5x20,accept strings and check for vowels and display the no. finally free the space allocated .

4. WAP read a line from file from location N1 to N2 using command line arguments 
Eg:exe 10 20 a.c 
5. WAP find the largest of 4 no using macros.

General section 
Computer science general, c/c++ section, Java section ,The question paper had 48 questions to be answered in 1hr. Time will be quite sufficient. They have different sets of question papers. . 
1 General section : computer science general knowledge 
2. Computer science general: simple questions

1. HP acquired this company in 2002. Which is the company
a) Compaq b) Dell c) option 3 d) Option4 Ans: a

2. What does 3G denote
a) 3rd generation mobile communication b) 3rd generation computer languages c) option 3 d) option Ans: a

3. An application program that is used by the users to get the information from the backend of some application like databases:
a) application server b) proxy server c) database server d) option Ans: database server 

4. Which of the following is not true about the e-mail
a) It can be accessed by a client program using POP
b) It can be accessed by a client program using imap protocol
c) option 3
d) option 4
Ans: I don't remember the answer but first 2 are true.

5. Some question regarding the company and who developed it ( the thing to remember is that Apple produce Macintosh computers).

c/c++ section: questions on c/c++, programs o/p etc. 
1 main( )
{
unsigned int i=3; 
while( i >=0)
printf( "%d", i--);
}
how many times will the printf stmt be executed?
a)0 b)3 c)4 d)infinite
Ans: I think the answer is infinite, b'cos 'i' is an unsigned integer and it will not decrement below '0' and hence end up in an infinite loop.(yes, i checked and it is getting stuck in an infinite loop)

2. main( )
{
int x,y, z;
x=2;
y=5;
z= x+++y;
printf("%d %d %d", x, y z);
}
a)3 5 7 b) option 2 c) option 3 d) option 4
Ans: a

3 # define swap(a,b) temp=a; a=b; b=temp;
main( )

int i, j, temp;
i=5;
j=10;
temp=0;
if( i > j)
swap( i, j );
printf( "%d %d %d", i, j, temp);
}
Ans: On compiling i got ans 10, 0, 0. I did not understand the concept. Please explain this to me.

4. Java section: questions on java related stuff.
1) Java was initially code named as:
a)Oak b)green c)miller d)option4
Ans: Oak

5. What is not true about the following statements about java. 
a) it is compiled using javac compiler
b) the compiled files have .class extension.
c) such files cannot be transferred from one comp to another.
d) they use the java interpreter 
Ans: c

6. Why is the synchronize used?
a) to initialize multiple objects b)to lock an object c)option3 d)option 4
Ans: b (probably)

feedback