SYSC Come to the PASS workshop with your mock exam complete. During the workshop you can work with other students to review your work.

Similar documents
SYSC Come to the PASS workshop with your mock exam complete. During the workshop you can work with other students to review your work.

ECOR Come to the PASS workshop with your mock exam complete. During the workshop you can work with other students to review your work.

SYSC Come to the PASS workshop with your mock exam complete. During the workshop you can work with other students to review your work.

ECOR Come to the PASS workshop with your mock exam complete. During the workshop you can work with other students to review your work.

Monday, October 30, 6pm - 8pm ME 3380 Thursday, November 2, 6pm - 8pm ME 4499

Come to the PASS workshop with your mock exam complete. During the workshop you can work with other students to review your work.

SYSC 2006 CD. Come to the PASS workshop with your mock exam complete. During the workshop you can work with other students to review your work.

PASS$MOCK$EXAM$ $FOR$PRACTICE$ONLY$

JAVA MOCK TEST JAVA MOCK TEST II

Global Gomoku Lab 4 in D0010E

Final Exam CS 251, Intermediate Programming December 13, 2017

This exam is closed textbook(s) and closed notes. Use of any electronic device (e.g., for computing and/or communicating) is NOT permitted.

TO DO: Create a new class which adds statistics to the dice. NOTE: Don t forget to run regression tests

Exam Duration: 2hrs and 30min Software Design

Midterm Exam 2 CS 455, Spring 2011

SSJ User s Guide. Package stat Tools for Collecting Statistics. Version: December 21, 2006

CSCI-142 Exam 1 Review September 25, 2016 Presented by the RIT Computer Science Community

Name: CSC143 Exam 1 1 CSC 143. Exam 1. Write also your name in the appropriate box of the scantron

ENGLISH Page 1 of 6. EXAM IN COURSE TDT4100 Object-Oriented Programming / IT1104 Programming, Advanced Course. Tuesday 29. Mai

CIT Special final examination

Model answers/marking scheme in bold, additional comments in bold italic.

APCS Semester #1 Final Exam Practice Problems

Solution register itself

CS 455 Final Exam Fall 2012 [Bono] Dec. 17, 2012

McGill University School of Computer Science COMP-202A Introduction to Computing 1

CSE 113 A. Announcements - Lab

CS 122/132 Midterm Exam Winter 2003

Queens College, CUNY Department of Computer Science. CS 212 Object-Oriented Programming in Java Practice Exam 2. CS 212 Exam 2 Study Guide

Control Structures II. Repetition (Loops)

Computer Sciences 302 Exam 2 Information & Sample Exam

Review Questions for Final Exam

public static boolean isoutside(int min, int max, int value)

CMP 326 Midterm Fall 2015

Systems Programming. Bachelor in Telecommunication Technology Engineering Bachelor in Communication System Engineering Carlos III University of Madrid

Introduction to Computing II (ITI 1121) Midterm Examination

SYSC 2006 Winter 2012 Linear Collections: Queues

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

Midterm assessment - MAKEUP Fall 2010

EECS 1001 and EECS 1030M, lab 01 conflict

Inheritance. Chapter 7. Chapter 7 1

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

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

Final Exam CS 251, Intermediate Programming December 10, 2014

8. Polymorphism and Inheritance

EECS168 Exam 3 Review

Computer Science II. OO Programming Classes Scott C Johnson Rochester Institute of Technology

University of Massachusetts Amherst, Electrical and Computer Engineering

Java Primer 1: Types, Classes and Operators

CS Exam 1 Review Suggestions

Lecture 5. Lecture

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #1 Examination 12:30 noon, Tuesday, February 14, 2012

UMBC CMSC 331 Final Exam

Module Contact: Dr Taoyang Wu, CMP Copyright of the University of East Anglia Version 1

BSc. (Hons.) Software Engineering. Examinations for / Semester 2

CMSC 433 Section 0101 Fall 2012 Midterm Exam #1

ITI 1120 Lab #9. Slides by: Diana Inkpen, Alan Williams, Daniel Amyot Some original material by Romelia Plesa

COMP 401 Spring 2013 Midterm 1

Binghamton University. CS-140 Fall Problem Solving. Creating a class from scratch

Midterm Exam 5 April 20, 2015

Stacks (5.1) Abstract Data Types (ADTs) CSE 2011 Winter 2011

Exam 1 - (20 points)

FAQ: Classes & Objects

CSCI 136 Written Exam #2 Fundamentals of Computer Science II Spring 2015

