HP PLACEMENT PAPERS -------- Placement Paper - 2

Answer Posted / dharati

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
expalin this to me.
its because macro is expanded as

temp = i;
i = j;
j = temp;

the condition gets false as i < j and first statement i.e.
temp = a is not executed and remaining statements gets
executed and results in i = 10 and j = 0.

Is This Answer Correct ?    8 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

If anybody knows the recruitment procedure of IOTL & POWER MECHANICAL. send me the placement papers if u hav... very urgent ...

3894


how did you celebrate your last birthday?

1275


what is difference between uv and visible spectroscopy and how to differentiate the drug compounds in uv visible region

1593


email me previous question papers of bob bank for po exams

2060


Hi.. Guys Im pranitha, presently im working in a organisation & im look for job at MNC's like DELL, Delloitte, Bank of America, Genpect, etc., I have completed B.com . Pls help me...

1147






What are the frequently asked questions for interview in capital iq company ?

1324


HI SIR I WANT PREVIOUS QUESTION PAPER OF HPCL I M CHEMICAL ENGG.

1945


printf("%d",printf("%d",printf("%d",printf("%s","ILOVECPROGRAM")))); whats the output

1394


Do we have vacancy for HR RECRUITER ?

1379


what you will do when you struck in traffic ?

1051


my question is : reverse a string in COBOL program (please write a code asap) input file: 1234abcdef output file: 8765_____ abc*$#1___ 1_2_3_4__ cdef____ghi h_k_z_a__ a_z_k_h___ ihg____ghi 4_3_2_1___ 1#$*cba__ ______5678 fedcb4321

1295


A frog wants to climb a pole which is 15 feet in height, frog can jump 3 feet every minute after which he rests for a minute where he slips down 2 feet. How much time will the frog take to reach the top of the pole?

600


my question is : reverse a string in COBOL program (please write a code asap) input file: 1234abcdef abc*$#1___ cdef____ghi a_z_k_h___ 4_3_2_1___ ______5678 output file: 8765_____ 1_2_3_4__ h_k_z_a__ ihg____ghi 1#$*cba__ fedcb4321

1194


your project to describe and tell about : 1. My favorite things 2. My favorite places at home 3. Animals *Choose one of them to describe *Write on your paper *If you done, Send me *Did you get it

784


What kind of Issues/bugs arise in ETL projects? I would like to know few issues (critical to somewhat bugs ) normally occur in ETL process especially when testing? Domains can be banking, retail or any.

1424