CS56 Midterm Exam. E01, W16, Phill Conrad, UC Santa Barbara Wednesday, 02/10/2015

Similar documents
E02, W16, Phill Conrad, UC Santa Barbara

CS56 final (E03) W15, Phill Conrad, UC Santa Barbara Wednesday, 03/18/2015. Name: Umail umail.ucsb.edu. Circle one: 4pm 5pm 6pm

CS16 Midterm Exam 2 E02, 09F, Phill Conrad, UC Santa Barbara Wednesday, 11/18/2009

#101 Page: 1 Name: CS32 Midterm Exam. E01, W15, Phill Conrad, UC Santa Barbara

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

***PRACTICE EXAM 02 for*** CS16 Midterm Exam 2 E02, 09F, Phill Conrad, UC Santa Barbara Actual exam scheduled for: 11/18/2009

CS16 Midterm Exam 2 E02, 10W, Phill Conrad, UC Santa Barbara Tuesday, 03/02/2010

CS16 Midterm Exam 1 E01, 10S, Phill Conrad, UC Santa Barbara Wednesday, 04/21/2010, 1pm-1:50pm

CS16 Final Exam E03, 10S, Phill Conrad, UC Santa Barbara Wednesday, 06/09/2010

NOTE: All references to Python on this exam mean Python 3, so you should answer accordingly.

NOTE: All references to Python on this exam mean Python 3, so you should answer accordingly.

CS32 Final Exam. E03, F15, Phill Conrad, UC Santa Barbara

CS32 Final Exam. E03, S15, Phill Conrad, UC Santa Barbara Tuesday, 06/08/2015, 8am 11am

CS32 Midterm Exam E01, F15, Phill Conrad, UC Santa Barbara Wednesday, 10/28/2015, 11am 12:15pm

CS 455 Midterm 2 Spring 2018 [Bono] Apr. 3, 2018

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

CS 113 PRACTICE FINAL

CSE 332 Spring 2013: Midterm Exam (closed book, closed notes, no calculators)

University of Massachusetts Amherst, Electrical and Computer Engineering

Lab5. Wooseok Kim

Final Exam. COMP Summer I June 26, points

I. True/False: (2 points each)

Parameters and Objects

CSE 142, Summer 2013 Midterm Exam, Friday, July 26, 2013

CS 455 Final Exam Fall 2013 [Bono] December 12, 2013

CS 367: Introduction to Data Structures Midterm Sample Questions

Midterm Exam 2 CS 455, Spring 2011

CS 455 Midterm 2 Fall 2017 [Bono] Nov. 7, 2017

5. PLEASE TAKE HOME the question bundle, but turn in 2 paper sheets: The scantron AND the paper where you wrote your programming question solution!

CMSC 331 Second Midterm Exam

Section 003 Fall CS 170 Exam 2. Name (print): Instructions:

Midterm Exam 2 CS 455, Spring 2015

XC Total Max Score Grader

University of Toronto Department of Electrical and Computer Engineering. Midterm Examination. ECE 345 Algorithms and Data Structures Fall 2010

INSTRUCTIONS TO CANDIDATES

Faculty of Science FINAL EXAMINATION COMP-250 A Introduction to Computer Science School of Computer Science, McGill University

CS 3360 Design and Implementation of Programming Languages. Exam 1

CS 116 Week 8 Page 1

CIS 110 Introduction to Computer Programming Summer 2018 Midterm. Recitation ROOM :

Programming Basics. Digital Urban Visualization. People as Flows. ia

CS 112 Midterm Exam Fall 2016

I have neither given nor received any assistance in the taking of this exam.

e01 EXAM: e01: Midterm Exam CS8 F18 Name: Umail 10/24/2018 e01 - Midterm Exam - Gauchospace Gradescope Piazza

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

CS Introduction to Programming Midterm Exam #1 - Prof. Reed Fall 2009

Midterm Exam CS 251, Intermediate Programming October 8, 2014

COMP 524 Spring 2018 Midterm Thursday, March 1

Computer Science E-119 Fall Problem Set 3. Due before lecture on Wednesday, October 31

CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM

Q1 Q2 Q3 Q4 Q5 Total 1 * 7 1 * 5 20 * * Final marks Marks First Question

CS 3360 Design and Implementation of Programming Languages. Exam 1

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012

CS 113 MIDTERM EXAM 2 SPRING 2013

CMPSCI 187 Midterm 1 (Feb 17, 2016)

