Final.fa10

Final.fa10 - Student ID _ Name _ cs8f _ Signature _ CSE 8A...

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

View Full Document Right Arrow Icon
Student ID ____________________ Name ________________________ cs8f ____ Signature _____________________ CSE 8A Final Fall 2010 Page 1 ___________ (10 points) Page 2 ___________ (9 points) Page 3 ___________ (7 points) Page 4 ___________ (12 points) Page 5 ___________ (12 points) Page 6 ___________ (11 points) Page 7 ___________ (14 points) Page 8 ___________ (14 points) Page 9 ___________ (10 points) Total ___________ (99 points = 94 base points + 5 points EC [5%]) This exam is to be taken by yourself with closed books, closed notes, no electronic devices. You are allowed both sides of an 8.5"x11" sheet of paper handwritten by you.
Background image of page 1

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

View Full DocumentRight Arrow Icon
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 What gets printed? public class F2 { public static void main( String[] args ) { System.out.println( -1 + 2 - 3 * 10 % 4 ); _________ System.out.println( 2 * 7 - 11 / 9 + 10 ); _________ } } What gets printed? public class F3 { public static void main( String[] args ) { int fire = 10, air = 2; fire = fire * (air + 5); System.out.println( "fire = " + fire ); ________________________ fire = 5 – air--; System.out.println( "fire = " + fire + "; air = " + air );________________________ fire = 5; air = ++fire + 4; System.out.println( "fire = " + fire + "; air = " + air );________________________ } } What is printed by the following code? int foo = 42; int bar = 42; boolean foobar = ( foo == bar ); System.out.println( foobar ); ____________ foo = 37; System.out.println( foobar ); ____________ System.out.println( foo == bar ); ____________
Background image of page 2
Fill in the blank so the code will print out 2 System.out.println( (____________) (5.0 / 2.0) ); What does the statement System.out.println( "The answer is: " + 5 + 7 + 2 ); print? ________________________________ What does the statement System.out.println( "The answer is: " + 5 + (7 + 2) ); print? ________________________________ What does the statement System.out.println( "The answer is: " + (5 + 7) + 2 ); print? ________________________________ What does the statement System.out.println( !(2 > 3) ); print? ________________________________ What does int x = 15 % 3; System.out.println( x ); print? ________________________________ What is the full name of the file that this Java code below must be saved as? ____________________________ public class Cafe { /* Body of the class here. */ } What is stored in the memory location allocated for the variable x for the following: (Circle the correct answer.) String x = "-99"; A) x B) a reference (or address in memory) to where the string "-99" is stored C) the value -99 D) int What is stored in the memory location allocated for the variable x for the following: (Circle the correct answer.) int x = -99;
Background image of page 3

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

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

Page1 / 12

Final.fa10 - Student ID _ Name _ cs8f _ Signature _ CSE 8A...

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

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