07 | 09 | 2010
Main Menu
Affiliates
Login Form



Alexa
JoomlaWatch Stats 1.2.6 by Matej Koval
HP Placement Paper-6
Written by Phoenix   
Saturday, 26 July 2008 05:47

Rating 2.2/5 (5 votes)

HP FRESHERS PLACEMENT PAPER.


PATTERN:
Question Paper Consist of  4 parts.                 
C---------20Questions
C++ ----15Questions
Unix-----15Questions
Aptitude--15Questions

DURATION: 60 minutes.



SECTION 1: C

1.
i=23, j=4, c=0;
c=i++-++j;


What is the output of this program?



2.
#define CUBE(x)   x*x*x
#define MUL3(x,y) 3*x*y
#define ADD(x,y)  x+y
void main()
{
int j;
int a;
int b;
j= CUBE(2+2);
a=MUL3(4-3,5);
b=ADD(16,1);
}
What will be the output?



3. Write A Program find and replace a character in a string.



4. Write A function to perform the substraction of two Strings.
Eg:char N1="123",N2="478",
N3=-355(N1-N2).



5. Write A Program to dynamically intialize a 2 dimentional array Eg:5x20,accept strings and check
for vowels and display the no of vowels. Finally free the space allocated .



6. Write A Program to read a line from a file from location N1 to N2 using command line agruments
Eg:exe 10 20 a.c



7.  Write A Program to find the largest of 4 numbrers using macros.



8.
char c[]="123456789";
i=4;
printf("%c %c", c[i], i[c]);

What will be the output?

9.

int *ptr;
p=0;
p++;
printf("%u", p);

What will be the output?

a. 0 
b. garbage value 
c. 4 
d. none of the above


10.
double i=0.0;
switch(i)
{
case 0.0:
printf("jgdj");
case 1.0:
printf("ptoy");
break;
default:
printf("hdfv");

What will be the output?


11. Write a function that will allow a floating point number to be raised to an integer power.
In other words, we wish to evaluate the formula y=x power n;


12. Explain what happens when the following statement is executed?
if(abs(x) < xmin) x=(x>0) ? xmin : -xmin;


13.
main()
{
int i=0, x=0;
for(i=1; i<10; i*=2)
{
x++;
printf("%d", x);
}
printf("\nx=%d",x);
}

What will be the output?


14.
#define ROWS 3
#define COLUMNS 4

void sub1(int z[][COLUMNS]);
main()
{
ststic int z[ROWS][COLUMNS]={1,2,3,4,5,6,7,8,9,10,11,12};
sub1(z);
}


void sub1(int x[][4])
{
int a,b,c;
for(b=0;b<columns;++b)
{
c=0;
for(a=0;a<RPWS;++a)
if(x[a][b]>c) c=x[a][b];
printf("%d",c);
}
return;
}

What will be the output?



15.
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

Answer: a



16.
#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);
}

What will be the output?

Answer:10, 0, 0



17.
char str[20] = "SANJAY"
printf("%d%d",sizeof(str),strlen(str))

What will be the output?

Answer: 20,6


18.
i=6;
printf("%d",i++*i++)

What will be the output?

a. 36
b. 54
c. Can't say

Answer: Can't say (compiler dependent)



19.
main()
{
int i=3;
while(i>=0)
printf("%d",i--);
return(0);
}

What will be the output?

a)3
b)Infinite
c)0
d)2



20.
Which of the following can be used to print % to the screen?

a) printf("\%");
b)printf("\\%");
c)-----
d)------


SECTION 3: UNIX


1. Is "bash" is a kind of shell in UNIX ?


2.Primitive flavours of unix__________

a. BSD &Sys V
b. LINUX & BSD c.


3 .Which of the folllowing is used 4 redirection in UNIX?     
a. >,
b. |,
c. <,
d. ^


4.What is the UNIX terminology for multi-tasking?

a. Time slicing
b. Pre-emptive
c. Time division.


5.In UNIX if you try accessing a directory  for which you dont have permission,
What message is displayed?

a. Permission denied  
b. Invalid user   
c. Access denied.



6.What does fork() return to its parent?
a)child pid
b)0
c)Any value greater than 0



7.What does chmod 654 stand for

Answer: -rw-r-xr--



8.Which of following is used for back_up files?
a. compress
b. tar 
c. make  
d. all the above

Answer: d. all the above



9.What does find command do?

Answer: Search a file.





 

Comments
Search
Only registered users can write comments!

3.22 Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated ( Saturday, 26 July 2008 05:49 )