Object Oriented Programming with Java

CSE 142, Winter 2007 Final Exam. Name:

CS1 Studio Project: Connect Four

No Aids Allowed. Do not turn this page until you have received the signal to start. Read this entire page or you ll miss the bonus question.

IT 313 Advanced Application Development

Lecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University

Java Classes, Inheritance, and Interfaces

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.

Inheritance. Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L

CSE 142 Sp02 Final Exam Version A Page 1 of 14

CPS122 Lecture: Detailed Design and Implementation

Agenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java

CS 1316 Exam 1 Summer 2009

CS 132 Midterm Exam Winter 2002

public int calculatedamage() { // Generate and return the damage inflicted on ship }

Do not turn to the next page until the start of the exam.

COMP-202: Foundations of Programming. Lecture 26: Review; Wrap-Up Jackie Cheung, Winter 2016

You must pass the final exam to pass the course.

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

CONCORDIA UNIVERSITY Summer 2005 Comp 248 /1 Section AA Introduction to Programming Final Examination/A

CSC-140 Assignment 6

CS 3331 Advanced Object-Oriented Programming. Final Exam

1. Which of the following is the correct expression of character 4? a. 4 b. "4" c. '\0004' d. '4'

COMP102: Test Model Solutions

OBJECTS AND CLASSES CHAPTER. Final Draft 10/30/2011. Slides by Donald W. Smith TechNeTrain.com

Control Statements: Part Pearson Education, Inc. All rights reserved.

G51PGP Programming Paradigms. Lecture 009 Concurrency, exceptions

The JFrame Class Frame Windows GRAPHICAL USER INTERFACES. Five steps to displaying a frame: 1) Construct an object of the JFrame class

CS121/IS223. Object Reference Variables. Dr Olly Gotel

(a) Write the signature (visibility, name, parameters, types) of the method(s) required

CMSC131. Creating a Datatype Class Continued Exploration of Memory Model. Reminders

CS 100J Prelim 2 Have a good break!!! 15 March 2007

Question 0. (out of 01) Question 1. (out of 10) Question 2. (out of 12) Question 3. (out of 12) Question 4. (out of 12) Question 5.

Software and Programming 1

DM503 Programming B. Peter Schneider-Kamp.

Prelim 1 Solutions. CS 2110, March 10, 2015, 5:30 PM Total Question True False. Loop Invariants Max Score Grader

6 The MVC model. Main concepts to be covered. Pattern structure. Using design patterns. Design pattern: Observer. Observers

Transcription:

It is most beneficial to you to write this mock midterm UNDER EXAM CONDITIONS. This means: Complete the Exam in 3 hour(s). Work on your own. Keep your notes and textbook closed. Attempt every question. After the time limit, go back over your work with a different colour or on a separate piece of paper and try to do the questions you are unsure of. Record your ideas in the margins to remind yourself of what you were thinking when you take it up at PASS. The purpose of this mock exam is to give you practice answering questions in a timed setting and to help you to gauge which aspects of the course content you know well and which are in need of further development and review. Use this mock exam as a learning tool in preparing for the actual exam. Please note: Come to the PASS workshop with your mock exam complete. During the workshop you can work with other students to review your work. Often, there is not enough time to review the entire exam in the PASS workshop. Decide which questions you most want to review the Facilitator may ask students to vote on which questions they want to discuss in detail. Facilitators do not bring copies of the mock exam to the session. Please print out and complete the exam before you attend. Facilitators do not produce or distribute an answer key for mock exams. Facilitators help students to work together to compare and assess the answers they have. If you are not able to attend the PASS workshop, you can work alone or with others in the class. Good Luck writing the Mock Exam!! Dates and locations of mock exam take-up: December 15 th, 2017. Location: ME3275

Question 1: Concepts Answer the following questions: 1) Define: Objects, classes 2) What method is responsible for initializing objects? 3) What is unique about an Abstract class? 4) What libraries do we need to import to implement ArrayLists and Random numbers? 5) List 5 classes of GUI

Question 2 In this question, you are going to develop a class called Pl ayer that will be used to collect players into a team using arrays a) This class will use the Rando m class in Java. Write the required code to access the class b) Our class will have five fields: MAX: the maximum size of our collections: a constant to be set to 20 ar : an array of integers curr Max: the current maximum size of our collections (not a constant) count : the current size of the array Define the instance variables:

c) SYSC 2004 Our class has one constructor. This constructor has no parameters. It sets curr Max to a random number between1 and MAX, using a Rando mobject. The array contains a maximum of currma x items. Write the constructor. Javadoc comments are required for full marks public Player()