Examination Questions Midterm 1

Discrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand Midterm 1

CS 455 Final Exam Spring 2017 [Bono] May 10, 2017

CS 1301 Exam 1 Fall 2010

Exam 2. Programming I (CPCS 202) Instructor: M. G. Abbas Malik. Total Marks: 40 Obtained Marks:

Question: Total Points: Score:

Largest Online Community of VU Students

Algorithms & Datastructures Laboratory Exercise Sheet 1

CS3360 Design and Implementation of Programming Languages Final Exam May 16, pm to 12:45pm (2 hour and 40 minutes) NAME:

United States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring AY2017

CS 61BL Data Structures & Programming Methodology

CSE413 Midterm. Question Max Points Total 100

Final Examination May 5, 2005

Practice Midterm 1. Problem Points Score TOTAL 50

CMSC 331 Second Midterm Exam

Lab5. Wooseok Kim

CSE wi: Practice Midterm

CS 2334: Programming Structures and Abstractions: Exam 1 October 3, 2016

Programming II (CS300)

Prelim 1. Solution. CS 2110, 14 March 2017, 7:30 PM Total Question Name Short answer

Prelim One Solution. CS211 Fall Name. NetID

CS 151 Final. Q1 Q2 Q3 Q4 Q5 Total Credit Score. Instructions: Student ID. (Last Name) (First Name) Signature

CIS 110 Introduction to Computer Programming 8 October 2013 Midterm

CS 1301 Exam 1 Fall 2010

YOU ARE ALLOWED TO HAVE ONLY THE FOLLOWING ON YOUR DESK OR WORKTABLE:

Computer Programming, I. Laboratory Manual. Final Exam Solution

Data Structures. BSc in Computer Science University of New York, Tirana. Assoc. Prof. Marenglen Biba 1-1

Building Java Programs

I. True/False: (2 points each)

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

Lecture 14 CSE11 Fall 2013 For loops, Do While, Break, Continue

COS 226 Algorithms and Data Structures Fall Midterm

CS Introduction to Programming Midterm Exam #1 - Prof. Reed Spring 2010

1 Inheritance (8 minutes, 9 points)

Midterm Exam 2 CS 455, Spring 2013

CS143 Final Spring 2016

CS 455 Midterm Exam 1 Spring 2011 [Bono] Feb. 17, 2011

Review sheet for Final Exam (List of objectives for this course)

CSE 373 Autumn 2010: Midterm #1 (closed book, closed notes, NO calculators allowed)

Midterm Exam (REGULAR SECTION)

Midterm II CS164, Spring 2006

CS 61B, Summer 2001 Midterm Exam II Professor Michael Olan

CS 10, Fall 2015, Professor Prasad Jayanti

Midterm Exam. Sample Solutions

CSE 247 Data Structures and Algorithms Fall Exam I

CSE 373 Spring 2010: Midterm #1 (closed book, closed notes, NO calculators allowed)

Transcription:

1 Page: 1 Name: CS56 Midterm Exam E01, W16, Phill Conrad, UC Santa Barbara Wednesday, 02/10/2015 Name: Umail Address: @ umail.ucsb.edu Please write your name above AND AT THE TOP OF EVERY PAGE Please put your pages in order, facing the same way. All the odd pages have dots ( ); these should be upper right, and facing up. All the even numbered pages have crosses ( ) at upper right and should be facing down. Be sure you turn in every page of this exam. Each of the pages is numbered (e.g. Page 1, Page 2, etc.) The last page clearly says "End of Exam". This exam is closed book, closed notes, closed mouth, cell phone off You are permitted one sheet of paper (max size 8.5x11") on which to write notes This sheet will be collected with the exam, and might not be returned Please write your name on your notes sheet

2 Page: 2 Name: 1. (50 pts) In the space below (and on the next page if needed) write the code for the IndexEntryclass according to the instructions on the separate handout provided. There is more room on the next page for your answer if you run out of room here.

3 Page: 3 Name: Extra space for your answer to question 1

4 Page: 4 Name: 2. (10 pts) For each of the following indicate if the line of code involves auto-boxing, and/or auto-unboxing. If a line of code involves both, check both boxes. If it involves neither, check neither box. ASSUME THAT ALL THE LINES OF CODE ARE IN THE SAME mainmethod, CONSECUTIVELY. Code autoboxinunboxing auto- ArrayList<Integer> mylist = new ArrayList<Integer>(); mylist.add(new Integer(7)); mylist.add(2); mylist.add(mylist.get(0)); Integer x = mylist.get(0); int y = mylist.get(1); Integer z = mylist.get(mylist.get(1)); Grading: -2 for each incorrect answer, but no more than -10 total.) 3. (6 pts) (Continued from previous problem). Assume that all of the lines of code in the previous problem appear in a main method, followed by these lines of code. Indicate what the output will be. (Note: If you beleive the the code will throw an exception when run, you do not need to replicate the exact format of the error message as it would appear in the output; an approximation of it is good enough.) System.out.println("x=" + x); System.out.println("y=" + y); System.out.println("z=" + z); 4. (4 pts) Consider the statement: "Java has automatic garbage collection." BRIEFLY, but precisely describe what this statement means.

