sampleE1

sampleE1 - CS 177 Spring 2009 Exam I There are 40 multiple...

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

View Full Document Right Arrow Icon
CS 177 Spring 2009 Exam I There are 40 multiple choice questions. Each one is worth 2.5 points. The total score for the exam is 100. 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 INSTRUCTOR’S LAST NAME GIVEN BELOW. For “Course” put CS 177. For “Test” put exam1. 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 TA’s Name Student Last Name Student First Name
Background image of page 1

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

View Full DocumentRight Arrow Icon
1. Examine the following fragment of code: if(x<10) { if(y>5) System.out.println("non-stop"); else if ( y > 2 ) System.out.println("hip"); else System.out.println("hop"); } If the output of this fragment is hip , what is the most precise statement you can make about the values of x and y ? (a) x is smaller than 10 and y is 2 or smaller. (b) x is smaller than 10 and y is bigger than 5. (c) x is smaller than 10 and y can only be 3, 4, or 5. (d) x is bigger than 10 and no information about the value of y is known. 2. What would be output to the console after the following piece of Java code is executed? boolean test1 = true; boolean test2 = false; boolean test3 = !(test1 || test2) & test1; System.out.print("The answer is "); System.out.print(test3); (a) The answer is 0 (b) The answer is true (c) The answer is false (d) The answer is 3. Which of the following best describes the function of the == operator in Java? (a) It assigns the left operand the same value as the right operand. (b) It compares two operands to determine if they are equal and gives back a boolean . (c) It changes the right operand’s data type to be equal to that of the left operand. (d) It compares two operands to determine if they are equal and gives back an int . 4. What is the purpose of an if -statement in Java? (a) An if -statement allows you to assign a value to a variable. (b) An if -statement allows you to print data onto the screen. (c) An if -statement allows you to execute a block of code if a condition is true. (d) An
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the 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.

Page1 / 13

sampleE1 - CS 177 Spring 2009 Exam I There are 40 multiple...

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