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$

Midterm Exam 2 CS 455, Spring 2011

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

EXAM Computer Science 1 Part 1

University of Massachusetts Amherst, Electrical and Computer Engineering

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

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

CS 455 Midterm Exam 1 Fall 2015 [Bono] Thursday, Oct. 1, 2015

COS 126 Exam Review. Exams overview Example programming exam Example written exam questions (part 1)

COMP1008 Object-Oriented Programming 2005 Exam 2.5 Hours

Top-Down Program Development

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

Computer Sciences 302 Exam 2 Information & Sample Exam

Midterm Exam 2 CS 455, Spring 2014

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

Midterm Exam 2 CS 455, Spring 2015

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

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

Midterm Exam 2 CS 455, Spring 2013

COMP 102: Test August, 2017

CMSC 341 Lecture 7 Lists

Lesson 6A Loops. By John B. Owen All rights reserved 2011, revised 2014

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

CSE 113 A. Announcements - Lab

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

(0) introduction to the course. how to learn a programming language. (0) course structure

Midterm Exam 2 CS 455, Fall 2014

CS 122/132 Midterm Exam Winter 2003

JAVA MOCK TEST JAVA MOCK TEST II

CIT Special final examination

Title Description Participants Textbook

COMP Primitive and Class Types. Yi Hong May 14, 2015

CMSC 433 Section 0101 Fall 2012 Midterm Exam #1

COMP-202: Foundations of Programming. Lecture 13: Recursion Sandeep Manjanna, Summer 2015

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

Last Name: Circle One: OCW Non-OCW

CSE 331 Spring 2018 Midterm

EECS168 Exam 3 Review

CSE 142 Su 02 Homework 4

Programming with Java

CSE 241 Algorithms and Data Structures Fall Semester, Midterm Exam

Student Number: Legibly write your name and student number on this page. Legibly write your name on the back page of this exam.

Computer Programming, I. Laboratory Manual. Final Exam Solution

(b) This is a valid identifier in Java: _T_R-U_E_. (c) This is a valid identifier in Java: _F_A_L_$_E_

COMP 102: Test August, 2017

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

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I

Chapter 4: Control structures. Repetition

Programming Fundamentals II (C++ II) Final Exam June 17 th, Sun, 2007

Object Oriented Programming with Java

Final Review Session #2. Brahm Capoor

CS 106A, Lecture 27 Final Exam Review 1

Faculty of Science COMP-202A - Introduction to Computing I (Fall 2008) Midterm Examination

APPLICATION DEVELOPMENT

Chapter 4: Control structures

APCS Semester #1 Final Exam Practice Problems

COMP 102 : Test. 2017, Apr 3

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

COMP 202 Java in one week

CS 455 Midterm Exam 2 Fall 2015 [Bono] Nov. 10, 2015

CS 110 Practice Final Exam originally from Winter, Instructions: closed books, closed notes, open minds, 3 hour time limit.

Midterm Exam 2 CS 455, Fall 2012

COMP 250 Midterm #2 March 11 th 2013

Programming Problems 22nd Annual Computer Science Programming Contest

CSCI 111 Midterm Spring 2014

COMP 102: Test. 2017, May 15 ** WITH SOLUTIONS **

Practice Midterm 1. Problem Points Score TOTAL 50

You must pass the final exam to pass the course.

(c) ((!(a && b)) == (!a!b)) TRUE / FALSE. (f) ((!(a b)) == (!a &&!b)) TRUE / FALSE. (g) (!(!a) && (c-d > 0) && (b!b))

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

CS 132 Midterm Exam Fall 2004

COMP 202 Recursion. CONTENTS: Recursion. COMP Recursion 1

LinkedList Implementation Mini-project intro

Queen s University Faculty of Arts and Science School of Computing CISC 124 Final Examination December 2004 Instructor: M. Lamb

Building Java Programs

Garbage Collection (1)

Do not turn over this examination paper until instructed to do so. Answer all questions.

Curriculum Map Grade(s): Subject: AP Computer Science

Homework Set 2- Class Design

Programming II (CS300)

Examination Questions Midterm 1

CS 2510 Exam 3 SOLUTION Spring 2011

More about BOOLEAN issues

Atomicity and Virtualization. Atomicity. Critical section. Edsger s perspective. Virtualizing a resource requires managing concurrent accesses

COMP-202: Foundations of Programming. Lecture 26: Image Manipulation; Wrap-Up Jackie Cheung, Winter 2015

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

Australian researchers develop typeface they say can boost memory, that could help students cramming for exams.

AP Computer Science Homework Set 1 Fundamentals

BCIS 3630 Dr. GUYNES SPRING 2018 TUESDAY SECTION [JAN version] GRADER COURSE WEBSITE

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

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

COMP-202 Unit 7: More Advanced OOP. CONTENTS: ArrayList HashSet (Optional) HashMap (Optional)

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

Transcription:

It is most beneficial to you to write this mock midterm UNDER EXAM CONDITIONS. This means: Complete the midterm in 1.5 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:

Question 1 In this question, you are going to develop a class called Te mperat ure that will be used to collect data of temperatures 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 10 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) 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 Temperatures() d) Write method addte mp which takes an int parameter and returns a boolean. If there is space in the array, the method adds the int to the array, after any other values 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 int 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 ndte mp Val ue which has an int 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. Do not write Javadoc comments. You must use a "for" loop for full marks. g) Write a method call pri nt All which prints all the values in the array. Do not write Javadoc comments. You must use a "for each loop for full marks.

Question 2 We re going to define a class, Car, which represents a car ( ex: in a showroom). The class contains fields for the name and the company of the car, as well as the number of cars in stock for the particular car In the class definition below, fill in the parameter list for the constructor, and the missing code for the constructors public class Car pri vat e Stri ng na me; // na me of t he car pri vat e Stri ng comp; // the company t hat manufact ured t he car pri vat e i nt st ock; // number of cars in stock

* Constructor for objects of class Car * Takes three parameters and sets the * fields based on the parameters entered. * you have to fill in the parameters * public Car ( ) * getname() returns the name of the car

public String getname() SYSC 2004 by * getcomp() returns the company the car was manufactured public String getcomp() * getstock() returns the number of cars in stock public int getstock()

* addstock() increments the stock of the car by 1 public void addstock() * 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() // end of class

Question 3 Next we re going to put our cars in a showroom! There is one field: an ArrayList which will contain all the cars in the showroom. Fill in the instance variable, the constructor, and the three methods below. (. Keep in mind the equals() method when checking whether two strings are the same. Refer to the final page for a list of ArrayList methods. public class Showroom // define instance variable * Method carindex takes the name and the company of the car being searched for * and returns its index in the carlist * If it doesn't find a car that matches, it returns -1. * (Hint: you can use this method to help you with the next two)

public int carindex (String name, String comp) SYSC 2004 * Method addcar takes one Car parameter. If the Car is already in * the carlist, addcar increases the stock of the Car to reflect * the combined stock of the Cars added and the one already there. If the Car is not already there, addcar adds it to the end of the carlist.

public void addcar (Car newcar) * Method borrowcar takes the name and company of the car to be borrowed * and decrements its stock by 1. If it succeeds in doing this it returns true. * If it can't find the car, or there is no stock to remove it returns false.

public boolean borrowcar (String name,string comp) // end of class