5 Page: 5 Name: For all the questions on this page: Answer in the context of Java programming The questions are all multiple choice, and provide you with several statements about a variable, ONLY ONE of which is COMPLETELY TRUE. (Some others may be partially true, and partially false.) Choose the one COMPLETELY true answer. 5. (4 pts) Suppose that you have a variable sumof type intdeclared inside the mainmethod of a class. Which statement is completely true about this variable? a. It is a reference variable and it is also a local variable. So the reference is stored on the stack, but the object referred to is on the heap. b. It is a primitive variable, and it is a local variable. So it is stored on the heap. c. It is a primitive variable, and it is a local variable. So it is stored on the stack. d. It is a primitive variable, and it is also an instance variable. So the value is stored on the heap. e. It is a reference variable, and it is also an instance variable. So the reference is stored on the stack, but the object referred to is stored on the heap. 6. (4 pts) This question refers to the IndexEntryclass that you wrote for question 1, which has a private data member called topicof type String. Suppose you instantiate that class in a mainwith this line of code: IndexEntry ie = new IndexEntry("byte",51); Which statement is completely true about the private data member topicof the object ie? a. It is a reference variable and it is also a local variable. So the reference is stored on the stack, but the object referred to is on the heap. b. It is a primitive variable, and it is a local variable. So it is stored on the heap. c. It is a reference variable, and it is also an instance variable. So the reference itself is on the heap, and so is the object to which the reference refers. d. It is a primitive variable, and it is a local variable. So it is stored on the stack. e. It is a primitive variable, and it is also an instance variable. So the value is stored on the heap. f. It is a reference variable, and it is also an instance variable. So the reference is stored on the stack, but the object referred to is stored on the heap. 7. (4 pts) Continuing from the previous question now consider the variable iein the line of code that instantiates IndexEntry the line that we said appears in the mainmethod. Which statement is completely true about ie? a. It is a reference variable and it is also a local variable. So the reference is stored on the stack, but the object referred to is on the heap. b. It is a primitive variable, and it is a local variable. So it is stored on the heap. c. It is a primitive variable, and it is a local variable. So it is stored on the stack. d. It is a primitive variable, and it is also an instance variable. So the value is stored on the heap. e. It is a reference variable, and it is also an instance variable. So the reference is stored on the stack, but the object referred to is stored on the heap.

6 Page: 6 Name: 8. (4 pts) Chris Gaucho wrote this code: Student s = new Student("Phill",1234567); System.out.println("s=" + s); Chris ran the code and got this output: s=student@e13e07 What Chris wanted to see was this: s=(name: Phill, perm: 1234567) What part of Chris' class is missing? You don't need to write the full Java code just explain in English (but using precise Java terminology) what Chris needs to do to fix this problem. 9. The three steps that are typically involved in getting code into a git repo are these. Note that I've put where something normally goes. git add git commit git push origin master a. (4 pts) What typically follows git addon the command line? Briefly describe. (Your description may include an example, but an example alone is NOT ENOUGH for full credit. I want a general description.) b. (4 pts) What typically follows git commiton the command line? Briefly describe. (Your description may include an example, but an example alone is NOT ENOUGH for full credit. I want a general description.) c. (4 pts) What does the git push origin masterstep do that is NOT accomplished by only doing the two previous steps? 10. In C/C++ programming, we used the makeutility to streamline the process of compiling code. a. (1 pts) What is the name of the utility we are using in this course instead of make, because it is more suitable for Java? b. (1 pts) With makewe use a file called Makefileto control our build. What's the corresponding file called with the utility we are using in this course? End of Exam total points=100