Sp05m1Key

Sp05m1Key - CS307 Spring 2005 Midterm 1 Suggested Solutions...

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

Sheet1 Page 1 CS307 Spring 2005 Midterm 1 Suggested Solutions and Grading Key 1. Answer as written or -2. Ignore differences in whitespace and capitalization and small spelling errors on F - L A.10 B.2 9 3 5 9 7 6 (Something showing contents of array. Lack of indices okay) C.0 -1 -2 1 0 -1 D.ABAABCCCBAB E.3 4 4 3 3 4 F. Robin's power is acrobatics Nightwing's power is acrobatics G. Matches's power is Disguises Batman's power is Intelligence H. Syntax error (Just error = -2) I.Wonder Woman's power is Golden Lasso and can fly J.gone's power is power ring and can fly K.false L.Super Strength's power is Agile and can fly M.eirt N.Flashlas O.Yes. An array out of bounds index could occur if x is less than 0 or greater than list.length. (Or words to that effect. It is also 2.Suggested Solution. (There were many ways of solving this problem. I think the simplest was to find the max and then chec //max approach public static boolean peak(int[] road) {int i = 1 boolean climb = false {climb = road[i] > road[i - 1] //System.out.println( i + " " + climb ) i++ climb = true } boolean descent = true

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 11/30/2010 for the course CS 307 taught by Professor Scott during the Spring '08 term at University of Texas.

Page1 / 8

Sp05m1Key - CS307 Spring 2005 Midterm 1 Suggested Solutions...

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

View Full Document
Ask a homework question - tutors are online