quiz2_answers - EE 322C Data Structures Spring 2009...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
EE 322C Data Structures Spring 2009 Dr.Ramesh Yerraballi Quiz 2 Total points: 60 Answers 1. X: 0 Y: 0 X: 0 Y: 0 X: 100 Y: 100 X: 0 Y: 0 Java only supports pass by value. For objects [not native types], a reference to the object is passed as an argument to the method parameter. Any access to the passed reference using the . operator, changes the original object pointed to by the passed reference. Hence, you see a change in the value of p1. But, the swap happens amongst the local variables in the function. Hence, it does not make effect in main() 2. 54.04 '2' when concatenated with an integer is cast into an integer and integer addition happens. '2' = 50 => 1 + '2' = 51 The resulting integer when added with a double 3.0 is promoted to a double and double addition happens resulting in 54.0. Finally, the resulting double is cast into string and string concatenation occurs with "4" resulting in 54.04 3. - WORA - automatic memory management C++ enables low level access to memory and hardware. PS: Don't be misled into thinking that Java is much slower, by c++ pundits. Significant improvements
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/26/2009 for the course EE 322C taught by Professor Nettles during the Spring '08 term at University of Texas.

Page1 / 3

quiz2_answers - EE 322C Data Structures Spring 2009...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online