First name (printed): a. DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Similar documents
Spring Semester 13, Dr. Punch. Exam #1 (2/14), form 1 A

First name (printed): a. DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Exam 2, Form A CSE 231 Spring 2014 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Exam 2, Form B CSE 231 Spring 2014 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Fall 08, Sherri Goings, Exam #1 (10/2), form 1 B

Spring Semester 09 Exam #1 Dr. Dillon. (02/19)

Exam #3, Form 3 A CSE 231 Fall 2015 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Exam #1, Form 1 A CSE 231 Spring 2015 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Spring Semester 08, Dr. Punch. Exam #1 (2/12), form 1 B

Spring Semester 08, Dr. Punch. Exam #1 (2/12), form 1 A

Spring Semester 10 Exam #1 Dr. Dillon. (02/18)

Spring Semester 16, Dr. Punch. Exam #1 (2/18), form 1 A

Spring Semester 09 Exam #2 Dr. Dillon. (04/02)

Final Exam, Form 3 A CSE 231 Spring 2015 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Spring Semester 11 Exam #1 Dr. Dillon. (02/15)

Spring Semester, Dr. Punch. Exam #2 (03/28), form 2 C

Exam 1, Form A CSE 231 Fall 2012 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Exam 3, Form A CSE 231 Spring 2014 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Fall Semester, Dr. Punch. Exam #2 (11/07), form 2 A

Exam 2, Form A CSE 231 Spring 2013 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

EXAMINATION INSTRUCTIONS

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY

Part 1 (80 points) Multiple Choice Questions (20 questions * 4 points per question = 80 points)

EXAMINATION INSTRUCTIONS

CS 2316 Exam 1 Spring 2014

EXAMINATION INSTRUCTIONS

Spring 2017 CS 1110/1111 Exam 1

CS 1301 Exam 1 Fall 2009

CS 1301 Exam 1 Fall 2010

Python review. 1 Python basics. References. CS 234 Naomi Nishimura

CS112 Spring 2012 Dr. Kinga Dobolyi. Exam 2. Do not open this exam until you are told. Read these instructions:

PREPARING FOR PRELIM 1

CS 1301 Exam 1 Fall 2010

CSE 115. Introduction to Computer Science I

CS 1301 Exam 1 Answers Fall 2009

THE AUSTRALIAN NATIONAL UNIVERSITY Mid Semester Examination September COMP1730 / COMP6730 Programming for Scientists

Getting Started. Office Hours. CSE 231, Rich Enbody. After class By appointment send an . Michigan State University CSE 231, Fall 2013

Key Differences Between Python and Java

CS 111X - Fall Test 1

In addition to the correct answer, you MUST show all your work in order to receive full credit.

CS 1301 Exam 1 Fall 2014

CS 1301 CS1 with Robots Summer 2007 Exam 1

CS 1301 Exam 1 Spring 2011

Overview of List Syntax

Introduction To Files In Python

CSE 160 Winter 2017: Final Exam

Introduction to: Computers & Programming: Review prior to 1 st Midterm

Student Number: Comments are not required except where indicated, although they may help us mark your answers.

York University AK/ITEC OBJECT-BASED PROGRAMMING. Midterm Test Sample. Examiner: S.Y. Chen Duration: One Hour and Fifteen Minutes

Lecture 7. Memory in Python

CS 1301 Exam 1 Fall 2014

Computer Science Grade 10 Sample -Term 2 Date: February 2018 Time: TBC Duration: 45 minutes

Fundamentals of Programming (Python) Getting Started with Programming

Structure and Interpretation of Computer Programs

CS 1301 Exam 2 Fall 2010

CS 1301 Exam 1 Fall 2011

CS 1110 Prelim 2 April 26th, 2016

York University AS/AK/ITEC INTRODUCTION TO DATA STRUCTURES. Midterm Sample I. Examiner: S. Chen Duration: One Hour and 30 Minutes

CS 1110 Prelim 1 October 15th, 2015

CS 111X - Fall Test 1 - KEY KEY KEY KEY KEY KEY KEY

CS 1301 Exam 1 Spring 2015

CS 1110 Prelim 1 March 15th, 2016

CS 115 Lecture 8. Selection: the if statement. Neil Moore

CS8 Final Exam E03, 09M, Phill Conrad, UC Santa Barbara 09/10/2009

Getting Started with Python

