Midterm.fa09

# Midterm.fa09 - Signature _ cs11f _ Name _ Student ID _ CSE...

This preview shows pages 1–4. Sign up to view the full content.

Signature _____________________ Name ________________________ cs11f ____ Student ID ____________________ CSE 11 Midterm Fall 2009 Page 1 ___________ (12 points) Page 2 ___________ (24 points) Page 3 ___________ (30 points) Page 4 ___________ (23 points) Page 5 ___________ (12 points) Total ___________ (101 points = 96 base points + 5 points EC [5%])

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

View Full Document
1 (Partial) Operator Precedence Table Operators Associativity ! ++ -- (pre & post inc/dec) right to left * / % left to right + - left to right < <= > >= left to right == != left to right && left to right || left to right = right to left 1) What are the values of x and y (left) and a and b (right) after the following code segments are executed? Assume we have a Java source file named Program.java and it uses at least one class in the objectdraw library. Write the full Unix command to compile this Java program. ________________________________________________________________________ This command will produce a file named: ________________________________________________________________________ Write the full Unix command to run this as a Java application. ________________________________________________________________________ Assume we have correctly written a Program.html file. Write the full Unix command to run the above program as an applet. ________________________________________________________________________ x = y = int x = 2, y = 4; if ( x++ >= 3 || --y >= 3 ) x = x++ + --y; else x = ++x + y--; a = b = int a = 2, b = 4; if ( a++ >= 3 && --b >= 3 ) a = a++ + --b; else a = ++a + b--;
2 2) Given the following definition of class Thing1, what is the output of the Java application Question2? public class Thing1 { private int count; public Thing1( int count ) { this.count = count; } public int getCount() { return this.count; } public void setCount( int count ) { this.count = count; } public String toString() { if ( this.count == 1 )

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## Midterm.fa09 - Signature _ cs11f _ Name _ Student ID _ CSE...

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

View Full Document
Ask a homework question - tutors are online