sample-mt

# sample-mt - Name: ECE-C490 (Programming for Engineers)...

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

Name: ECE-C490 (Programming for Engineers) Sample Mid-Term Examination Winter 2005-06 Department of ECE, Drexel University (100 points, 1 hour and 20 minutes) Problem 1. For each of the following code segments, precisely state the printed output. Show all your work. (30 points) (a) System.out.printf( "o o\n v \n =\n" ); (b) int k = 5; System.out.print( "What is k now: " + k++ ); System.out.println( " or " + ++k ); (c) int a = 6; int b = 5; int c = 2; System.out.printf( "The answer is either %d or %d\n", ( a / b + c ) + b % a, ( a % b % c ) );

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

View Full Document
(d) boolean x = true; boolean y = true; boolean xx = !x & ( y || x ) ; boolean yy = y & ( !x || true ) ; System.out.printf( "That it is lunch time is %b? %b?\n", xx, yy ); (e) for ( int m = 1; m < 10; m++ ) switch (m) { case 2: System.out.println("Monday"); break; case 3: case 5: case 7: System.out.println("Tuesday"); break; case 4: System.out.println("Wednesday"); default: System.out.println("Thursday"); break; } Page 2 of 8
(f) int i = 5; int j = 6;

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 01/17/2012 for the course ECE 203 taught by Professor Robincarr during the Fall '07 term at Drexel.

### Page1 / 8

sample-mt - Name: ECE-C490 (Programming for Engineers)...

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

View Full Document
Ask a homework question - tutors are online