1 Truth. 2 Conditional Statements. Expressions That Can Evaluate to Boolean Values. Williams College Lecture 4 Brent Heeringa, Bill Jannen

CS 1110 Prelim 2 November 13th, 2014

CS 1110 Final, December 8th, Question Points Score Total: 100

Short Answer Questions (40 points)

Version B Final Exam

Introduction to Python and programming. Ruth Anderson UW CSE 160 Winter 2017

CS 303E Fall 2011 Exam 2 Solutions and Criteria November 2, Good Luck!

Midterm Exam 2B Answer key

CS 1301 Exam 1 Spring 2014

Structure and Interpretation of Computer Programs Spring 2017 Mock Midterm 1

EXAMINATION INSTRUCTIONS

Variable and Data Type I

CS 1301 Exam 1 Spring 2014

THE AUSTRALIAN NATIONAL UNIVERSITY Final Examination November COMP1730 / COMP6730 Programming for Scientists

CS4411 Intro. to Operating Systems Exam 1 Fall points 10 pages

CS 1110 Final, December 8th, Question Points Score Total: 100

Advanced topics, part 2

CS 1110 Prelim 2 April 22, 2014

CSSE 120 Introduction to Software Development Practice for Test 1 paper-and-pencil part Page 1 of 6

Conditional Expressions and Decision Statements

CS 115 Exam 1, Fall 2015 Thu. 09/24/2015

Review Sheet for Midterm #1 COMPSCI 119 Professor William T. Verts

CSE 143 Final Exam Part 1 - August 18, 2011, 9:40 am

Structure and Interpretation of Computer Programs

CS 1301 Exam 2 Fall 2013

University of Washington CSE 140 Introduction to Data Programming Winter Midterm exam. February 6, 2013

Test #2 October 8, 2015

CMSC330 Fall 2016 Midterm #1 2:00pm/3:30pm

CSE 160 Spring 2018: Final Exam

Structure and Interpretation of Computer Programs

EXAMINATION INSTRUCTIONS

Control Flow: Loop Statements

CPTS 111, Fall 2011, Sections 6&7 Exam 3 Review

cs1114 REVIEW of details test closed laptop period

Exam 1 Practice CSE 232 Summer 2018 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Transcription:

CSE 231 F 13 Exam #1 Last name (printed): First name (printed): Form 1 X Directions: a. DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN. b. This exam booklet contains 25 questions, each of which will be weighted equally. The exam is worth 100 points (10% of your course grade). c. You may use one 8.5" x 11" note sheet and a paper dictionary during the examination. No calculating devices or other reference materials may be used during the examination. d. Questions will not be interpreted during the examination. e. You should choose the single best alternative for each question, even if you believe that a question is ambiguous or contains a typographic error. If a question has more than one correct answer, full credit will be awarded for any correct answer. f. Please fill in the requested information at the top of this exam booklet. g. Use a #2 pencil to encode any information on the OMR form. h. Please encode the following on the OMR form: -- Last name and first initial -- MSU PID -- Exam form (1 X) i. Please sign the OMR form. j. Only answers recorded on your OMR form will be counted for credit. Completely erase any responses on the OMR form that you wish to delete. k. You must turn in this exam booklet and the OMR form when you have completed the exam. When leaving, please be courteous to those still taking the exam. ******************************************************************************** * Exam Key * * * * 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 * * C B C A E C C B C E E B B D B E B D A A D A A D D * ********************************************************************************

# Figure 1 # X = 7 Y = 2 Z = 6 print( Z + X // Y ) # Line 1 print( X % 5 * Y ) # Line 2 print( 3 + Z ** Y ) # Line 3 print( X / Y + Z ) # Line 4 01. Which of the following statements about the Python code labeled "Line 1" A) It will display 6 when the program is executed. B) It will display 6.5 when the program is executed. C) It will display 9 when the program is executed. D) It will display 9.5 when the program is executed. 02. Which of the following statements about the Python code labeled "Line 2" A) It will display 7 when the program is executed. B) It will display 4 when the program is executed. D) It will display 0 when the program is executed. 03. Which of the following statements about the Python code labeled "Line 3" A) It will display 15 when the program is executed. B) It will display 18 when the program is executed. C) It will display 39 when the program is executed. D) It will display 81 when the program is executed. 04. Which of the following statements about the Python code labeled "Line 4" A) It will display 9.5 when the program is executed. B) It will display 9 when the program is executed. C) It will display 0.875 when the program is executed. D) It will display 0 when the program is executed. 05. Which of the following statements is not valid Python? A) print( str(1.325) ) B) print( int(-5.9) ) C) print( float("1.5e-8") ) D) print( str(618) ) E) print( int("2.7") )

