CSE 131 Introduction to Computer Science Fall Final Exam

Similar documents
CSE 131 Introduction to Computer Science Fall Exam II

CSE 131 Introduction to Computer Science Fall Exam II

CSE 131 Introduction to Computer Science Fall Exam I

CSE 131 Introduction to Computer Science Fall Exam I

CSE 131 Introduction to Computer Science Fall Exam II

CSE 131 Introduction to Computer Science Fall Exam I

CSE 131 Introduction to Computer Science Fall 2016 Exam I. Print clearly the following information:

CSE 131 Introduction to Computer Science Fall Exam III

CSE 131S Introduction to Computer Science Summer SON Exam I

CSE 247 Data Structures and Algorithms Fall Exam I

CSE 131S Introduction to Computer Science Summer SON Exam III

COMP 401 Midterm. Tuesday, Oct 18, pm-3:15pm. Instructions

Midterm Exam 2 CS 455, Spring 2015

Spring 2017 CS 1110/1111 Exam 1

Without fully opening the exam, check that you have pages 1 through 11.

CSCI 135 Exam #2 Fundamentals of Computer Science I Fall 2013

CS 111X - Fall Test 1

COS 126 General Computer Science Spring Written Exam 1

Final Exam. Kenneth J. Goldman December 18, Name: Student ID Number: Signature:

Note that there are questions printed on both sides of each page!

2016 Spring COP 3502 Final Exam. Date: 4/28/2016. Name:

Final Exam CS 251, Intermediate Programming December 10, 2014

Final Exam. COMP Summer I June 26, points

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

This exam is open book. Each question is worth 3 points.

CS 3114 Data Structures and Algorithms Test 1 READ THIS NOW!

Midterm Exam CS 251, Intermediate Programming October 8, 2014

CSE351 Winter 2016, Final Examination March 16, 2016

Read this before starting!

CS 455 Final Exam Fall 2015 [Bono] Dec. 15, 2015

CSCI 135 Exam #2 Fundamentals of Computer Science I Fall 2013

Midterm Exam CS 251, Intermediate Programming March 12, 2014

CSE wi Midterm Exam 2/8/18. Name UW ID #

Prelim 1. CS 2110, September 29, 2016, 7:30 PM Total Question Name Loop invariants

CSE 331 Final Exam 6/7/16

Problem Score Max Score 1 Syntax directed translation & type

Instructions. This exam has 7 questions, worth 10 points each. You have 50 minutes.

Csci 102: Sample Exam

CPSC 211, Sections : Data Structures and Implementations, Honors Final Exam May 4, 2001

Department of Electrical Engineering and Computer Sciences Spring 2001 Instructor: Dan Garcia CS 3 Midterm #2. Personal Information

CS 2505 Computer Organization I

Data Structure (CS301)

CSE 331 Spring 2018 Midterm

Activity 11: Designing Classes

(the bubble footer is automatically inserted into this space)

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

CSE 331 Final Exam 3/12/12

Read this before starting!

Page 1 / 3. Page 2 / 18. Page 3 / 8. Page 4 / 21. Page 5 / 15. Page 6 / 20. Page 7 / 15. Total / 100. Pledge:

Read this before starting!

Prelim 2. 5:30 PM, 25 April Total Question Name Short Search/ Collections Trees Graphs. Max Score Grader

CSE 212 : JAVA PROGRAMMING LAB. IV Sem BE (CS&E) (2013) DEPT OF COMPUTER SCIENCE & ENGG. M. I. T., MANIPAL. Prepared By : Approved by :

EECS489 Computer Networks, Take-home Makeup Midterm (Winter 2007) due in class Wednesday 3/28

INSTRUCTIONS TO CANDIDATES

CSCI 200 Lab 11 A Heap-Based Priority Queue

You have 45 minutes to work on this exam. It is a "closed-book/closed-notes" test.

CS 142 Style Guide Grading and Details

CSE 160 Winter 2016: Final Exam

CS/ENGRD 2110 SPRING Lecture 4: The class hierarchy; static components

CIS 110 Introduction to Computer Programming. February 29, 2012 Midterm

Math 52 - Fall Final Exam PART 1

CS 152 Computer Programming Fundamentals Coding Standards

Domain-Driven Design Activity

I. True/False: (2 points each)

Read this before starting!

ENGR 100 Midterm (CSE Part) Winter 2014

