Dartmouth College Computer Science 10, Fall 2015 Midterm Exam
|
|
- Marcus Merritt
- 6 years ago
- Views:
Transcription
1 Dartmouth College Computer Science 10, Fall 2015 Midterm Exam pm, Monday, October 19, Dartmouth Hall Professor Prasad Jayanti Print your name: Print your section leader name: If you need more space to answer a question, use the other side of the paper, which I have left blank. If you need still more space, you may use additional sheets of paper and attach them to the exam. Make sure that we know where to look for your answer! The exam has 12 pages. Read each question carefully and make sure that you answer everything asked for. Write legibly so that we can read your solutions. Please do not write anything in red. You have until 9.00pm to complete this exam. No extra time is allowed. Question Value Score Total 90
2 CS 10 Fall 2015, Midterm 2 Question 1 14 points (a) (4 points) What is the distinction between an ADT and its implementation? Why is this distinction important? Answer: ADT only specifies the set of methods with which a user can manipulate the object, and what the methods do (from the user s perspective). Implementation defines the code (for the methods) that ensures that the methods behave as specified in the ADT. The distinction makes it possible for the user of the object to write their program without any knowledge of how the object is implemented. Consequently, if the object is implemented differently tomorrow, there will be no need to change the user program (since it only depends on the ADT, and not the implementation, and the ADT has not changed). (b) (10 points) Consider the following pieces of code (you can assume that each class is in a separate file). public class A { public void print() { System.out.println("A"); public class B extends A { public void print() { super.print(); System.out.println("B"); For each of the following fragments of code (one below and four more on the next page), state whether the code fragment is legal. If the code fragment is legal, state (i) whether it illustrates polymorphism, (ii) whether it illustrates dynamic binding, and (iii) what, if anything, is printed. Briefly justify (no more than a phrase or a sentence, where a justification is appropriate). 1. A a = new A(); B b = new B(); a.print(); b.print(); 2. Answer: Legal. Does not illustrate polymorphism. Does not illustrate dynamic binding. Prints: A A B (one letter per line). A a = new B(); B b = new B(); a.print(); b.print();
3 CS 10 Fall 2015, Midterm Answer: Legal. Illustrates polymorphism (a is declared to be a reference to class A object, but references class B object). Illustrate dynamic binding (a.print() executes the print method of class B, even though a is declared to be of class A). Prints: A B A B (one letter per line). A a = new A(); B b = new A(); a.print(); b.print(); Answer: Ilegal (because the subclass variable b cannot be assigned a reference to a superclass object, as in Line 2). A a = new A(); B b = new B(); b = a; b.print(); Answer: Ilegal (because the subclass variable b cannot be assigned a reference to a superclass object, as in Line 3). public void fun(a x) { System.out.println("funA"); public void fun(b x) { System.out.println("funB"); // assume that the following code fragment is in the main method A a = new B(); fun(a); Answer: Legal. Static type checking is used to figure out which method to invoke: since a is declared to be a reference to class A, the first fun method is executed. So, funa gets printed. There is polymorphism because a is declared as reference to class A and assigned a reference to class B. Question 2 20 points (a) (10 points) Consider an ADT whose state is a collection of integers. The ADT supports two operations, specified as follows:
4 CS 10 Fall 2015, Midterm 4 /* Adds e to the collection of integers. */ public void insert(int e) /* If the collection has at least two distinct integers, returns the second largest integer in the collection; else returns -1. For example, if 8, 4, 10, 6, 10, 2, 10 were previously inserted, a call to secondlargest() returns 8. As another example, if 8, 8, 8 are the only integers previously inserted, a call to secondlargest() returns -1 (since there are no two distinct integers in the collection). */ public int secondlargest() Define a class that efficiently implements this ADT. State the running times of your methods in asymptotic notation. (It is not enough for the implementation to be correct: very little credit is awarded unless the implementation is as efficient as possible in terms of both running time and space.) public class MyClass { private int n; // 0, 1, or 2, based on // number of distinct integers inserted so far private int max1; // largest if n > 0 private int max2; // second largest if n > 1 public MyClass() { n = 0; public void insert(int e) { if (n == 0) { max1 = e; n = 1; else if (n == 1) { if (e > max1) { max2 = max1; max1 = e; n = 2; else if (e < max1) { max2 = e; n = 2; else if (e > max1) { max2 = max1; max1 = e;
5 CS 10 Fall 2015, Midterm 5 else if ((e < max1) && (e > max2)) max2 = e; public int secondlargest() { if (n < 2) return -1; else return max2; Each of the above three methods runs in O(1) time. (b) (10 points) Consider the following interface for a stack of integers. public interface MyStackADT { /* adds e to the top of the stack. */ public void push(int e); /* legal only if stack is nonempty; removes and returns top item of stack */ public int pop(); /* returns true if the stack is empty; else returns false */ public boolean isempty(); Write a class that implements the above interface, representing the stack using an array of integers, and expanding the array whenever necessary. State the worst-case running times of your methods in asymptotic notation. public class MyStack implements MyStackADT { private int[] s; private int n; // number of elements in stack public MyStack() { n = 0; s = new int[10]; // Any positive integer works, not just 10 public boolean isempty() { return (n==0);
6 CS 10 Fall 2015, Midterm 6 public int pop() { n = n-1; return s[n]; public void push(int e) { int[] new_s; if (s.length == n) { new_s = new int[2*s.length]; for (int i=0; i < n; i++) new_s[i] = s[i]; s = new_s; s[n] = e; n++; The constructor, isempty, and pop run in O(1) time. The worst-case time of push is O(n). Question 3 20 points Consider the following ADT that maintains a sequence of integers and supports the following three methods. public interface SeqADT { /* inserts e at the front of the sequence */ public void addfirst(int e); /* Removes alternate items from sequence, starting from first. For example, if sequence is a1, a2, a3, a4, a5 before method is called, the sequence would be a2, a4 after the method completes. Similarly, if sequence is a1, a2, a3, a4 before method is called, the sequence would be a2, a4 after the method completes. As a final example, if sequence has only one item before method is called, the sequence would be empty after the method completes. */ public void removealternate(); /* prints the items in the sequence in order, from first to last */ public void print(); (a) (10 points) Write a class S that implements the above interface using a singly linked list with sentinel. Define an
7 CS 10 Fall 2015, Midterm 7 inner class E that has two public instance variables: data (of type int) and next (of type E). Make sure that your class S has only one instance variable sentinel that references the sentinel node. Show the code for only the constructor, addfirst, and removealternate methods (no need to write the code for the print() method). public class S implements SeqADT { private Element sentinel; private class Element { public int data; public Element next; public Element(int d) { data = d; next = null; public S() { sentinel = new Element(0); public void addfirst(int e) { Element x = new Element(e); x.next = sentinel.next; sentinel.next = x; public void removealternate() { Element prev = sentinel; // references node before the node to remove while (prev.next!= null) { prev.next = prev.next.next; prev = prev.next; (b) (10 points) Redo the problem with the sequence represented using a singly linked list without a sentinel. (Again, there is no need to write the code for the print() method.) I require that your class S has only one instance variable. public class S implements SeqADT {
8 CS 10 Fall 2015, Midterm 8 private Element head; // references node containing first item of sequence private class Element { public int data; public Element next; public Element(int d) { data = d; next = null; public S() { head = null; public void addfirst(int e) { Element x = new Element(e); if (head == null) head = x; else { x.next = head; head = x; public void removealternate() { if (head!= null) { head = head.next; // remove first element if (head!= null) { prev = head; // references node before the node to remove while (prev.next!= null) { prev.next = prev.next.next; prev = prev.next; Question 4 20 points In the two problems below, which ask you to write methods for the BinaryTree class, you must assume that there are only three instance variables in the class: data, left, and right. Specifically, there is no instance variable parent. When writing the methods for the following two problems, you are not allowed to introduce any extra instance variables.
9 CS 10 Fall 2015, Midterm 9 To help you recall the instance variables of the BinaryTree class, I am showing below the beginning lines of that class: public class BinaryTree<E> { private E data; private BinaryTree<E> left, right;... (a) (10 points) For the BinaryTree class, write a recursive method public int numtwochildrennodes() that returns the number of nodes in the tree this that have both a left child and a right child. public int numtwochildrennodes() { if ((left==null)&&(right==null)) return 0; else if (left==null) return right.numtwochildrennodes(); else if (right==null) return left.numtwochildrennodes(); else return 1+left.numTwoChildrenNodes()+right.numTwoChildrenNodes(); (b) (10 points) For the BinaryTree class, write a method public int numdeep&highnodes(int d, int h) that returns the number of nodes in the tree this whose depth and height in this are at least d and h, respectively. You might need to define an inner class and a helper method. I require you to use recursion. Recall that the depth of a node x in a tree T is the distance from T s root to x, and the height of x in T is the distance from x to its furthest descendant leaf. private Element { public int num; public int ht; // inner class to help methods return two integers
10 CS 10 Fall 2015, Midterm 10 public Element(int i, j) { num = i; ht = j; // Henceforth, let T denote the tree "this" // returns number of nodes of T whose depth is at least d_limit // and height is at least h_limit public int numdeep&highnodes(int d_limit, int h_limit) { Element x = helper(d_limit, h_limit, 0); return x.num; // When the method is called, the parameters have following values: // cur_d = depth of "this" in T, and // d_limit and h_limit are as described earlier // When the method completes, it returns an element x where // x.num is set to number of nodes in "this" whose depth in T is // at least d_limit and height in T is at least h_limit, and // x.ht is set of height of "this" private Element helper(int d_limit, int h_limit, int cur_h) { Element e1, e2; if (left == null) e1 = new Element(0, -1); else e1 = left.helper(d_limit, h_limit, cur_h+1); if (right == null) e2 = new Element(0, -1); else e2 = right.helper(d_limit, h_limit, cur_h+1); int h = 1 + Math.max(e1.ht, e2.ht); if ((cur_d >= d_limit) && (h >= h_limit)) return new Element(1+e1.num+e2.num, h); else return new Element(e1.num + e2.num, h); Question 5 16 points Write an applet where a dot moves continuously along the periphery of a square. When the mouse is clicked, the dot stops; when the mouse is clicked again, the movement resumes; if the mouse is clicked once more, the dot stops again. Thus, each mouse click pauses or restarts the dot s motion; in the beginning the dot is in motion. Here is some useful information that you already know, but I am repeating to help you recall. The constructor for the Timer class takes two parameters an integer and a reference to an
11 CS 10 Fall 2015, Midterm 11 ActionListener object. For instance, if r is a variable that holds a reference to an ActionListener object, the call new Timer(100, r) creates a timer object with two guarantees: (i) once the timer is turned on, it goes off every 100 milliseconds, and (ii) every time the timer goes off, r.actionperformed() gets called. The Timer class supports start(), stop(), isrunning() methods. You must call repaint() after you make changes to the representation of what appears in the Applet window. I have supplied the beginning lines of the code. Some of these lines might be incomplete, so complete them if necessary. And, of course, add many more lines to complete the applet class. The meaning of the constants in my code are as follows: X_TOP_LEFT, Y_TOP_LEFT are the x and y coordinates of the top left corner of the square. SIDE is the length (in pixels) of each side of the square. DT denotes how often the drawing should be updated (when the point is in motion) to create the illusion of continuous movement; its unit is milliseconds. Specifically, when the point is in motion, it should be redrawn at the appropriate location every DT milliseconds. SPEED denotes the distance (in pixels) that the point travels per second. DOT_RADIUS is the radius of the dot (in pixels). public class MyApplet extends JApplet implements ActionListener, MouseListener { private final int X_TOP_LEFT = 100; private final int Y_TOP_LEFT = 100; private final int SIDE = 200; private final int DT = 50; private final int SPEED = 300; private final int DOT_RADIUS = 5; private int len; // distance traveled modulo square s perimeter private Timer timer; // draws the dot on page with center at (x,y) private void drawdot(graphics page, int x, int y) { page.filloval(x-dot_radius, y-dot_radius, 2*DOT_RADIUS, 2*DOT_RADIUS); public void init() { setsize(500, 500); // set size of applet window setvisible(true); addmouselistener(this); (getcontentpane()).add(new MyPanel());
12 CS 10 Fall 2015, Midterm 12 len = 0; timer = new Timer(DT, this); timer.start(); repaint(); public void actionperformed(actionevent e) { len = (len + SPEED * DT/1000) % (4*SIDE); repaint(); public void mouseclicked(mouseevent e) { if (timer.isrunning()) timer.stop(); else timer.start(); public void mousepressed(mouseevent e) { public void mousereleased(mouseevent e) { public void mouseentered(mouseevent e) { public void mouseexited(mouseevent e) { private class MyPanel extends JPanel { public void paintcomponent(graphics page) { super.paintcomponent(page); int segment = len/side; // which of the four sides is the point at int x = X_TOP_LEFT; int y = Y_TOP_LEFT; if (segment == 0) x = x + len % SIDE; else if (segment == 1) { x = X_TOP_LEFT + SIDE; y = y + len % SIDE; else if (segment == 2) { x = x + SIDE - len % SIDE; y = Y_TOP_LEFT + SIDE; else y = y + SIDE - len % SIDE; drawdot(page, x, y);
CS 10, Fall 2015, Professor Prasad Jayanti
Problem Solving and Data Structures CS 10, Fall 2015, Professor Prasad Jayanti Midterm Practice Problems We will have a review session on Monday, when I will solve as many of these problems as possible.
More informationDartmouth College Computer Science 10, Winter 2012 Solution to Midterm Exam
Dartmouth College Computer Science 10, Winter 2012 Solution to Midterm Exam Thursday, February 9, 2012 Professor Drysdale Print your name: If you need more space to answer a question than we give you,
More informationCSIS 10A Practice Final Exam Solutions
CSIS 10A Practice Final Exam Solutions 1) (5 points) What would be the output when the following code block executes? int a=3, b=8, c=2; if (a < b && b < c) b = b + 2; if ( b > 5 a < 3) a = a 1; if ( c!=
More informationCS171 Midterm Exam. October 29, Name:
CS171 Midterm Exam October 29, 2012 Name: You are to honor the Emory Honor Code. This is a closed-book and closed-notes exam. You have 50 minutes to complete this exam. Read each problem carefully, and
More informationCS 216 Exam 1 Fall SOLUTION
CS 216 Exam 1 Fall 2004 - SOLUTION Name: Lab Section: Email Address: Student ID # This exam is closed note, closed book. You will have an hour and fifty minutes total to complete the exam. You may NOT
More informationIn addition to the correct answer, you MUST show all your work in order to receive full credit.
In addition to the correct answer, you MUST show all your work in order to receive full credit. Questions Mark: Question1) Multiple Choice Questions /10 Question 2) Binary Trees /15 Question 3) Linked
More informationMULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.
CSIS 10A PRACTICE FINAL EXAM SOLUTIONS Closed Book Closed Computer 3 Sheets of Notes Allowed MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) What
More informationComputer Science 62. Bruce/Mawhorter Fall 16. Midterm Examination. October 5, Question Points Score TOTAL 52 SOLUTIONS. Your name (Please print)
Computer Science 62 Bruce/Mawhorter Fall 16 Midterm Examination October 5, 2016 Question Points Score 1 15 2 10 3 10 4 8 5 9 TOTAL 52 SOLUTIONS Your name (Please print) 1. Suppose you are given a singly-linked
More informationInheritance. One class inherits from another if it describes a specialized subset of objects Terminology:
Inheritance 1 Inheritance One class inherits from another if it describes a specialized subset of objects Terminology: the class that inherits is called a child class or subclass the class that is inherited
More informationCSSE 220. Event Based Programming. Check out EventBasedProgramming from SVN
CSSE 220 Event Based Programming Check out EventBasedProgramming from SVN Interfaces are contracts Interfaces - Review Any class that implements an interface MUST provide an implementation for all methods
More informationAssignment 2. CS 234 Fall 2018 Sandy Graham. Create()
Assignment 2 CS 234 Fall 2018 Sandy Graham Coverage: Modules 3 and 4. This assignment consists of a written component and a programming component. Please read the course website carefully to ensure that
More informationLargest Online Community of VU Students
WWW.VUPages.com http://forum.vupages.com WWW.VUTUBE.EDU.PK Largest Online Community of VU Students MIDTERM EXAMINATION SEMESTER FALL 2003 CS301-DATA STRUCTURE Total Marks:86 Duration: 60min Instructions
More informationUser interfaces and Swing
User interfaces and Swing Overview, applets, drawing, action listening, layout managers. APIs: java.awt.*, javax.swing.*, classes names start with a J. Java Lectures 1 2 Applets public class Simple extends
More informationCS 61B, Summer 2001 Midterm Exam II Professor Michael Olan
CS 61B, Summer 2001 Midterm Exam II Professor Michael Olan Problem 1 (8 points - 1 pt each parts a.-e., 2 pts part f.) a. Consider the following proof: Suppose f(n) is O(g(n)). From this we know that g(n)
More informationGUI DYNAMICS Lecture July 26 CS2110 Summer 2011
GUI DYNAMICS Lecture July 26 CS2110 Summer 2011 GUI Statics and GUI Dynamics 2 Statics: what s drawn on the screen Components buttons, labels, lists, sliders, menus,... Containers: components that contain
More informationDartmouth College Computer Science 10, Fall 2014 Solution to Final Exam A
Dartmouth College Computer Science 10, Fall 2014 Solution to Final Exam A Professor Drysdale Print your name: If you need more space to answer a question than we give you, you may use the backs of pages
More informationName CPTR246 Spring '17 (100 total points) Exam 3
Name CPTR246 Spring '17 (100 total points) Exam 3 1. Linked Lists Consider the following linked list of integers (sorted from lowest to highest) and the changes described. Make the necessary changes in
More informationCS 61B Spring 2017 Guerrilla Section 4 Worksheet. 11 March 2017
Spring 2017 11 March 2017 Directions: In groups of 4-5, work on the following exercises. Do not proceed to the next exercise until everyone in your group has the answer and understands why the answer is
More informationCS 307 Final Fall 2009
Points off 1 2 3 4 5 6 Total off Net Score CS 307 Final Fall 2009 Name UTEID login name Instructions: 1. Please turn off your cell phones. 2. There are 6 questions on this test. 3. You have 3 hours to
More informationCS134 Spring 2005 Final Exam Mon. June. 20, 2005 Signature: Question # Out Of Marks Marker Total
CS134 Spring 2005 Final Exam Mon. June. 20, 2005 Please check your tutorial (TUT) section from the list below: TUT 101: F 11:30, MC 4042 TUT 102: M 10:30, MC 4042 TUT 103: M 11:30, MC 4058 TUT 104: F 10:30,
More informationMULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR
STUDENT IDENTIFICATION NO MULTIMEDIA COLLEGE JALAN GURNEY KIRI 54100 KUALA LUMPUR FIFTH SEMESTER FINAL EXAMINATION, 2014/2015 SESSION PSD2023 ALGORITHM & DATA STRUCTURE DSEW-E-F-2/13 25 MAY 2015 9.00 AM
More informationCSIS 10A PRACTICE FINAL EXAM Name Closed Book Closed Computer 3 Sheets of Notes Allowed
CSIS 10A PRACTICE FINAL EXAM Name Closed Book Closed Computer 3 Sheets of Notes Allowed MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) What would
More informationCSCI 135 Exam #2 Fundamentals of Computer Science I Fall 2013
CSCI 135 Exam #2 Fundamentals of Computer Science I Fall 2013 Name: This exam consists of 6 problems on the following 6 pages. You may use your two-sided hand-written 8 ½ x 11 note sheet during the exam.
More informationCS 367: Introduction to Data Structures Midterm Sample Questions
LAST NAME (PRINT): FIRST NAME (PRINT): CS 367: Introduction to Data Structures Midterm Sample Questions Friday, July 14 th 2017. 100 points (26% of final grade) Instructor: Meena Syamkumar 1. Fill in these
More information2IS45 Programming
Course Website Assignment Goals 2IS45 Programming http://www.win.tue.nl/~wsinswan/programmeren_2is45/ Rectangles Learn to use existing Abstract Data Types based on their contract (class Rectangle in Rectangle.
More informationCSCI 135 Exam #2 Fundamentals of Computer Science I Fall 2013
CSCI 135 Exam #2 Fundamentals of Computer Science I Fall 2013 Name: This exam consists of 6 problems on the following 6 pages. You may use your two-sided hand-written 8 ½ x 11 note sheet during the exam.
More informationComputer Science II Fall 2009
Name: Computer Science II Fall 2009 Exam #2 Closed book and notes. This exam should have five problems and six pages. Problem 0: [1 point] On a scale of 0 5, where 5 is highest, I think I deserve a for
More informationCIS 120 Programming Languages and Techniques. Final Exam, May 3, 2011
CIS 120 Programming Languages and Techniques Final Exam, May 3, 2011 Name: Pennkey: My signature below certifies that I have complied with the University of Pennsylvania s Code of Academic Integrity in
More informationMultiple choice questions. Answer on Scantron Form. 4 points each (100 points) Which is NOT a reasonable conclusion to this sentence:
Multiple choice questions Answer on Scantron Form 4 points each (100 points) 1. Which is NOT a reasonable conclusion to this sentence: Multiple constructors for a class... A. are distinguished by the number
More informationUNIVERSITY REGULATIONS
CPSC 221: Algorithms and Data Structures Midterm Exam, 2013 February 15 Name: Student ID: Signature: Section (circle one): MWF(201) TTh(202) You have 60 minutes to solve the 5 problems on this exam. A
More informationComputer Science 210 Data Structures Siena College Fall Topic Notes: Trees
Computer Science 0 Data Structures Siena College Fall 08 Topic Notes: Trees We ve spent a lot of time looking at a variety of structures where there is a natural linear ordering of the elements in arrays,
More informationCSE373 Fall 2013, Midterm Examination October 18, 2013
CSE373 Fall 2013, Midterm Examination October 18, 2013 Please do not turn the page until the bell rings. Rules: The exam is closed-book, closed-note, closed calculator, closed electronics. Please stop
More informationComputer Science 62. Midterm Examination
Computer Science 62 Bruce/Mawhorter Fall 16 Midterm Examination October 5, 2016 Question Points Score 1 15 2 10 3 10 4 8 5 9 TOTAL 52 Your name (Please print) 1. Suppose you are given a singly-linked list
More informationCS 120 Fall 2008 Practice Final Exam v1.0m. Name: Model Solution. True/False Section, 20 points: 10 true/false, 2 points each
CS 120 Fall 2008 Practice Final Exam v1.0m Name: Model Solution True/False Section, 20 points: 10 true/false, 2 points each Multiple Choice Section, 32 points: 8 multiple choice, 4 points each Code Tracing
More informationUniversity of Illinois at Urbana-Champaign Department of Computer Science. Second Examination
University of Illinois at Urbana-Champaign Department of Computer Science Second Examination CS 225 Data Structures and Software Principles Fall 2011 9a-11a, Wednesday, November 2 Name: NetID: Lab Section
More informationComputer Science CS221 Test 2 Name. 1. Give a definition of the following terms, and include a brief example. a) Big Oh
Computer Science CS221 Test 2 Name 1. Give a definition of the following terms, and include a brief example. a) Big Oh b) abstract class c) overriding d) implementing an interface 10/21/1999 Page 1 of
More informationComputer Science 210: Data Structures. Intro to Java Graphics
Computer Science 210: Data Structures Intro to Java Graphics Summary Today GUIs in Java using Swing in-class: a Scribbler program READING: browse Java online Docs, Swing tutorials GUIs in Java Java comes
More informationMidterm Exam (REGULAR SECTION)
Data Structures (CS 102), Professor Yap Fall 2014 Midterm Exam (REGULAR SECTION) October 28, 2014 Midterm Exam Instructions MY NAME:... MY NYU ID:... MY EMAIL:... Please read carefully: 0. Do all questions.
More informationCS 314 Final Fall 2012
Points off 1 2A 2B 2C 3 4A 4B 5 Total off Net Score CS 314 Final Fall 2012 Your Name_ Your UTEID Instructions: 1. There are 5 questions on this exam. The raw point total on the exam is 110. 2. You have
More informationCSCI 102L - Data Structures Midterm Exam #2 Spring 2011
CSCI 102L - Data Structures Midterm Exam #2 Spring 2011 (12:30pm - 1:50pm, Thursday, March 24) Instructor: Bill Cheng ( This exam is closed book, closed notes, closed everything. No cheat sheet allowed.
More informationUniversity of Illinois at Urbana-Champaign Department of Computer Science. Second Examination
University of Illinois at Urbana-Champaign Department of Computer Science Second Examination CS 225 Data Structures and Software Principles Spring 2014 7-10p, Tuesday, April 8 Name: NetID: Lab Section
More informationCOM S 211/ENGRD 211 May 15, 2003
COM S 211/ENGRD 211 May 15, 2003 Final Exam 3:00 PM 5:30 PM Information: Name (clearly print last, first, middle): Net ID: CU ID: I have followed the rules of academic integrity on this exam (sign): Instructions:
More informationSection 1: True / False (2 points each, 30 pts total)
Section 1: True / False (2 points each, 30 pts total) Circle the word TRUE or the word FALSE. If neither is circled, both are circled, or it impossible to tell which is circled, your answer will be considered
More informationDartmouth College Computer Science 10, Fall 2014 Midterm Exam
Dartmouth College Computer Science 10, Fall 2014 Midterm Exam Thursday, October 23, 2014 Professor Drysdale Print your name: If you need more space to answer a question than we give you, you may use the
More informationCourse Review for. Cpt S 223 Fall Cpt S 223. School of EECS, WSU
Course Review for Midterm Exam 1 Cpt S 223 Fall 2011 1 Midterm Exam 1 When: Friday (10/14) 1:10-2pm Where: in class Closed book, closed notes Comprehensive Material for preparation: Lecture slides & in-class
More informationCIS 120 Midterm II November 8, 2013 SOLUTIONS
CIS 120 Midterm II November 8, 2013 SOLUTIONS 1 1. Facts about OCaml and Java (15 points) For each part, circle true or false. a. T F The.equals method in Java is roughly similar to OCaml s = operator.
More informationCIS Fall Data Structures Midterm exam 10/16/2012
CIS 2168 2012 Fall Data Structures Midterm exam 10/16/2012 Name: Problem 1 (30 points) 1. Suppose we have an array implementation of the stack class, with ten items in the stack stored at data[0] through
More informationChapter 1 GUI Applications
Chapter 1 GUI Applications 1. GUI Applications So far we've seen GUI programs only in the context of Applets. But we can have GUI applications too. A GUI application will not have any of the security limitations
More informationGraphical User Interfaces 2
Graphical User Interfaces 2 CSCI 136: Fundamentals CSCI 136: Fundamentals of Computer of Science Computer II Science Keith II Vertanen Keith Vertanen Copyright 2011 Extending JFrame Dialog boxes Overview
More informationPoints off Total off Net Score. CS 314 Final Exam Spring 2016
Points off 1 2 3 4 5 6 Total off Net Score CS 314 Final Exam Spring 2016 Your Name Your UTEID Instructions: 1. There are 6 questions on this test. 100 points available. Scores will be scaled to 300 points.
More informationPractice Midterm 1. Problem Points Score TOTAL 50
CS 120 Software Design I Spring 2019 Practice Midterm 1 University of Wisconsin - La Crosse February 25 NAME: Do not turn the page until instructed to do so. This booklet contains 10 pages including the
More informationCSCI 136 Written Exam #2 Fundamentals of Computer Science II Spring 2015
CSCI 136 Written Exam #2 Fundamentals of Computer Science II Spring 2015 Name: This exam consists of 6 problems on the following 6 pages. You may use your double- sided hand- written 8 ½ x 11 note sheet
More informationComputer Science Foundation Exam. Dec. 19, 2003 COMPUTER SCIENCE I. Section I A. No Calculators! KEY
Computer Science Foundation Exam Dec. 19, 2003 COMPUTER SCIENCE I Section I A No Calculators! Name: KEY SSN: Score: 50 In this section of the exam, there are Three (3) problems You must do all of them.
More informationCOS 226 Algorithms and Data Structures Fall Midterm
COS 226 Algorithms and Data Structures Fall 2017 Midterm This exam has 10 questions (including question 0) worth a total of 55 points. You have 0 minutes. This exam is preprocessed by a computer, so please
More informationTHE UNIVERSITY OF AUCKLAND
CompSci 101 with answers THE UNIVERSITY OF AUCKLAND FIRST SEMESTER, 2012 Campus: City COMPUTER SCIENCE Principles of Programming (Time Allowed: TWO hours) NOTE: You must answer all questions in this test.
More informationData Structure (CS301)
WWW.VUPages.com http://forum.vupages.com WWW.VUTUBE.EDU.PK Largest Online Community of VU Students Virtual University Government of Pakistan Midterm Examination Spring 2003 Data Structure (CS301) StudentID/LoginID
More information8. Polymorphism and Inheritance
8. Polymorphism and Inheritance Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich http://seal.ifi.uzh.ch/info1 Objectives Describe polymorphism and inheritance in general Define interfaces
More informationExam 1 - (20 points)
Exam 1 - (20 points) Answer all of the following questions. READ EACH QUESTION CAREFULLY. Fill the correct bubble on your scantron sheet. Each correct answer is worth 1 point (unless otherwise stated).
More informationCS61B Spring 2016 Guerrilla Section 3 Worksheet. 12 March 2016
Spring 2016 12 March 2016 Directions: In groups of 4-5, work on the following exercises. Do not proceed to the next exercise until everyone in your group has the answer and understands why the answer is
More informationCIS 120 Midterm II November 8, Name (printed): Pennkey (login id):
CIS 120 Midterm II November 8, 2013 Name (printed): Pennkey (login id): My signature below certifies that I have complied with the University of Pennsylvania s Code of Academic Integrity in completing
More informationCSE373 Winter 2014, Midterm Examination January 29, 2014
CSE373 Winter 2014, Midterm Examination January 29, 2014 Please do not turn the page until the bell rings. Rules: The exam is closed-book, closed-note, closed calculator, closed electronics. Please stop
More informationFINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 ( Marks: 1 ) - Please choose one The data of the problem is of 2GB and the hard
FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 The data of the problem is of 2GB and the hard disk is of 1GB capacity, to solve this problem we should Use better data structures
More informationFINAL EXAMINATION. COMP-250: Introduction to Computer Science - Fall 2011
STUDENT NAME: STUDENT ID: McGill University Faculty of Science School of Computer Science FINAL EXAMINATION COMP-250: Introduction to Computer Science - Fall 2011 December 13, 2011 2:00-5:00 Examiner:
More informationPractice Midterm 1 Answer Key
CS 120 Software Design I Fall 2018 Practice Midterm 1 Answer Key University of Wisconsin - La Crosse Due Date: October 5 NAME: Do not turn the page until instructed to do so. This booklet contains 10 pages
More informationName: I. 20 II. 20 III. 20 IV. 40. CMSC 341 Section 01 Fall 2016 Data Structures Exam 1. Instructions: 1. This is a closed-book, closed-notes exam.
CMSC 341 Section 01 Fall 2016 Data Structures Exam 1 Name: Score Max I. 20 II. 20 III. 20 IV. 40 Instructions: 1. This is a closed-book, closed-notes exam. 2. You have 75 minutes for the exam. 3. Calculators,
More informationCS/ENGRD 2110 SPRING 2018
CS/ENGRD 2110 SPRING 2018 Lecture 7: Interfaces and http://courses.cs.cornell.edu/cs2110 1 2 St Valentine s Day! It's Valentines Day, and so fine! Good wishes to you I consign.* But since you're my students,
More informationCSCI 136 Written Exam #2 Fundamentals of Computer Science II Spring 2012
CSCI 136 Written Exam #2 Fundamentals of Computer Science II Spring 2012 Name: This exam consists of 6 problems on the following 8 pages. You may use your double- sided hand- written 8 ½ x 11 note sheet
More informationUniversity of Waterloo Department of Electrical and Computer Engineering ECE250 Algorithms and Data Structures Fall 2014
University of Waterloo Department of Electrical and Computer Engineering ECE250 Algorithms and Data Structures Fall 2014 Midterm Examination Instructor: Ladan Tahvildari, PhD, PEng, SMIEEE Date: Tuesday,
More informationMIDTERM EXAMINATION Douglas Wilhelm Harder EIT 4018 x T09:30:00P1H20M Rooms: RCH-103 and RCH-302
ECE 250 Algorithms and Data Structures MIDTERM EXAMINATION Douglas Wilhelm Harder dwharder@uwaterloo.ca EIT 4018 x37023 2013-10-23T09:30:00P1H20M Rooms: RCH-103 and RCH-302 Instructions: Read and initial
More informationDesign Patterns: Prototype, State, Composite, Memento
Design Patterns: Prototype, State, Composite, Memento Let s start by considering the CanvasEditor as we had it at the end of the last class. Recall that when a button was clicked, the button s custom ActionListener
More informationUCLA PIC 20A Java Programming
UCLA PIC 20A Java Programming Instructor: Ivo Dinov, Asst. Prof. In Statistics, Neurology and Program in Computing Teaching Assistant: Yon Seo Kim, PIC University of California, Los Angeles, Summer 2002
More informationCS2110 Assignment 3 Inheritance and Trees, Summer 2008
CS2110 Assignment 3 Inheritance and Trees, Summer 2008 Due Sunday July 13, 2008, 6:00PM 0 Introduction 0.1 Goals This assignment will help you get comfortable with basic tree operations and algorithms.
More informationUniversity of Illinois at Urbana-Champaign Department of Computer Science. Second Examination
University of Illinois at Urbana-Champaign Department of Computer Science Second Examination CS 225 Data Structures and Software Principles Spring 2012 7p-9p, Tuesday, April 3 Name: NetID: Lab Section
More informationChapter 6 Introduction to Defining Classes
Introduction to Defining Classes Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives Design and implement a simple class from user requirements. Organize a program in terms of
More informationCSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2013
CSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2013 Name: This exam consists of 5 problems on the following 6 pages. You may use your double-sided hand-written 8 ½ x 11 note sheet
More information3137 Data Structures and Algorithms in C++
3137 Data Structures and Algorithms in C++ Lecture 3 July 12 2006 Shlomo Hershkop 1 Announcements Homework 2 out tonight Please make sure you complete hw1 asap if you have issues, please contact me will
More informationProblem Set 6 Due: 11:59 Sunday, April 29
CS230 Data Structures Handout # 36 Prof. Lyn Turbak Monday, April 23 Wellesley College Problem Set 6 Due: 11:59 Sunday, April 29 Reading: You are expected to read and understand all of the following handouts,
More informationChapter 13 Object Oriented Programming. Copyright 2006 The McGraw-Hill Companies, Inc.
Chapter 13 Object Oriented Programming Contents 13.1 Prelude: Abstract Data Types 13.2 The Object Model 13.4 Java 13.1 Prelude: Abstract Data Types Imperative programming paradigm Algorithms + Data Structures
More informationclass BankFilter implements Filter { public boolean accept(object x) { BankAccount ba = (BankAccount) x; return ba.getbalance() > 1000; } }
9.12) public interface Filter boolean accept(object x); Describes any class whose objects can measure other objects. public interface Measurer double measure(object anobject); This program tests the use
More informationCS 455 Midterm 2 Fall 2017 [Bono] Nov. 7, 2017
Name: USC NetID (e.g., ttrojan): CS 455 Midterm 2 Fall 2017 [Bono] Nov. 7, 2017 There are 6 problems on the exam, with 62 points total available. There are 10 pages to the exam (5 pages double-sided),
More informationCS 314 Exam 2 Spring
Points off 1 2 3 4 5 Total off CS 314 Exam 2 Spring 2017 Your Name Your UTEID Instructions: 1. There are 5 questions on this test. 100 points available. Scores will be scaled to 200 points. 2. You have
More informationCS2 Practical 1 CS2A 22/09/2004
CS2 Practical 1 Basic Java Programming The purpose of this practical is to re-enforce your Java programming abilities. The practical is based on material covered in CS1. It consists of ten simple programming
More informationComputer Science 302 Spring 2007 Practice Final Examination: Part I
Computer Science 302 Spring 2007 Practice Final Examination: Part I Name: This practice examination is much longer than the real final examination will be. If you can work all the problems here, you will
More informationPrelim 1 SOLUTION. CS 2110, September 29, 2016, 7:30 PM Total Question Name Loop invariants. Recursion OO Short answer
Prelim 1 SOLUTION CS 2110, September 29, 2016, 7:30 PM 0 1 2 3 4 5 Total Question Name Loop invariants Recursion OO Short answer Exception handling Max 1 15 15 25 34 10 100 Score Grader 0. Name (1 point)
More informationLargest Online Community of VU Students
WWW.VUPages.com WWW.VUTUBE.EDU.PK http://forum.vupages.com Largest Online Community of VU Students MIDTERM EXAMINATION SEMESTER FALL 2003 CS301-DATA STRUCTURE Total Marks:86 Duration: 60min Instructions
More informationCS 314 Exam 2 Fall 2017
Points off 1 2 3 4 5 Total off CS 314 Exam 2 Fall 2017 Your Name Your UTEID Circle your TAs Name: Gilbert Jacob Jorge Joseph Lucas Rebecca Shelby Instructions: 1. There are 5 questions on this test. 100
More informationMidterm Exam 2 CS 455, Spring 2011
Name: USC loginid (e.g., ttrojan): Midterm Exam 2 CS 455, Spring 2011 March 31, 2011 There are 6 problems on the exam, with 50 points total available. There are 7 pages to the exam, including this one;
More informationSummer Final Exam Review Session August 5, 2009
15-111 Summer 2 2009 Final Exam Review Session August 5, 2009 Exam Notes The exam is from 10:30 to 1:30 PM in Wean Hall 5419A. The exam will be primarily conceptual. The major emphasis is on understanding
More informationCSC 160 LAB 8-1 DIGITAL PICTURE FRAME. 1. Introduction
CSC 160 LAB 8-1 DIGITAL PICTURE FRAME PROFESSOR GODFREY MUGANDA DEPARTMENT OF COMPUTER SCIENCE 1. Introduction Download and unzip the images folder from the course website. The folder contains 28 images
More information1.00/ Introduction to Computers and Engineering Problem Solving. Quiz 2 / November 10, 2005
1.00/1.001 Introduction to Computers and Engineering Problem Solving Quiz 2 / November 10, 2005 Name: Email Address: TA: Section: You have 90 minutes to complete this exam. For coding questions, you do
More informationH212 Introduction to Software Systems Honors
Introduction to Software Systems Honors Lecture #15: October 21, 2015 1/34 Generic classes and types Generic programming is the creation of programming constructs that can be usedwith many different types.
More informationPrelim 1 Solutions. CS 2110, March 10, 2015, 5:30 PM Total Question True False. Loop Invariants Max Score Grader
Prelim 1 Solutions CS 2110, March 10, 2015, 5:30 PM 1 2 3 4 5 Total Question True False Short Answer Recursion Object Oriented Loop Invariants Max 20 15 20 25 20 100 Score Grader The exam is closed book
More informationCSL 201 Data Structures Mid-Semester Exam minutes
CL 201 Data tructures Mid-emester Exam - 120 minutes Name: Roll Number: Please read the following instructions carefully This is a closed book, closed notes exam. Calculators are allowed. However laptops
More informationHW#1: Pencil Me In Status!? How was Homework #1? Reminder: Handouts. Homework #2: Java Draw Demo. 3 Handout for today! Lecture-Homework mapping.
HW#1: Pencil Me In Status!? CS193J: Programming in Java Summer Quarter 2003 Lecture 6 Inner Classes, Listeners, Repaint Manu Kumar sneaker@stanford.edu How was Homework #1? Comments please? SITN students
More informationCOMP 250 Midterm #2 March 11 th 2013
NAME: STUDENT ID: COMP 250 Midterm #2 March 11 th 2013 - This exam has 6 pages - This is an open book and open notes exam. No electronic equipment is allowed. 1) Questions with short answers (28 points;
More informationCPSC 211, Sections : Data Structures and Implementations, Honors Final Exam May 4, 2001
CPSC 211, Sections 201 203: Data Structures and Implementations, Honors Final Exam May 4, 2001 Name: Section: Instructions: 1. This is a closed book exam. Do not use any notes or books. Do not confer with
More informationCS 455 Midterm Exam 1 Fall 2016 [Bono] Thursday, Sept. 29, 2016
Name: USC NetID (e.g., ttrojan): CS 455 Midterm Exam 1 Fall 2016 [Bono] Thursday, Sept. 29, 2016 There are 5 problems on the exam, with 56 points total available. There are 10 pages to the exam (5 pages
More informationECE250: Algorithms and Data Structures Midterm Review
ECE250: Algorithms and Data Structures Midterm Review Ladan Tahvildari, PEng, SMIEEE Associate Professor Software Technologies Applied Research (STAR) Group Dept. of Elect. & Comp. Eng. University of Waterloo
More informationNATIONAL UNIVERSITY OF SINGAPORE
NATIONAL UNIVERSITY OF SINGAPORE SCHOOL OF COMPUTING EXAMINATION FOR CS1020 Semester 2: AY2011/12 CS1020 Data Structures and Algorithms I April 2012 Time allowed: 2 hours Matriculation number: INSTRUCTIONS
More informationUNIVERSITY REGULATIONS
CPSC 221: Algorithms and Data Structures Midterm Exam, 2015 October 21 Name: Student ID: Signature: Section (circle one): MWF(101) TTh(102) You have 90 minutes to solve the 8 problems on this exam. A total
More information