CSCI 201L Written Exam #2. 10% of course grade

Similar documents
Final Score ID Extra Credit. 10% of course grade

Final Score Name SOLUTION ID Extra Credit. 10% of course grade

CSCI 201L Final Written SOLUTION. 13% of course grade

Spring % of course grade

Final Score ID Extra Credit. 15% of course grade

Final Score Name SOLUTION ID Extra Credit. 15% of course grade

Final Score ID Extra Credit. 15% of course grade

CSCI 201L Final Written Spring % of course grade

Lab #8 1/8 CSCI 201. Title Networking Worksheet. Lecture Topics Emphasized Networking Theory

CSCI 201L Written Exam #1 Fall % of course grade

12% of course grade. CSCI 201L Final - Written Fall /7

15% of course grade. Final Score ID Extra Credit. Name SOLUTION. Section (circle one): TTh 8:00-9:20 TTh 9:30-10:50 TTh 11:00-12:20

CSCI 201L Written Exam #1 Fall % of course grade

CSCI 201L Written Exam #1 Fall % of course grade

CMSC 433 Section 0101 Fall 2012 Midterm Exam #1

Midterm Exam 2 CS 455, Spring 2015

CSCI 201L Written Exam #1 - SOLUTION Fall % of course grade

CS 455 Midterm Exam 2 Fall 2016 [Bono] November 8, 2016

Principles of Concurrent Programming TDA384/DIT391

CSCI 201L Syllabus Principles of Software Development Spring 2018

Le L c e t c ur u e e 7 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Multithreading

CS 455 Midterm Exam 1 Fall 2016 [Bono] Thursday, Sept. 29, 2016

Final Exam CS 251, Intermediate Programming December 10, 2014

CS 455 Final Exam Fall 2016 [Bono] December 13, 2016

CSCI 136: Fundamentals of Computer Science II. Keith Vertanen Museum

CSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2013

CS 455 Midterm Exam 1 Spring 2015 [Bono] Thursday, Feb. 19, 2015

INTRODUCTION TO SOFTWARE SYSTEMS (COMP1110/COMP1140/COMP1510/COMP6710)

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

CSCI 201L Midterm Written SOLUTION Fall % of course grade

Concurrent Computing CSCI 201 Principles of Software Development

THE UNIVERSITY OF WESTERN AUSTRALIA SAMPLE EXAM QUESTIONS 2007 WITH SOLUTIONS SCHOOL OF COMPUTER SCIENCE CITS3213 CONCURRENT PROGRAMMING (PART II)

CS 450 Exam 2 Mon. 11/7/2016

CSCD 330 Network Programming

San Jose State University - Department of Computer Science

Concurrent Programming TDA381/DIT390

Java Programming Fundamentals - Day Instructor: Jason Yoon Website:

New York University Introduction to Computer Science Exam Sample Problems 2013 Andrew I. Case. Instructions:

CSE 410 Final Exam 6/09/09. Suppose we have a memory and a direct-mapped cache with the following characteristics.

Ryerson University Vers HAL6891A-05 School of Computer Science CPS109 Midterm Test Fall 05 page 1 of 6

Java SE 8 Programming

Midterm Exam 2 CS 455, Spring 2014

Concurrency. CSCI 136: Fundamentals of Computer Science II Keith Vertanen

Monitors CSCI 201 Principles of Software Development

Faculty of Computers & Information Computer Science Department

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

Object Oriented Concepts and Programming (CSC244) By Dr. Tabbasum Naz

CSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2012

CS 455 Final Exam Spring 2018 [Bono] May 8, 2018

CSCD 330 Network Programming

CSCI 1370 APRIL 26, 2017

Consistency: Strict & Sequential. SWE 622, Spring 2017 Distributed Software Engineering

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

Java SE 8 Programming

Concurrency. Fundamentals of Computer Science

1. General Information Course Title: CSCI-605 Advanced Object-Oriented Programming Concepts Instructor: Hans-Peter Bischof Office: Telephone:

Question: Total Points: Score:

Midterm Exam 2 CS 455, Fall 2012

CS 455 Midterm Exam 1 Fall 2017 [Bono] Thursday, Sep. 28, 2017

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

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

Threads and Locks. CSCI 5828: Foundations of Software Engineering Lecture 09 09/22/2015

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

CSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2012

Monitors; Software Transactional Memory

SSC - Concurrency and Multi-threading Java multithreading programming - Synchronisation (II)

News and information! Review: Java Programs! Feedback after Lecture 2! Dead-lines for the first two lab assignment have been posted.!

Part IV Other Systems: I Java Threads

COE318 Lecture Notes Week 13 (Nov 28, 2011)

This exam paper contains 8 questions (12 pages) Total 100 points. Please put your official name and NOT your assumed name. First Name: Last Name:

B2.52-R3: INTRODUCTION TO OBJECT ORIENTATED PROGRAMMING THROUGH JAVA

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

CS61B, Spring 2003 Discussion #17 Amir Kamil UC Berkeley 5/12/03

Assignment 1 due Monday at 11:59pm

CSE 332 Winter 2018 Final Exam (closed book, closed notes, no calculators)

Lecture 8: September 30