# Figure 2 # A = 2.5 B = 10.0 C = 6 D = 3 print( float( C//4 ) ) # Line 1 print( C > 8 or A < 15.9 ) # Line 2 print( A <= D and B < -C ) # Line 3 print( 10 < 2*C < 20 ) # Line 4 06. Which of the following statements about the Python code labeled "Line 1" C) It will display 1.0 when the program is executed. D) It will display 1.5 when the program is executed. 07. Which of the following statements about the Python code labeled "Line 2" B) It will display False when the program is executed. C) It will display True when the program is executed. D) It will display 15.9 when the program is executed. 08. Which of the following statements about the Python code labeled "Line 3" B) It will display False when the program is executed. C) It will display True when the program is executed. D) It will display -6 when the program is executed. 09. Which of the following statements about the Python code labeled "Line 4" B) It will display False when the program is executed. C) It will display True when the program is executed. D) It will display 20 when the program is executed. 10. Which of the following statements is correct? A) The integer value 0 is equivalent to the Boolean value True. B) The string value "25" is equivalent to the Boolean value False. C) The integer value 1 is equivalent to the Boolean value False. D) The string value "" is equivalent to the Boolean value True. E) The integer value -1 is equivalent to the Boolean value True.

# Figure 3 # A = 0 B = 0 C = 0 D = 0 while (A < 6): D = D + 1 if (D%3 == 0): B = B + 1 elif (D%3 == 1): C = C + 1 A = A + 2 print( A ) # Line 1 print( B ) # Line 2 print( C ) # Line 3 print( D ) # Line 4 11. Which of the following statements about the Python code labeled "Line 1" 12. Which of the following statements about the Python code labeled "Line 2" 13. Which of the following statements about the Python code labeled "Line 3" 14. Which of the following statements about the Python code labeled "Line 4"

# Figure 4 # A = 17 B = 0 C = 0 D = 0 while (A>=3): B += 1 if (A//3*3 == A): C += 1 else: D += 1 A -= 4 print( A ) # Line 1 print( B ) # Line 2 print( C ) # Line 3 print( D ) # Line 4 15. Which of the following statements about the Python code labeled "Line 1" 16. Which of the following statements about the Python code labeled "Line 2" 17. Which of the following statements about the Python code labeled "Line 3" 18. Which of the following statements about the Python code labeled "Line 4"

# Figure 5 # A = "And now for something completely different." B = "And not too expensive!" C = len(a) < len(b) D = A < B print( C, D ) # Line 1 E = "We shall find you a shrubbery." print( E[5], E[-2] ) # Line 2 F = "An African or European swallow?" print( F[3:] ) # Line 3 print( F[:4] ) # Line 4 19. What will be displayed when the Python code labeled "Line 1" in Figure 5 A) False False B) False True C) True False D) True True 20. What will be displayed when the Python code labeled "Line 2" in Figure 5 A) a y B) h r C) a you D) shrubbery. a 21. What will be displayed when the Python code labeled "Line 3" in Figure 5 A) or B) European C) frican or European swallow? D) African or European swallow? 22. What will be displayed when the Python code labeled "Line 4" in Figure 5 A) An A B) An Af C) low? D) llow?

# Figure 6 # try: input_file = open( "infile.txt", "r" ) output_file = open( "outfile.txt", "w" ) except IOError: print( "Here!" ) # Line 1 23. Consider the Python code shown in Figure 6. Under what circumstances will the program display "Here!" (the output produced by Line 1)? A) When the file "infile.txt" does not exist. B) When the file "outfile.txt" does not exist. C) When the file "outfile.txt" exists, but is not empty. D) All of the above. # Figure 7 # def F( X, Y ): # Line 1 X -= 2 Y *= X return X + Y A = 4 B = 7 C = F( A, B ) # Line 2 print( A, B, C ) # Line 3 24. Which of the following statements about the Python code shown in Figure 7 is correct? A) The statement labeled "Line 1" contains a function parameter. B) The statement labeled "Line 2" contains a function invocation. C) The statement labeled "Line 2" contains a function argument. D) All of the above. 25. What will be displayed when the Python code labeled "Line 3" in Figure 7 A) 2 14 11 B) 2 14 16 C) 4 7 11 D) 4 7 16