cs1713_exam1_sol - CS 1713 Exam 1 Solutions — Fall 2006...

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

View Full Document Right Arrow Icon
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 1713 Exam 1 Solutions — Fall 2006 1) (14 points) a) 2 b) 3.5 c) 6.2 d) 13.2 e) 4 f) 4.6 g) 5.4 2) (15 points) if (originalGrade < 60) curvedGrade = originalGrade + 7; else if (originalGrade < 70) curvedGrade = originalGrade + 12; else if (originalGrade < 80) curvedGrade = originalGrade + 10; else if (originalGrade < 90) curvedGrade = originalGrade + 8; else curvedGrade = originalGrade + 5; 3) (7 points) Scanner scan = new Scanner(System.in); int value; do { System.out.println("Enter a number between 0 and 100:"); value = scan.nextInt(); } while (value < 0 [I value > 100); System.out.print1n(“The value entered is "+va1ue); 4) (5 points) double values = {3.0, 5.1, 7.2, 11.3, 2.4); S) (5 points) int values = new int[lOO]; for (int k=0;k<values.length;k++) values[k] = 2*k; 6)(14p0hns) a)’f' b)3 c)—l d)7 e)l4 D “ngBCDEFG” g)"cdef" 7) (10 points) public int findMinPosition(double v) { double minPos = 0; if (v.1ength == 0) return -1; ‘ k 3 for (int j=1;k<v.length;k++) J}: (in) ¥~¢\'. k4V'\0“'fh I *1 if (v[minPos] < v[k]) J (v E mx’n'?o$1 7 v E K3) minPos = k; return minPos; 8) (10 points) public void printArray(int a) { for (int k=0; k< a.length; k++) { System.out.print(a[k]); if (k < a.length - 1) System.out.print(", "); System.out.println(); 9) (20 points) see other side 9) (20 points) 219-4r b 11 y Z Output: 4 11 4 11 4 11 11 7 11 4 11 15 9 15 4 11 9 13 9 4 11 13 13 9 9 11 9 9 15 In? $1 wk 7-1-1- 13 ...
View Full Document

This note was uploaded on 09/21/2009 for the course CS 1713 taught by Professor S.robbins during the Spring '07 term at The University of Texas at San Antonio- San Antonio.

Page1 / 2

cs1713_exam1_sol - CS 1713 Exam 1 Solutions — Fall 2006...

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

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