quiz2 - EE 322C Data Structures Spring 2009 Dr. Ramesh...

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 Due: Wednesday 2/18 in class Total points: 60 Name(First,Middle,Last): Instructions: Type in the answers to the questions in the space provided and turn in a hardcopy in class. {Feel free to expand the answer space as needed} Attempt the questions by yourself first. Reading the material should help you with this. Don’t rely on the computer to find your answer. Use it to improve and verify your understanding. 1. What is the output of the following code snippet? why? (4 + 4 = 8 points) class Coord { int x,y; Coord(int a,int b){ x=a;y=b; } } public void changeCoord(Coord c1, Coord c2) { c1.x = 100; c1.y = 100; Coord temp = c1; c1 = c2; c2 = temp; } public static void main(String [] args) { Coord c1 = new Coord(0,0); Coord c2 = new Coord(0,0); System.out.println("X: " + c1.x + " Y: " +c1.y); System.out.println("X: " + c2.x + " Y: " +c2.y); changeCoord(c1,c2); System.out.println("X: " + c1.x + " Y:" + c1.y); System.out.println("X: " + c2.x + " Y: " +c2.y); } Answer: 2. What is the output of the following routine and why? (3 points)
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 at Austin.

Page1 / 4

quiz2 - EE 322C Data Structures Spring 2009 Dr. Ramesh...

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