Midterm.fa10

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

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

View Full Document Right Arrow Icon
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.
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 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 );________________________ } }
Background image of page 2
2 What gets printed? public class M5
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.

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 Right Arrow Icon
Ask a homework question - tutors are online