Quiz 1 (March 14, 2016)

You must pass the final exam to pass the course.

CSE 160 Winter 2016: Final Exam

Final Exam COMP Fall 2004 Dec 16, 2004

COMP 401 Spring 2014 Midterm 1

CSE030 Fall 2012 Final Exam Friday, December 14, PM

CS 101 Fall 2006 Midterm 3 Name: ID:

COS 226 Algorithms and Data Structures Fall Midterm

ECE Fall 2015, First Exam

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

CMSC 330, Fall 2018 Midterm 1

CS100M November 30, 2000

University of Washington CSE 140 Data Programming Winter Final exam. March 11, 2013

COM S 211/ENGRD 211 May 15, 2003

CSc 328, Spring 2004 Final Examination May 12, 2004

Final Exam CS 152, Computer Programming Fundamentals December 5, 2014

CSCI 135 Exam #1 Fundamentals of Computer Science I Fall 2013

New York University Computer Science Department Courant Institute of Mathematical Sciences

CSCI 102L - Data Structures Midterm Exam #2 Spring 2011

Account joeacct = new Account (100, new Account (500)); Account joeacct = new Account (100, new Account (500, null));

ASSIGNMENT 2. COMP-202A, Fall 2013, All Sections. Due: October 20 th, 2013 (23:59)

Object- Oriented Analysis, Design and Programming

CS 152 Computer Programming Fundamentals Lab 7: Book and Author Objects

Before exam: [! ]. After exam: [! ]. UC Berkeley Computer Science CS61B: Data Structures. Midterm #1, Spring 2015

CS 101 Exam 1 Spring 200 Id Name

Page 1 of 16. Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

CS 111X - Spring Final Exam - KEY

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

CIS 110 Introduction To Computer Programming. October 5th, 2011 Exam 1. Review problems

Prelim 2, CS :30 PM, 25 April Total Question Name Short Search/ Collections Trees Graphs

Final Exam CS 152, Computer Programming Fundamentals December 9, 2016

1 out of 3 points. 2 out of 3 points. 3 out of 8 points. 4 out of 6 points. 5 out of 5 points. 6 out of 6 points. Total. Birthday: Month: Day:

CSE 333 Final Exam 3/19/14

Final Exam CS 251, Intermediate Programming December 13, 2017

Transcription:

CSE 131 Introduction to Computer Science Fall 2017 Given: 16 December 2017 Final Exam Due: End of session This exam is closed-book, closed-notes, no electronic devices allowed. The exception is the sage page on which you may have notes to consult during the exam. Answer questions on the pages of the exam. Do not unstaple the pages of this exam, nor should you attach any other pages to the exam. You are welcome to use the blank space of the exam for any scratch work. Your workmustbelegible. Work that isdifficulttoread willreceive nocredit. Donot dwell over punctuation or exact syntax in code; however, be sure to indent your code to show its structure. You must sign the pledge below for your exam to count. Any cheating will cause the students involved to receive an F for this course. Other action may be taken. If you need to leave the room for any reason prior to turning in your exam, you must leave your exam and any electronic devices with a proctor. You must fill in your identifying information correctly. Failure to do so is grounds for a zero on this exam. The instructors and proctors will not clarify any material on this exam, so please do not ask. Problems can have more than one correct answer. Be sure to state your assumptions and thinking if you want to get partial credit for incorrect responses. Name (print clearly): Print clearly the following information: Student 6-digit ID (one digit per box): Your answers below tell us where to return your graded exam. What time do you arrive in studio/lab? (circle one) 11:30 1:00 2:30 4:00 Which Urbauer lab? (your best guess, circle one) 214 216 218 222 Pledge: On my honor, I have neither given nor received any unauthorized aid on this exam. Signed: (Be sure you filled in your information in the box above!)

CSE 131 (Final Exam) 2 Due by End of session Problem Possible Received Grader Number Points Points Initials 1 20 2 20 3 20 4 20 5 20 Total 100