d) SYSC 2004 Write method addpl ayer which takes a String parameter and returns a boolean. If there is space in the array, the method adds the player to the array, after any other players already present, and returns true. Otherwise, the method returns false. Javadoc comments are required for full marks. e) What changes are required if we insert the String value before any other values already present in the array? Do not re-write the entire method, just modify the code to satisfy the new requirement and explain what it has replaced

f) Write a method call fi ndspecficpl ayer which has a String parameter and returns a boolean. It is to search the array for the given parameter and return true if there is at least one copy in the array, and false otherwise. Javadoc comments are required for full marks. You must use a "for" loop for full marks.

g) SYSC 2004 Write a method call pri nt All Pl ayers which prints all the players in the array. You may use a "for each or a foor loop. Javadoc comments are required for full marks. Question 3 - Inheritance In this question, you are going to develop a subclass class called Bus. Bus is a subclass of class Vehi cl e. Below is the code provided for class Vehi cle and you are required to write the code for the Bus class

public class Vehicles SYSC 2004 private String name; // name of the car private String comp; // the company that manufactured the car private int stock; // number of cars in stock /** * Constructor for objects of class Vehicle * Takes three parameters and sets the * fields based on the parameters entered. * you have to fill in the parameters * Public Vehicle(String name, String comp,int stock ) this.name=name; this.comp=comp; this.stock=stock; /** * getname() returns the name of the Vehicle * * public String getname() return name; /** * getcomp() returns the company the Vehicle was manufactured by public String getcomp() return comp;

/** * getstock() returns the number of Vehicle in stock public int getstock() return stock; /** * addstock() increments the stock of the Vehicle by 1 public void addstock() stock++; /** * removestock() decrements the stock by 1. The stock cannot go below 0. * If the method succeeds in decrementing the stock, it returns true. * If it does not (i.e. stock was already 0) it returns false. * * public boolean removestock() if( stock>=1) stock--; return true; return false; Complete class Bus below: - Write a constructor for class Bus that takes in name, the manufacturer, the stock and the Price. - Write a method that returns the name of the bus - Write a method that returns the stock of the bus - Write a method that adds to the stock of the bus - Write a method removes the stock of the bus - Write a method that returns the price of the stock

public class Bus SYSC 2004 //methods and constructors are omitted

)// end of Class Question 4 UML Diagram In this question, you are going to draw a UML diagram of the Vehicle class and its subclass. Question 5 Test Cases for Bus Class In this question you are going to write test cases for the Bus class, testbus. When answering this question, you are not permitted to add fields, constructors or methods to class Bus. Returns false if the name of the bus is Null The stock of the bus equals 2

The price of the bus equals 3500 Returns Ture if the manufacturer of the bus is TATA Returns false if the name of the bus Civic Public Class testbus

SYSC 2004 Question 6 GUI In this question, you are going to implement a simple GUI. The GUI models a Counter class that was displayed in class. public class CounterController extends JFrame implements ActionListener a) Complete the omitted code //The button that is clicked to increment the counter. //The button that is clicked to decrement the counter. // The button that is clicked to reset the counter to 0. // declare a variable that is of type CounterModel b// create a button panel, add all three button to the panel, // adjust the panel to be located at the centre

c)// register the frame as a listener for the buttons d) // implement the action performed method that will be called when the user clicks on GUI buttons

Reference for Question 6: import java.util.observable; /** * A CounterModel models an up/down integer counter whose value is always >= 0. * Instances of this class can be observed by one or more observers (see * java.util.observer & java.util.observable); these observers are notified

* every time the counter's state changes. SYSC 2004 * * @author D.L. Bailey, Department of Systems and Computer Engineering, * Carleton University. * @version 1.00 March 22, 2005. public class CounterModel extends Observable /** The current value of the counter. private int count; public CounterModel() count = 0; /** Increments the counter by 1. public void increment() count++; setchanged(); notifyobservers();

/** SYSC 2004 * Decrements the counter by 1. Ensures that the counter never * becomes negative. public void decrement() if (count > 0) count--; setchanged(); notifyobservers(); /** Resets the counter to 0. public void reset() count = 0; setchanged(); notifyobservers(); /** * Returns the value stored in this counter.

* @return the current counter value. SYSC 2004 public int value() return count; /** * Returns a String representation of this counter, * @return a String containing the current counter value. public String tostring() return Integer.toString(count);