Midterm.fa10

Midterm.fa10 - Signature Name cs8f Student ID CSE 8A...

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

Signature _____________________ Name ________________________ cs8f ____ Student ID ____________________ CSE 8A Midterm Fall 2010 Page 1 ___________ (11 points) Page 2 ___________ (16 points) Page 3 ___________ (6 points) Page 4 ___________ (11 points) Page 5 ___________ (14 points) Page 6 ___________ (10 points) Total ___________ (68 points = 65 base points + 3 points EC [5%]) This exam is to be taken by yourself with closed books, closed notes, no electronic devices. You are allowed one side of an 8.5"x11" sheet of paper handwritten by you.

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 Write variable definitions for the following. Only initialize variables if instructed to. a) A double precision floating point variable named foo ____________________________________ b) An integer named bar initialized to 420 ____________________________________ c) A variable named fubar initialized to true ____________________________________ d) If foo (above) was a local variable, what would its initial value be? ________________________ What gets printed? public class M2 { public static void main( String[] args ) { System.out.println( -1 + 2 - 3 * 5 / 4 ); _________ System.out.println( 6 + 7 % 11 + 9 * 10 ); _________ } } What gets printed? public class M3 { public static void main( String[] args ) { int fire = 10, air = 4; fire = fire * (air + 7); System.out.println( "fire = " + fire ); ________________________ fire = 6 – air++; System.out.println( "fire = " + fire + "; air = " + air );________________________ fire = 8; air = --fire + 4; System.out.println( "fire = " + fire + "; air = " + air );________________________ } }
2 What gets printed? public class M5

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.

This note was uploaded on 08/31/2011 for the course CSE 8a taught by Professor Kube,p during the Fall '08 term at UCSD.

Page1 / 7

Midterm.fa10 - Signature Name cs8f Student ID CSE 8A...

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

View Full Document
Ask a homework question - tutors are online