CSE 131 (Final Exam) 3 Due by End of session 1. (20 points) Letters for you to use to fill in the blanks: a objects f Plankton b methods c constructors d tostring() e equals(object...) g stack h instance variables i static j interface For each statement below, fill in the blank with a letter chosen from the above list. Correct responses may or may not be unique. A given letter may or may not appear in the solution to the statements below. An example is provided, so that you know to use letters as you fill in the blanks. Each response, including the one I give you for free, is worth 2 points. According to Wikipedia, Sheldon J. f is Mr. Krab s arch-nemesis and business rival. He runs a failing restaurant called the Chum Bucket alongside his sentient computer Karen, who is usually the source of his evil plans. His primary goal is to steal the Krabby Pattie secret formula. Some believe that he might have chosen a different, possibly less-evil path, had he taken CSE131. A method cannot reference its classes instance variables. The method is usually written to provide a String that contains information about an instance of its associated class. A class s are responsible for giving birth to an object. While it is special in that regard, it is also just one of a class s. The method is responsible for determining whether two instances of a given object type are viewed as the same. A class s are often described as the has-a s of an object type. The of a software project generally represent the nouns of that project, such as colors, circles, rectangles, etc. When a method is called, it receives its input parameter values from the. Ifthatmethodisreturningavalue,thenitpushesthatvalueontothe just before returning, unless that method is void.

CSE 131 (Final Exam) 4 Due by End of session 2. (20 points) Address Contents Address Contents Address Contents 1000 12 1006-10 1012 4 1001-14 1007-12 1013 2 1002-3 1008 2 1014 12 1003 0 1009 12 1015 12 1004 0 1010 14 1016 24 1005 4 1011 4 1017 4 The above table contains some Foo objects, whose definition is given below: public class Foo { private final int x, y, z; public Foo(int x) { this.x = x; this.y = 12; this.z = x + y; public int bar() { return z / (x-y); public int baz() { return z / (x+y); Continued on next page...

CSE 131 (Final Exam) 5 Due by End of session (a) (4 points) At which address is the object in memory that was created by the constructor call new Foo(2)? (b) (4 points) At which address is the object in memory that was created by the constructor call new Foo(12)? (c) (4 points) At which address is the object in memory such that when bar() is called on that object, a DivideByZero error occurs? (d) (4 points) The attribute final on the instance variables makes certain that all Foo objects are immutable. What does that mean? (e) (4 points) If equality of two Foo objects is based only on the value of x, then which Foo objects (state their addresses) in the memory shown above equal each other? 3. (20 points) Some questions about lists and sets. (a) (10 points) What are the differences between the list and set data types? (b) (10 points) For each of the scenarios below, place an X in the column whose associated abstract data type (ADT) is better suited for the scenario. Scenario List Set The cities you might visit over Winter break The steps you must perform to pack your suitcase The extensions you have completed this semester The books you intend to read over Winter break The classes you are taking Spring semester

CSE 131 (Final Exam) 6 Due by End of session 4. (20 points) Consider the following methods: public static int f(int x, int y) { return x+y; public static int g(int z) { return 7 * z; public static int h(int a, int b) { return b; and the line of code: int answer = h(f(3,4), g(5)); (a) (10 points) Below show the contents of the stack, just prior to h beginning its execution: (b) (5 points) The stack as drawn above has room for 5 elements. During the execution of the above line, what is the maximum number of elements ever on the stack at any given time? (c) (5 points) What is the last value to be popped from the stack after executing the above line of code?

CSE 131 (Final Exam) 7 Due by End of session 5. (20 points) Read over the following description of an object, and then write code for a class to represent the object in the space reamining for this exam. Be sure to include a constructor with the appropriate arguments, instance variables, and methods as indicated in the story. Do not worry about tostring, hashcode, or equals. You are free to make choices about names, types, etc., unless stated otherwise. You are welcome to introduce any other methods or instance variables you need. A Circle has a center, expressed as an x coordinate and a y coordinate, and a radius, expressed as the value r. Once constructed, the properties of a Circle never change. The values x, y, and r must be accessible from a constructed Circle, but they must not be allowed to change. In addition to the accessors mentioned above, a Circle offers the following methods: Circle twiceradius() returns a new Circle with the same center as this one, but with twice the radius of this one. boolean areconcentric(circle other) returns true if and only if the other Circle and this one have the same center. Two Circles are concentric even if they have the same radii. boolean allareconcentric(list<circle> list) returns true if and only if all of the Circles in the supplied list are concentric with this one. For full credit on your solution for this method, your solution must use recursion instead of iteration. Five points will be deducted if your solution is correct but does not use recursion. OK, write your class below and on the back as necessary.

CSE 131 (Final Exam) 8 Due by End of session