sampleFinal - CS 177 Spring 2009 Final Exam There are 60...

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: CS 177 Spring 2009 Final Exam There are 60 multiple choice questions. Each one is worth 4 points. The total score for the exam is 240. Answer the multiple choice questions on the bubble sheet given. Fill in the Instructor, Course, Signature, Test, and Date blanks. For Instructor put your RECITATION INSTRUCTORS LAST NAME GIVEN BELOW. For Course put CS 177. For Test put final. Fill in the bubbles that correspond to your name, section and Student ID in the bubble sheet. For your section number, use the SECTION NUMBER of your recitation section. Consult the following list: 001 FRI 07:30 HAAS G066 Pelin Angin 002 FRI 08:30 HAAS G066 Jackie Soenneker 003 FRI 10:30 HAAS G066 Ryan Phelps 004 FRI 02:30 HAAS G066 Yao Zhu 005 FRI 03:30 HAAS G066 Younsun Cho 006 FRI 12:30 HAAS G066 Tion Thomas 016 FRI 11:30 REC 117 Yi-Liu Chao For your student ID, use the 10 digit ID number on your student ID card. DO NOT USE YOUR SOCIAL SECURITY NUMBER! Exams without names will be graded as zero. Only the answers on the bubble sheet will be counted. The questions will be discarded. Recitation Section Number Recitation TAs Name Student Last Name Student First Name Multiple Choice Questions (4 points each): 1. Which of the following is the equivalent of the StdIn.readInt() method? (a) Getting the first argument in the command line arguments using args[0] (b) StdIn.readString() followed by Integer.parseInt() (c) It is not possible to achieve the task this method does in any other way. (d) StdIn.readString() followed by Double.parseDouble() 2. Which of the following best explains the effect of piping two programs using the | operator? (a) Both programs run faster. (b) The output from the first program is fed as input to the second program. (c) The input to the second program is read from the same file providing input to the first program. (d) The output from the second program is written to a file following the output of the first program. 3. How do we represent sound using the StdAudio class in Java? (a) As an array of double values between 0 and 1. (b) As an object of the StdAudio class. (c) As an array of double values between -1 and 1. (d) There is no way to represent sound in Java. 4. Which of the following methods of the StdAudio class is used to play the sound from a file? (a) save(String file, double a) (b) play(int file) (c) play(String file) (d) play(double file) 5. What does the following program do? public class Sum { public static void main( String args ) { int sum = 0; for (int i = 0; i < 10; i++) { int num = StdIn.readInt(); if ( num % 2 == 0 ) { sum += num; } } System.out.println( sum ); } } (a) Prints the sum of the ten numbers input by the user....
View Full Document

This note was uploaded on 02/23/2012 for the course CS 177 taught by Professor Staff during the Spring '08 term at Purdue University-West Lafayette.

Page1 / 19

sampleFinal - CS 177 Spring 2009 Final Exam There are 60...

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

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