COMPSCI 230 Threading Week8. Figure 1 Thread status diagram [

Concurrency CSCI 201 Principles of Software Development

Final review. From threads to file systems

CS2102, B11 Exam 2. Name:

Arrays Classes & Methods, Inheritance

CMSC 331 Second Midterm Exam

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

New York University Introduction to Computer Science Exam Sample Problems 2013 Andrew I. Case. Instructions:

CS111: PROGRAMMING LANGUAGE II

CS 450 Exam 2 Mon. 4/11/2016

Multithreading. Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark

IMPORTANT: Circle the last two letters of your class account:

CSCI 201L Midterm Written Fall % of course grade

Introduction to Programming System Design CSCI 455x (4 Units)

Comp 311: Sample Midterm Examination

Multi-Threaded Programming Design CSCI 201 Principles of Software Development

CSE332 Summer 2010: Final Exam

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

CITS1001 week 4 Grouping objects

Real-Time and Concurrent Programming Lecture 4 (F4): Monitors: synchronized, wait and notify

Final Exam. COMP Summer I June 26, points

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

CS 455 Midterm Exam 1 Spring 2013 [Bono] Feb. 21, 2013

McGraw-Hill The McGraw-Hill Companies, Inc., 2000

Transcription:

Name Final Score ID Extra Credit Section (circle one): MW 3:30-6:30 CSCI 201L Written Exam #2 10% of course grade 1. Anonymous Inner Classes In lecture we walked through the following: 1. Having two classes in different file. 2. Having two classes in the same file. 3. Having one class with the second class inside of it (an inner class). 4. Having one class with the second class inside of one of the methods. 5. Having one class with the second class inside the parameter call to a method with no name (anonymous inner class). a. Give two reasons why a programmer would choose to create an anonymous inner class (#5 above) instead of an inner class inside of a method (#4 above). (0.5% + 0.5%) Reason #1 Reason #2 b. Give two reasons why a programmer would choose to create a class in a different file (#1 above) instead of a class in the same file as another class (#2 above). (0.5% + 0.5%) Reason #1 Reason #2 1/6

2. JDBC JDBC uses reflection to help facilitate Java s motto of write once, run anywhere. a. Explain what reflection is. (0.5%) b. Even though Java tried to create its JDBC framework so that no code has to be changed when you change from one database to another, the implementation unfortunately does not allow this. Explain why. (0.5%) 3. Networking Theory You have started a small web hosting company and you need to get the network set up with many Internet-facing computers. Since you have taken CSCI 201, you know that the best way to do this is to have a static IP address on each of those servers. Assume that you need 27 IP addresses. When you call your ISP, there is a UCLA alumnus working there. You tell him what you want, and he says, One of your IP addresses is 215.76.194.57, but he doesn t tell you anything else. Because you went to USC, you can hopefully answer the following questions though. IP 1101 0111 0100 1100 1100 0010 0011 1001 a. What is the network address? Provide this in the dotted IP notation, not in binary. (0.5%) b. So that you are given the fewest number of IP addresses for your desired purpose, what is the subnet mask? Provide this in the dotted IP notation AND slash notation, not in binary. (0.5% + 0.5%) c. What is the network/subnet address combination? (0.5%) 2/6

4. Databases and SQL Answer the following questions concerning the database below. Here is the Book table. Here is the User table. Here is the CheckedOut table. a. Write the SQL query that returns the following table. (1.0%) 3/6

5. Locks and Conditions Answer the following questions about locks and conditions. a. The type of lock we used in Java was called a ReentrantLock. Explain what a ReentrantLock is and how it is different from a lock that is no reentrant. (0.5%) b. Describe a problem that could arise if a method on a condition was able to be called without first having the lock associated with it. (0.5%) 4/6

6. Multithreading Give three rules that will always be true about the output of the following program. (0.5% + 0.5% + 0.5%) import java.util.arraylist; import java.util.concurrent.semaphore; public class Problem6 extends Thread { public static ArrayList<Integer> al = new ArrayList<Integer>(); public static Semaphore sem = new Semaphore(2); private int num; public Problem6(int num) { this.num = num; public void run() { try { sem.acquire(); System.out.println(num + " starting "); for (int i=0; i < al.size(); i++) { System.out.println(al.get(i)); catch(interruptedexception ie) { finally { System.out.println(num + " ending "); sem.release(); public static void main(string[] args) { for (int i=0; i < 5; i++) { al.add(i); for (int i=0; i < 100; i++) { Problem6 p6 = new Problem6(i); P6.start(); 5/6

7. Monitors and Locks When Java uses the synchronized keyword, it is utilizing monitor functionality. There is also lock functionality in Java through the Lock interface. a. Is the functionality behind a monitor the same as that through an explicit Lock variable? (1.0%) b. Why would a programmer choose to use a Lock instead of a monitor? (0.5%). Extra Credit Question Extra credit is applied after the curve so does not affect other students. 8. Extra Credit We covered six major topics in this class. Rank these six topics in order of what you thought was most useful to least useful. Provide one sentence explaining why you thought the most useful topic was the most useful and one sentence explaining why you thought the least useful topic was the least useful. The topics were: Java porting from C++, GUIs, Software Engineering, Networking, Databases, and Concurrent Programming. (0.25% + 0.25%) #1 (Most Useful) Explanation #2 #3 #4 #5 #6 (Least Useful) Explanation 6/6