CS 101 Notes 12/2/10 Final Exam: Wednesday, December 8, 2010, from 10:30am-12:30pm in LC-C6 Format is the same as previous exams: * 20 Multiple Choice Questions * 2 "Write Code" Questions Sound topics replacing Picture topics Sound Sample values -32,768 to 32,767 (16 bits or 2 bytes per sound sample) Sampling Rate: 22050 samples per second Common Aglorithms: change volume (multiplication) combine sounds ( addition) join sounds (one sound first another sound after) create sound bite (sound, start pos, end pos) prevent clipping (keeping sample value in range) normalization (create the max possible volume) fade in / fade out echoing a sound reversing a sound change pitch Arrays int array[] = new int [10]; for (int i = 0; i < array.length ; i++) { array[i] = 2 * i; } int x = 0; for (int i = 0; i < array.length ; i = i + 2) { x = x + array[i]; } array[] | Pos: 0 1 2 3 4 5 6 7 8 9 | X i --------------------------------|-------- Val: 0 2 4 6 8 10 12 14 16 18 | 0 0 Make sure you understand Q 1,3,5,6 and 13 from Exam 2. int array[] = new int [10]; for (int i = 0; i < array.length ; i++) { array[i] = 2 * i; } int x = 0; for (int i = 0; i < array.length ; i = i + 2) { array[i] = array[x] + array[x+1]; } array[] | Pos: 0 1 2 3 4 5 6 7 8 9 | X i --------------------------------|-------- initVal: 0 2 4 6 8 10 12 14 16 18 | 0 0 finlVal: 2 2 10 6 18 10 26 14 34 18 int array[] = new int [10]; for (int i = 0; i < array.length ; i++) { array[i] = 2 * i; } int x = 0; for (int i = 0; i < array.length ; i = i + 2) { int temp = array[i]; array [i] = array [array.length - i - 1]; array [array.length - i - 1] = temp } array[] | Pos: 0 1 2 3 4 5 6 7 8 9 | X i --------------------------------|-------- initVal: 0 2 4 6 8 10 12 14 16 18 | 0 0 finlVal: 18 16 14 12 10 8 6 4 2 0 int array[] = new int [10]; for (int i = 0; i < array.length ; i++) { array[i] = 2 * i; } int x = 0; for (int i = 0; i < array.length ; i++) { int temp = array[i]; array [i] = array [array.length - i - 1]; array [array.length - i - 1] = temp } array[] | Pos: 0 1 2 3 4 5 6 7 8 9 | X i --------------------------------|-------- initVal: 0 2 4 6 8 10 12 14 16 18 | 0 0 finlVal: 0 2 4 6 8 10 12 14 16 18 Write Code Questions: Write a method called X that will do .... public static RETURN_TYPE METHOD_NAME ( PARAMETERS ) { Sound s2; return s2; } Call #: 10621