Select the ONE best answer to the question from the choices provided.

Size: px
Start display at page:

Download "Select the ONE best answer to the question from the choices provided."

Transcription

1 FINAL EXAM Introduction to Computer Science UAlbany, Coll. Comp. Info ICSI 201 Spring 2013 Questions explained for post-exam review and future session studying. Closed book/notes with 1 paper sheet of notes. Multiple choice (17 questions, 4 points each) Select the ONE best answer to the question from the choices provided. 1. A Java comment consists of everything from // to the end of the line, or everything between a matching pair of /* and */ sequences. 1 When you put Java code inside a comment: a. The compiler checks the comment for spelling but otherwise ignores it. b. That code is compiled and run just like any other code because the comment simply emphasizes to people that it is important. c. That code, like anything else inside the comment, can be seen by people who look at the program, but is otherwise completely ignored when the program is compiled or run. d. That code is printed when the program is run. The item starts with a reminder of the (correct) syntax for comments. The question is about (1) purposes of comments and (2) about what processing or printing is done when the program is compiled or run: Briefly, NONE!

2 Here is some Java code. What's printed when it runs? (In the first response below, 52 was printed as a 5 and a 2 in a row, not number fiftytwo. Similarly for all the others.) int Adam; int Billi; Adam = 1; Billi = 2; Adam = Billi + 3; //line 5 Billi = Adam + 4; //line 6 System.out.print(Adam); System.out.print(Billi); Tests your skill to carefully simulate code: First, Adam is set to 1. Second, Billi is set to 2. Third, the 2 in Billi is retrieved, added with literal 3 to give 5, and the 5 is stored in Adam. Adam is not changed again before being printed, so what is printed first is 5. Fourth, the 5 just stored in Adam is retrieved, added with literal 4 to get 9, and the 9 is stored in Billi (overwriting the 2 that Billi was set to first). Billi is not changed again before being printed, so what is printed second is What if lines 5 and 6 were interchanged? Billi = Adam + 4; Adam = Billi + 3; a. 37 b. 35 c. 57 d. 58 e. 59 a. 85 b. 58 c. 59 d. 21 e. 55 It's wise to completely repeat your figurings. Perhaps cross out and rewrite to code to avoid confusion. Here is a way to write the computation trace in a diagram. int Adam; int Billi; Adam = 1; Billi = 2; Billi = Adam + 4; //line 6 Adam = Billi + 3; //line 5 System.out.print(Adam); System.out.print(Billi); After Adam = 1; Billi = 2; Adam Billi 2 1 After Billi = Adam + 4; Adam Billi 5 1 After Adam = Billi + 3; Adam Billi 5 8 So what's printed is 85

3 4 4. According to the Mad Ph.D. video, what does the code House reftohouse = new House(); make the computer do? a. Make a new House object and throw away its address or location. b. Make a new House class and save its address or location. c. Make a new House object, make a local variable named reftohouse, and copy that object's address or location into that local variable as its value. d. Same answer as c. except what is made is a class (or blueprint), not an actual House object. new House( ) makes a new House object (whose design or blueprint had been coded in the House class defined in House.java) and returns its address or location. As usual in an assignment, the computation on the RIGHT is done first. The House reftohouse code means make a local variable named reftohouse So, after that, the address or location returned is copied into that local variable as its value. Here is the head of a method definition: public double weightedavg( double n1, double n2, double wgt1 ) 5. One of the method bodies computes and returns the weighted average of the first two double parameter values, with the first value weighted with weight w1, the third parameter value. Pick the one. a. return ( wgt1*n1 + (1.0 wgt1)*n2 ); 5 6 b. return ( (wgt1*n1 + (1.0 wgt1)*n2)/2.0 ); c. return ( 0.5*n *n2 ); d return ( (n1*wgt1) + ((1.0 n1)*wgt2) ); e. return ( wgt1*n wgt1*n2 ); Choice c. is the ordinary average; it is when the weight wgt1 is 0.5 The weights multiplying the numbers n1 and n2 to be averaged must add up to 1.0 So when the weight for n1 is wgt1, the other weight must be (1.0 wgt1)

4 6. Please reconsider the above question. 4 of the 5 choices are in good Java syntax and will compile, but one of the 5 will fail to compile. Which one will fail to compile? (Even though the other 4 are legal and will compile, only one is the correct answer to question 5.) The only variables declared in this question are n1, n2, and wgt1 All the choices have good Java syntax, but just one of the choices has the variable wgt2 which was NOT declared. Hence that one will fail to compile. The other 3 (wrong for question 5) choices recall that code that is useless or wrong from the application's point of view will still be compiled if it has no Java language errors. Such errors are called logical errors as opposed to syntax errors. 7. The full-credit version of Project 5 required that a row of images be copied so they are centered horizontally when they are viewed. Here are 4 computing operations that are involved (among others): C: Actually copy a Picture. I: Make the Picture objects from input files. L: Calculate where to copy the first Picture. W: Calculate (by adding up) the total width. In what order must the computer do these operations? a. C I L W b. I C W L 7 c. I W L C d. L I W C e. other order not shown The final step is copying the picture (C). Preceeding (C), calculating WHERE to copy it must be done (L). The geometric location depends on the total width so (W) must preceed that. The Picture must be made (with new Picture) before getwidth will return its width, so that must be done first a. public int next( int x ) return (x + 1); defines a method and next( 7 ); calls a method. b. public int next( int x ) return (x + 1); calls a method and next( 7 ); defines a method. 9. In the code above: a. x is a parameter value and 7 is a parameter variable. b. x is a parameter variable and 7 is a parameter value.

5 A Java method definition always specifies the type(s) of the parameter varibles (such as int in int x). Only method definitions specify a return value type (such as int in int next) type. Only method definitions can specify properties of the method (such as public). Only method definitions can specify the body of code to be run (The code in... ) at some future time when the method is called. A parameter variable, like any other variable, is named by its name and must be declared (in Java) with its type. A variable can never be a literal number like 7. A situation NOT covered in these two question is a variable whose value is used for the parameter value in a method call. For example, in the code sequence below, invar is a local variable whose value comes from the user and whose value is used as a parameter value. toprint is another local variable whose value is used as a parameter value in another method call. int invar; invar = sc.nextint(); int toprint; toprint = next( invar ); System.out.println(toPrint); For green chromakey substitution, select the correct way to program processing of all the Pixels of the Picture with the green background: a. fors or whiles loop through all those Pixels. A for or while decide whether a color is green enough to substitute. b. fors or whiles loop through all those Pixels. An if decides whether a color is green enough to substitute. c. if statements loop through all those Pixels. A for or while decides whether a color is green enough to substitute. d. if statements loop through all those Pixels. An if statement decides whether a color is green enough to substitute. Just remember: for and while are for loops, and if is for decisions. Here is a mnemonic: "if" is a shorter word than the others.

6 11.Here is a variation of familiar code. It takes the Color of each Pixel from one Picture and copies a brighter version of that Color into the corresponding Pixel of a different Picture. Assume both Pictures have the same width and the same height dimensions. The question asks which is the direction of the copying...put simply, from (a.) A to B, or (b.) from B to A? Picture A = Good code that makes or provides a Picture object ; Picture B = Good code that makes or provides another Picture object ; int y = 0; while (y < A.getHeight()) int x = 0; while (x < A.getWidth()) (B.getPixel(x, y)).setcolor( (A.getPixel(x, y)).getcolor().brighter( ) ); x++; y++; 11 a. The Picture referred to by A is the source of the colors. They are brightened and then copied into the Picture referred to by B. b. The Picture referred to by B is the source of the colors. They are brightened and then copied into the Picture referred to by A. The Pixel whose Color is gotten (by getcolor) is returned when getpixel( ) is called on Picture (referred to by) A. Therefore that Pixel (from Picture A) is the source of the Colors.

7 12 12.When a computer finds the minimum of numbers within an array by processing the elements one at at time, what should it do to decide whether or not to replace the number stored as the minimum found so far? a. In the (... ) of a while or for statement, compare the previous element to the current element. b. In the (... ) of a while or for statement, compare the minimum found so far to the current element. c. In the (... ) of an if statement, compare the previous element to the current element. d. In the (... ) of an if statement, compare the minimum found so far to the current element. First, the decision to replace the minimum found so far with the current element is made, as decisions are typically made, by an if statement, NOT a for or while statement. Second, it is NOT sufficient to decide that the current element is a new minimum based on it being smaller than the preceeding element! (Quite a few beginners think this is so, BUT IT IS NOT!) That is because the current element, even if it is smaller than the preceeding element, might actually be bigger than an EVEN SMALLER element that was somewhere even further preceeding. For example, when the numbers are 1 15, 14; 1 is the smallest although the 14 is smaller than the 15 which immediately preceeds it.

8 13. void plot( int xlocation, int height ) Lab 8 concluded with an assignment to extend G&E's Picture class to a Plotter class by adding the above method to paint a vertical black line at the given x-location with the given height (in pixel units.) Which body is correct? 13 a. for(int y = 0; y < height; y = y + 1) this.getpixel( xlocation, y).setcolor(java.awt.color.black); b. for(int y = 0; y < height; y = y + 1) this.getpixel( y, xlocation).setcolor(java.awt.color.black); c. for(int y = 0; y < height; y = y + 1) this.getpixel( y, y).setcolor(java.awt.color.black); d. for(int y = 0; y < height; y = y + 1) this.getpixel( xlocation, xlocation).setcolor(java.awt.color.black); x x drawn by (a). drawn by (b). y x y x drawn by (c). drawn by (d). y y

9 14. In Lab 8 and many other labs and projects, you extended G&E book classes by coding class definitions like public Plotter extends Picture /* In here, we define a constructor calling a superconstructor, plus we add (public) methods to add our own potential behaviors to Picture objects.*/ Suppose (like in the problem above) you added a public method, like plot. Suppose your application starts with this code: public class App public static void main(string[ ] a) Picture pictr = new Picture( good parameter(s) for constructing a Picture ); Plotter plotr = new Plotter( good parameter(s) for constructing a Plotter ); [Note: (0, 0) are valid parameter values for any call to plot. ] 14 a. On pictr, you can call both plot(0,0) and show( ), and on plotr you can also call both plot(0,0) and show( ). b. On pictr, you cannot call plot(0,0) but you can call show( ), and on plotr you can call both plot(0,0) and show( ). c. On pictr, you can call both plot(0,0) and show( ), and on plotr you cannot call show( ) but you can call plot(0,0). d. On pictr, you cannot call plot(0,0)but you can call show( ), and on plotr, you cannot call show( ) but you can call plot(0,0). 15.When is a constructor method called automatically? (It is special because its name is the same as the name of the class in which the constructor is defined.) a. Before the new operator builds the object. b. Immediately after the new operator builds the object. c. Some time after the rest of the program starts using the object. d. Never automatically: Methods only run when they are called! 15

10 16.Tracing with an array. Suppose the code referring to an array of integers through arr is started with the contents of the array, and k, given on the right. Trace the code using the boxes underneath to carefully determine what a computer would leave in the array when the code finishes. int k; k = 0; while( k < arr.length 1 ) arr[k] = arr[k + 1]; k = k + 1; Now what is stored in the array when the loop finishes? 0 k [0] [1] [2] [3] [4] a. b c d. e

11 17. This question is to analyze what nested loops do; the code is from a lecture and Project 5's Sudoku class definition. public String tostring() String result = ""; /*A*/for( int rowofblocks = 0; rowofblocks < 3; rowofblocks = rowofblocks + 1 ) /*B*/for( int rowinablock = 0; rowinablock < 3; rowinablock = rowinablock + 1 ) /*C*/for( int colofblocks = 0; colofblocks < 3; colofblocks = colofblocks + 1 ) /*D*/for( int colinablock = 0; colinablock < 3; colinablock = colinablock + 1 ) result=result+ board[colofblocks*3+colinablock][rowofblocks*3+rowinablock] + " "; result = result + " "; result = result + "\n"; result = result + "\n"; return result; When the above method is called on a Sudoku (or CheckableSudoko) object, it returns a string that looks like what is on the right: Please consider the Sudoku board as 9 rows consisting of 9 numbers each. One of those 9 rows is circled. One of the 4 for loops, labeled /*A*/, /*B*/, /*C*/, /*D*/, provides the 9 numbers of each row. They are 9 numbers added to the result string each (single) time that (whole) loop is run Which of the 4 loops has this purpose of making a row of 9 numbers? a. /*A*/ b. /*B*/ c. /*C*/ d. /*D*/ (End of the multiple choice questions. The remaining 2 questions are for writing Java code.)

12 (20 points) Coding Complete to code below so that the method finds and then prints each of the following (some steps require one or more loops): 1. The number of ints in the array located by the parameter value. (That is the length of the array, the number of elements.) 2. The smallest int in that array. 3. The location (index or subscript value) where the smallest int is stored*(see footnote). 4. The average of all the ints in that array. You MUST program the printing by filling in the FOUR BLANK SPACES in the last four lines of the method, which we wrote for you. (Correct answers don't refer to this and don't depend on whether the method is static or not.) public void static printstats( int[] array ) System.out.println( Length is + ); System.out.println( Smallest element is + ); System.out.println( Smallest is at index + ); System.out.println( The average is + ); *(Don't worry about two or more array elements storing the same int value. If the minimum is repeated, any index at which a copy is stored is acceptable.)

13 (15 points) More coding. Here's the NumCollector class that plans objects that have an array for collecting numbers (like the House of Project 5 which collected Picture refs.) Your job is to complete the showoffcollection method so it does all 3 things: 1. Prints all the numbers in the collection (must use a loop). 2. Prints how many odd numbers are in the collection, after using a loop to figure out what to print. (Cheat sheet info: ((X % 2) == 0) evaluates to true exactly when X is even.) 3. If ALL 10 numbers in the collection are odd, prints the literal line ALL YOUR NUMBERS ARE ODD. But, if there is one or more even number, it should print instead YOU HAVE AN EVEN NUMBER. public class NumCollector int array; public NumCollector( ) this.array = new int[10]; public void addnumberwhere( int num, int where ) this.array[ where ] = num; public void showoffcollection( )

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!

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! FINAL EXAM Introduction to Computer Science UA-CCI- ICSI 201--Fall13 This is a closed book and note examination, except for one 8 1/2 x 11 inch paper sheet of notes, both sides. There is no interpersonal

More information

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

McGill University School of Computer Science COMP-202A Introduction to Computing 1 McGill University School of Computer Science COMP-202A Introduction to Computing 1 Midterm Exam Thursday, October 26, 2006, 18:00-20:00 (6:00 8:00 PM) Instructors: Mathieu Petitpas, Shah Asaduzzaman, Sherif

More information

Introduction to Computer Science Midterm 3 Fall, Points

Introduction to Computer Science Midterm 3 Fall, Points Introduction to Computer Science Fall, 2001 100 Points Notes 1. Tear off this sheet and use it to keep your answers covered at all times. 2. Turn the exam over and write your name next to the staple. Do

More information

CIS 110 Introduction To Computer Programming. February 29, 2012 Midterm

CIS 110 Introduction To Computer Programming. February 29, 2012 Midterm CIS 110 Introduction To Computer Programming February 29, 2012 Midterm Name: Recitation # (e.g. 201): Pennkey (e.g. bjbrown): My signature below certifies that I have complied with the University of Pennsylvania

More information

5.6.1 The Special Variable this

5.6.1 The Special Variable this ALTHOUGH THE BASIC IDEAS of object-oriented programming are reasonably simple and clear, they are subtle, and they take time to get used to And unfortunately, beyond the basic ideas there are a lot of

More information

AP Computer Science A Summer Assignment 2017

AP Computer Science A Summer Assignment 2017 AP Computer Science A Summer Assignment 2017 The objective of this summer assignment is to ensure that each student has the ability to compile and run code on a computer system at home. We will be doing

More information

CSE 131 Introduction to Computer Science Fall Exam II

CSE 131 Introduction to Computer Science Fall Exam II CSE 131 Introduction to Computer Science Fall 2013 Given: 6 November 2013 Exam II Due: End of session This exam is closed-book, closed-notes, no electronic devices allowed. The exception is the cheat sheet

More information

CS Programming Exercise:

CS Programming Exercise: CS Programming Exercise: An Introduction to Java and the ObjectDraw Library Objective: To demonstrate the use of objectdraw graphics primitives and Java programming tools This lab will introduce you to

More information

Practice Midterm Examination

Practice Midterm Examination Steve Cooper Handout #28 CS106A May 1, 2013 Practice Midterm Examination Midterm Time: Tuesday, May 7, 7:00P.M. 9:00P.M. Portions of this handout by Eric Roberts and Patrick Young This handout is intended

More information

Practice Midterm 1. Problem Points Score TOTAL 50

Practice 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 information

CSCI 111 First Midterm Exam Spring Solutions 09.05am 09.55am, Wednesday, March 14, 2018

CSCI 111 First Midterm Exam Spring Solutions 09.05am 09.55am, Wednesday, March 14, 2018 QUEENS COLLEGE Department of Computer Science CSCI 111 First Midterm Exam Spring 2018 03.14.18 Solutions 09.05am 09.55am, Wednesday, March 14, 2018 Problem 1 Write a complete C++ program that asks the

More information

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics COMP-202 Unit 1: Introduction Announcements Did you miss the first lecture? Come talk to me after class. If you want

More information

CS 101 Spring 2007 Midterm 2 Name: ID:

CS 101 Spring 2007 Midterm 2 Name:  ID: You only need to write your name and e-mail ID on the first page. This exam is CLOSED text book, closed-notes, closed-calculator, closed-neighbor, etc. Questions are worth different amounts, so be sure

More information

Exam 1 - (20 points)

Exam 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 information

Learning Goals LG1: Implement the peer instruction process by A) clicking in on an answer B) discussing with your team C) coming to consensus and

Learning Goals LG1: Implement the peer instruction process by A) clicking in on an answer B) discussing with your team C) coming to consensus and Learning Goals LG1: Implement the peer instruction process by A) clicking in on an answer B) discussing with your team C) coming to consensus and re-clicking in LG2: Describe the difference between the

More information

Lab 9: Creating a Reusable Class

Lab 9: Creating a Reusable Class Lab 9: Creating a Reusable Class Objective This will introduce the student to creating custom, reusable classes This will introduce the student to using the custom, reusable class This will reinforce programming

More information

Object Oriented Programming 2013/14. Final Exam June 20, 2014

Object Oriented Programming 2013/14. Final Exam June 20, 2014 Object Oriented Programming 2013/14 Final Exam June 20, 2014 Directions (read carefully): CLEARLY print your name and ID on every page. The exam contains 8 pages divided into 4 parts. Make sure you have

More information

QUIZ 2 Introduction to Computer Science (COMP 250) Mon. March 2, 2009 Professor Michael Langer

QUIZ 2 Introduction to Computer Science (COMP 250) Mon. March 2, 2009 Professor Michael Langer QUIZ 2 Introduction to Computer Science (COMP 250) Mon. March 2, 2009 Professor Michael Langer STUDENT NAME: ID: The exam consists of five questions. There are a total of 10 points. You may use the back

More information

CS100B: Prelim 3 Solutions November 16, :30 PM 9:00 PM

CS100B: Prelim 3 Solutions November 16, :30 PM 9:00 PM CS100B: Prelim 3 Solutions November 16, 1999 7:30 PM 9:00 PM (Print your name) Statement of integrity: I did not break the rules of academic integrity on this exam: (Signature) (Student ID) Sections 10

More information

6.001 Notes: Section 17.5

6.001 Notes: Section 17.5 6.001 Notes: Section 17.5 Slide 17.5.1 Now, let's look at one example in which changing the evaluation model allows us to explore a very different kind of computational problem. Our goal is to show how

More information

You will not be tested on JUnit or the Eclipse debugger. The exam does not cover interfaces.

You will not be tested on JUnit or the Eclipse debugger. The exam does not cover interfaces. Com S 227 Fall 2016 Topics and review problems for Exam 2 Thursday, November 10, 6:45 pm Locations, by last name: (same locations as Exam 1) A-C Curtiss 0127, first floor only D-N Hoover 2055 O-Z Troxel

More information

You must bring your ID to the exam.

You must bring your ID to the exam. Com S 227 Spring 2017 Topics and review problems for Exam 2 Monday, April 3, 6:45 pm Locations, by last name: (same locations as Exam 1) A-E Coover 2245 F-M Hoover 2055 N-S Physics 0005 T-Z Hoover 1213

More information

AP Computer Science Unit 1. Programs

AP Computer Science Unit 1. Programs AP Computer Science Unit 1. Programs Open DrJava. Under the File menu click on New Java Class and the window to the right should appear. Fill in the information as shown and click OK. This code is generated

More information

Programming Exercise 7: Static Methods

Programming Exercise 7: Static Methods Programming Exercise 7: Static Methods Due date for section 001: Monday, February 29 by 10 am Due date for section 002: Wednesday, March 2 by 10 am Purpose: Introduction to writing methods and code re-use.

More information

Programming for Non-Programmers

Programming for Non-Programmers Programming for Non-Programmers Python Chapter 2 Source: Dilbert Agenda 6:00pm Lesson Begins 6:15pm First Pillow example up and running 6:30pm First class built 6:45pm Food & Challenge Problem 7:15pm Wrap

More information

CS 101 Fall 2006 Midterm 3 Name: ID:

CS 101 Fall 2006 Midterm 3 Name:  ID: You only need to write your name and e-mail ID on the first page. This exam is CLOSED text book, closed-notes, closed-calculator, closed-neighbor, etc. Questions are worth different amounts, so be sure

More information

Slide 1 Side Effects Duration: 00:00:53 Advance mode: Auto

Slide 1 Side Effects Duration: 00:00:53 Advance mode: Auto Side Effects The 5 numeric operators don't modify their operands Consider this example: int sum = num1 + num2; num1 and num2 are unchanged after this The variable sum is changed This change is called a

More information

CIS 110 Introduction to Computer Programming Spring 2016 Midterm

CIS 110 Introduction to Computer Programming Spring 2016 Midterm CIS 110 Introduction to Computer Programming Spring 2016 Midterm Name: Recitation # (e.g., 201): Pennkey (e.g., eeaton): My signature below certifies that I have complied with the University of Pennsylvania

More information

CSE 8A Lecture 8. Reading for next class: 6.1 PSA4: DUE 11:59pm tonight (Collage and Picture Flip) PSA3 Interview, deadline Thursday 2/7 noon!

CSE 8A Lecture 8. Reading for next class: 6.1 PSA4: DUE 11:59pm tonight (Collage and Picture Flip) PSA3 Interview, deadline Thursday 2/7 noon! CSE 8A Lecture 8 Reading for next class: 6.1 PSA4: DUE 11:59pm tonight (Collage and Picture Flip) PSA3 Interview, deadline Thursday 2/7 noon! Exams will promptly be started at beginning of class - Read

More information

6.001 Notes: Section 6.1

6.001 Notes: Section 6.1 6.001 Notes: Section 6.1 Slide 6.1.1 When we first starting talking about Scheme expressions, you may recall we said that (almost) every Scheme expression had three components, a syntax (legal ways of

More information

CONTENTS: While loops Class (static) variables and constants Top Down Programming For loops Nested Loops

CONTENTS: While loops Class (static) variables and constants Top Down Programming For loops Nested Loops COMP-202 Unit 4: Programming with Iterations Doing the same thing again and again and again and again and again and again and again and again and again... CONTENTS: While loops Class (static) variables

More information

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

Lecture 14 CSE11 Fall 2013 For loops, Do While, Break, Continue Lecture 14 CSE11 Fall 2013 For loops, Do While, Break, Continue General Loops in Java Look at other loop constructions Very common while loop: do a loop a fixed number of times (MAX in the example) int

More information

CS Final Exam Review Suggestions - Spring 2014

CS Final Exam Review Suggestions - Spring 2014 CS 111 - Final Exam Review Suggestions p. 1 CS 111 - Final Exam Review Suggestions - Spring 2014 last modified: 2014-05-09 before lab You are responsible for material covered in class sessions, lab exercises,

More information

CISC 1600 Lecture 3.1 Introduction to Processing

CISC 1600 Lecture 3.1 Introduction to Processing CISC 1600 Lecture 3.1 Introduction to Processing Topics: Example sketches Drawing functions in Processing Colors in Processing General Processing syntax Processing is for sketching Designed to allow artists

More information

Sample Final Exam CSE8A Winter 2009: This exam not indicative of actual exam length

Sample Final Exam CSE8A Winter 2009: This exam not indicative of actual exam length Learning Goals LG1: Implement the peer instruction process by A) clicking in on an answer B) discussing with your team C) coming to consensus and re-clicking in LG2: Describe the difference between the

More information

CIS 1068 Design and Abstraction Spring 2017 Midterm 1a

CIS 1068 Design and Abstraction Spring 2017 Midterm 1a Spring 2017 Name: TUID: Page Points Score 1 28 2 18 3 12 4 12 5 15 6 15 Total: 100 Instructions The exam is closed book, closed notes. You may not use a calculator, cell phone, etc. i Some API Reminders

More information

School of Computer Science CPS109 Course Notes Set 7 Alexander Ferworn Updated Fall 15 CPS109 Course Notes 7

School of Computer Science CPS109 Course Notes Set 7 Alexander Ferworn Updated Fall 15 CPS109 Course Notes 7 CPS109 Course Notes 7 Alexander Ferworn Unrelated Facts Worth Remembering The most successful people in any business are usually the most interesting. Don t confuse extensive documentation of a situation

More information

University of Cape Town ~ Department of Computer Science. Computer Science 1015F ~ 2007

University of Cape Town ~ Department of Computer Science. Computer Science 1015F ~ 2007 Name: Please fill in your Student Number and Name. Student Number : Student Number: University of Cape Town ~ Department of Computer Science Computer Science 1015F ~ 2007 Final Examination Question Max

More information

Java3018: Darkening, Brightening, and Tinting the Colors in a Picture *

Java3018: Darkening, Brightening, and Tinting the Colors in a Picture * OpenStax-CNX module: m44234 1 Java3018: Darkening, Brightening, and Tinting the Colors in a Picture * R.G. (Dick) Baldwin This work is produced by OpenStax-CNX and licensed under the Creative Commons Attribution

More information

ISY00245 Principles of Programming. Module 7

ISY00245 Principles of Programming. Module 7 ISY00245 Principles of Programming Module 7 Module 7 Loops and Arrays Introduction This week we have gone through some of the concepts in your lecture, and will be putting them in to practice (as well

More information

CIS 110 Introduction to Computer Programming Summer 2016 Midterm. Recitation # (e.g., 201):

CIS 110 Introduction to Computer Programming Summer 2016 Midterm. Recitation # (e.g., 201): CIS 110 Introduction to Computer Programming Summer 2016 Midterm Name: Recitation # (e.g., 201): Pennkey (e.g., paulmcb): My signature below certifies that I have complied with the University of Pennsylvania

More information

CIS 110 Introduction to Computer Programming Summer 2014 Midterm. Name:

CIS 110 Introduction to Computer Programming Summer 2014 Midterm. Name: CIS 110 Introduction to Computer Programming Summer 2014 Midterm Name: PennKey (e.g., bhusnur4): My signature below certifies that I have complied with the University of Pennsylvania s Code of Academic

More information

CS 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 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 information

Use the scantron sheet to enter the answer to questions (pages 1-6)

Use the scantron sheet to enter the answer to questions (pages 1-6) Use the scantron sheet to enter the answer to questions 1-100 (pages 1-6) Part I. Mark A for True, B for false. (1 point each) 1. Abstraction allow us to specify an object regardless of how the object

More information

CISC 1600, Lab 3.1: Processing

CISC 1600, Lab 3.1: Processing CISC 1600, Lab 3.1: Processing Prof Michael Mandel 1 Getting set up For this lab, we will be using OpenProcessing, a site for building processing sketches online using processing.js. 1.1. Go to https://www.openprocessing.org/class/57767/

More information

A PROGRAM IS A SEQUENCE of instructions that a computer can execute to

A PROGRAM IS A SEQUENCE of instructions that a computer can execute to A PROGRAM IS A SEQUENCE of instructions that a computer can execute to perform some task. A simple enough idea, but for the computer to make any use of the instructions, they must be written in a form

More information

Prelim 1. CS 2110, October 1, 2015, 5:30 PM Total Question Name True Short Testing Strings Recursion

Prelim 1. CS 2110, October 1, 2015, 5:30 PM Total Question Name True Short Testing Strings Recursion Prelim 1 CS 2110, October 1, 2015, 5:30 PM 0 1 2 3 4 5 Total Question Name True Short Testing Strings Recursion False Answer Max 1 20 36 16 15 12 100 Score Grader The exam is closed book and closed notes.

More information

CSE 8A Lecture 20. LAST WEEK! You made it! (Almost ) PSA 9 due tonight (yayy!! Last one) Bring graded Exam #4 to Wed 3/13/13 lecture for review

CSE 8A Lecture 20. LAST WEEK! You made it! (Almost ) PSA 9 due tonight (yayy!! Last one) Bring graded Exam #4 to Wed 3/13/13 lecture for review CSE 8A Lecture 20 LAST WEEK! You made it! (Almost ) PSA 9 due tonight (yayy!! Last one) Bring graded Exam #4 to Wed 3/13/13 lecture for review Graded Exam #4 returned in lab tomorrow Exam #4 Statistics

More information

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger and Josh Hug

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger and Josh Hug UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division CS61B Fall 2014 P. N. Hilfinger and Josh Hug Test #1 (with corrections) READ THIS PAGE FIRST.

More information

CS Problem Solving and Object-Oriented Programming

CS Problem Solving and Object-Oriented Programming CS 101 - Problem Solving and Object-Oriented Programming Lab 5 - Draw a Penguin Due: October 28/29 Pre-lab Preparation Before coming to lab, you are expected to have: Read Bruce chapters 1-3 Introduction

More information

Lab # 2. For today s lab:

Lab # 2. For today s lab: 1 ITI 1120 Lab # 2 Contributors: G. Arbez, M. Eid, D. Inkpen, A. Williams, D. Amyot 1 For today s lab: Go the course webpage Follow the links to the lab notes for Lab 2. Save all the java programs you

More information

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

CSE 373 Spring 2010: Midterm #1 (closed book, closed notes, NO calculators allowed) Name: Email address: CSE 373 Spring 2010: Midterm #1 (closed book, closed notes, NO calculators allowed) Instructions: Read the directions for each question carefully before answering. We may give partial

More information

(a) Assume that in a certain country, tax is payable at the following rates:

(a) Assume that in a certain country, tax is payable at the following rates: 3 1. (Total = 12 marks) (a) Assume that in a certain country, tax is payable at the following rates: 15% on your first $50000 income 25% on any amount over $50000 Write a method that takes in an annual

More information

The newest, most different stuff is Java variable declaration, array syntax, class instance syntax. Expect those to be emphasized.

The newest, most different stuff is Java variable declaration, array syntax, class instance syntax. Expect those to be emphasized. Comp 170 Final Exam Overview. Exam Ground Rules The exam will be closed book, no calculators. You may bring notes on two sides of 8.5x11 inch paper (either both sides of one sheet, or two sheets written

More information

CIS 110 Introduction to Computer Programming 8 October 2013 Midterm

CIS 110 Introduction to Computer Programming 8 October 2013 Midterm CIS 110 Introduction to Computer Programming 8 October 2013 Midterm Name: Recitation # (e.g., 201): Pennkey (e.g., eeaton): My signature below certifies that I have complied with the University of Pennsylvania

More information

Final Exam Practice. Partial credit will be awarded.

Final Exam Practice. Partial credit will be awarded. Please note that this problem set is intended for practice, and does not fully represent the entire scope covered in the final exam, neither the range of the types of problems that may be included in the

More information

CS 115 Exam 3, Spring 2011

CS 115 Exam 3, Spring 2011 CS 115 Exam 3, Spring 2011 Your name: Rules You may use one handwritten 8.5 x 11 cheat sheet (front and back). This is the only resource you may consult during this exam. Explain/show work if you want

More information

Array. Lecture 12. Based on Slides of Dr. Norazah Yusof

Array. Lecture 12. Based on Slides of Dr. Norazah Yusof Array Lecture 12 Based on Slides of Dr. Norazah Yusof 1 Introducing Arrays Array is a data structure that represents a collection of the same types of data. In Java, array is an object that can store a

More information

We will start our journey into Processing with creating static images using commands available in Processing:

We will start our journey into Processing with creating static images using commands available in Processing: Processing Notes Chapter 1: Starting Out We will start our journey into Processing with creating static images using commands available in Processing: rect( ) line ( ) ellipse() triangle() NOTE: to find

More information

CS 1331 Exam 1. Fall Failure to properly fill in the information on this page will result in a deduction of up to 5 points from your exam score.

CS 1331 Exam 1. Fall Failure to properly fill in the information on this page will result in a deduction of up to 5 points from your exam score. CS 1331 Exam 1 Fall 2016 Name (print clearly): GT account (gpburdell1, msmith3, etc): Section (e.g., B1): Signature: Failure to properly fill in the information on this page will result in a deduction

More information

Question Points Score

Question Points Score CS 453 Introduction to Compilers Midterm Examination Spring 2009 March 12, 2009 75 minutes (maximum) Closed Book You may use one side of one sheet (8.5x11) of paper with any notes you like. This exam has

More information

CSE 142 Sp02 Final Exam Version A Page 1 of 14

CSE 142 Sp02 Final Exam Version A Page 1 of 14 CSE 142 Sp02 Final Exam Version A Page 1 of 14 Basic reference information about collection classes that you may find useful when answering some of the questions. Methods common to all collection classes

More information

Practice Midterm Examination

Practice Midterm Examination Mehran Sahami Handout #28 CS106A October 23, 2013 Practice Midterm Examination Midterm Time: Tuesday, October 29th, 7:00P.M. 9:00P.M. Midterm Location (by last name): Last name starts with A-L: go to Dinkelspiel

More information

Final Exam. COMP Summer I June 26, points

Final Exam. COMP Summer I June 26, points Final Exam COMP 14-090 Summer I 2000 June 26, 2000 200 points 1. Closed book and closed notes. No outside material allowed. 2. Write all answers on the test itself. Do not write any answers in a blue book

More information

Introduction to Java Unit 1. Using BlueJ to Write Programs

Introduction to Java Unit 1. Using BlueJ to Write Programs Introduction to Java Unit 1. Using BlueJ to Write Programs 1. Open up BlueJ. Click on the Project menu and select New Project. You should see the window on the right. Navigate to wherever you plan to save

More information

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

CONCORDIA UNIVERSITY Summer 2005 Comp 248 /1 Section AA Introduction to Programming Final Examination/A NAME: ID: CONCORDIA UNIVERSITY Summer 2005 Comp 248 /1 Section AA Introduction to Programming Final Examination/A Instructor: N. Acemian Monday June 27, 2005 Duration: 3 hours INSTRUCTIONS: - Answer all

More information

CSE 142 Su01 Final Exam Sample Solution page 1 of 7

CSE 142 Su01 Final Exam Sample Solution page 1 of 7 CSE 142 Su01 Final Exam Sample Solution page 1 of 7 Answer all of the following questions. READ EACH QUESTION CAREFULLY. Answer each question in the space provided on these pages. Budget your time so you

More information

CSE331 Winter 2014, Midterm Examination February 12, 2014

CSE331 Winter 2014, Midterm Examination February 12, 2014 CSE331 Winter 2014, Midterm Examination February 12, 2014 Please do not turn the page until 10:30. Rules: The exam is closed-book, closed-note, etc. Please stop promptly at 11:20. There are 100 points

More information

Object Oriented Programming 2015/16. Final Exam June 28, 2016

Object Oriented Programming 2015/16. Final Exam June 28, 2016 Object Oriented Programming 2015/16 Final Exam June 28, 2016 Directions (read carefully): CLEARLY print your name and ID on every page. The exam contains 8 pages divided into 4 parts. Make sure you have

More information

Introduction to Software Development (ISD) Week 3

Introduction to Software Development (ISD) Week 3 Introduction to Software Development (ISD) Week 3 Autumn term 2012 Aims of Week 3 To learn about while, for, and do loops To understand and use nested loops To implement programs that read and process

More information

CSE 131 Introduction to Computer Science Fall 2016 Exam I. Print clearly the following information:

CSE 131 Introduction to Computer Science Fall 2016 Exam I. Print clearly the following information: CSE 131 Introduction to Computer Science Fall 2016 Given: 29 September 2016 Exam I Due: End of Exam Session This exam is closed-book, closed-notes, no electronic devices allowed The exception is the "sage

More information

NAME: Sample Final Exam (based on previous CSE 455 exams by Profs. Seitz and Shapiro)

NAME: Sample Final Exam (based on previous CSE 455 exams by Profs. Seitz and Shapiro) Computer Vision Prof. Rajesh Rao TA: Jiun-Hung Chen CSE 455 Winter 2009 Sample Final Exam (based on previous CSE 455 exams by Profs. Seitz and Shapiro) Write your name at the top of every page. Directions

More information

EXAM Computer Science 1 Part 1

EXAM Computer Science 1 Part 1 Maastricht University Faculty of Humanities and Science Department of Knowledge Engineering EXAM Computer Science 1 Part 1 Block 1.1: Computer Science 1 Code: KEN1120 Examiner: Kurt Driessens Date: Januari

More information

static CS106L Spring 2009 Handout #21 May 12, 2009 Introduction

static CS106L Spring 2009 Handout #21 May 12, 2009 Introduction CS106L Spring 2009 Handout #21 May 12, 2009 static Introduction Most of the time, you'll design classes so that any two instances of that class are independent. That is, if you have two objects one and

More information

Lab 1: Silver Dollar Game 1 CSCI 2101B Fall 2018

Lab 1: Silver Dollar Game 1 CSCI 2101B Fall 2018 Lab 1: Silver Dollar Game 1 CSCI 2101B Fall 2018 Due: Tuesday, September 18, 11:59 pm Collaboration Policy: Level 1 (review full policy for details) Group Policy: Individual This lab will give you experience

More information

Repe$$on CSC 121 Spring 2017 Howard Rosenthal

Repe$$on CSC 121 Spring 2017 Howard Rosenthal Repe$$on CSC 121 Spring 2017 Howard Rosenthal Lesson Goals Learn the following three repetition structures in Java, their syntax, their similarities and differences, and how to avoid common errors when

More information

Announcements. PS 3 is due Thursday, 10/6. Midterm Exam 1: 10/14 (Fri), 9:00am-10:53am

Announcements. PS 3 is due Thursday, 10/6. Midterm Exam 1: 10/14 (Fri), 9:00am-10:53am Announcements PS 3 is due Thursday, 10/6 Midterm Exam 1: 10/14 (Fri), 9:00am-10:53am Room TBD Scope: Lecture 1 to Lecture 9 (Chapters 1 to 6 of text) You may bring a sheet of paper (A4, both sides) Tutoring

More information

STUDENT LESSON A1 Introduction to Object-Oriented Programming (OOP)

STUDENT LESSON A1 Introduction to Object-Oriented Programming (OOP) STUDENT LESSON A1 Introduction to Object-Oriented Programming (OOP) Java Curriculum for AP Computer Science, Student Lesson A1 1 STUDENT LESSON A1 Introduction to Object-Oriented Programming (OOP) INTRODUCTION:

More information

Programming via Java Defining classes

Programming via Java Defining classes Programming via Java Defining classes Our programs so far have used classes, like Turtle and GOval, which were written by other people. In writing larger programs, we often find that another class would

More information

CSE331 Winter 2014, Midterm Examination February 12, 2014

CSE331 Winter 2014, Midterm Examination February 12, 2014 CSE331 Winter 2014, Midterm Examination February 12, 2014 Please do not turn the page until 10:30. Rules: The exam is closed-book, closed-note, etc. Please stop promptly at 11:20. There are 100 points

More information

MEMORIZE the Java App pick: public class { public static void main(string[] a) {

MEMORIZE the Java App pick: public class { public static void main(string[] a) { MEMORIZE the Java App pick: public class { public static void main(string[] a) { a name (you make up) for your app, say MyApp Save it as a file named MyApp.java } Directions, written in good Java syntax,

More information

CIS 110 Introduction To Computer Programming. October 5th, 2011 Exam 1. Review problems

CIS 110 Introduction To Computer Programming. October 5th, 2011 Exam 1. Review problems CIS 110 Introduction To Computer Programming October 5th, 2011 Exam 1 Review problems Scores: 1 2 3 4 5 6 Total (100 max) CIS 110 Exam 1 Instructions You have 50 minutes to finish this exam. Time will

More information

University of British Columbia CPSC 111, Intro to Computation Jan-Apr 2006 Tamara Munzner

University of British Columbia CPSC 111, Intro to Computation Jan-Apr 2006 Tamara Munzner University of British Columbia CPSC 111, Intro to Computation Jan-Apr 2006 Tamara Munzner Conditionals II Lecture 11, Thu Feb 9 2006 based on slides by Kurt Eiselt http://www.cs.ubc.ca/~tmm/courses/cpsc111-06-spr

More information

CS 1331 Exam 1 ANSWER KEY

CS 1331 Exam 1 ANSWER KEY CS 1331 Exam 1 Fall 2016 ANSWER KEY Failure to properly fill in the information on this page will result in a deduction of up to 5 points from your exam score. Signing signifies you are aware of and in

More information

COMP-202 Unit 4: Programming with Iterations

COMP-202 Unit 4: Programming with Iterations COMP-202 Unit 4: Programming with Iterations Doing the same thing again and again and again and again and again and again and again and again and again... CONTENTS: While loops Class (static) variables

More information

CSE 8A Lecture 21. SMarx extra final exam office hours Fri 3/15 11:15am-1pm EBU-3B #2206

CSE 8A Lecture 21. SMarx extra final exam office hours Fri 3/15 11:15am-1pm EBU-3B #2206 CSE 8A Lecture 21 LAST lecture on Friday! PSA 9 interviews due by Thursday SMarx extra final exam office hours Fri 3/15 11:15am-1pm EBU-3B #2206 Review Exam #4 Statistics Median: 72.5% (14.5/20) High:

More information

The compiler is spewing error messages.

The compiler is spewing error messages. Appendix B Debugging There are a few different kinds of errors that can occur in a program, and it is useful to distinguish between them in order to track them down more quickly. Compile-time errors are

More information

CSIS 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 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 information

COS 126 Midterm 1 Written Exam Fall 2011

COS 126 Midterm 1 Written Exam Fall 2011 NAME: login id: Precept: COS 126 Midterm 1 Written Exam Fall 2011 This test has 8 questions, weighted as indicated. The exam is closed book, except that you are allowed to use a one page cheatsheet. No

More information

Q1: Multiple choice / 20 Q2: Arrays / 40 Q3: Functions / 40 TOTAL SCORE / 100 EXTRA CREDIT / 10

Q1: Multiple choice / 20 Q2: Arrays / 40 Q3: Functions / 40 TOTAL SCORE / 100 EXTRA CREDIT / 10 EECE.2160: ECE Application Programming Spring 2017 Exam 2 March 29, 2017 Name: Section (circle 1): 201 (Dr. Li, MWF 8-8:50) 202 (Dr. Geiger, MWF 12-12:50) For this exam, you may use only one 8.5 x 11 double-sided

More information

6.001 Notes: Section 4.1

6.001 Notes: Section 4.1 6.001 Notes: Section 4.1 Slide 4.1.1 In this lecture, we are going to take a careful look at the kinds of procedures we can build. We will first go back to look very carefully at the substitution model,

More information

Full file at

Full file at Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class

More information

Lecture 5: Methods CS2301

Lecture 5: Methods CS2301 Lecture 5: Methods NADA ALZAHRANI CS2301 1 Opening Problem Find the sum of integers from 1 to 10, from 20 to 30, and from 35 to 45, respectively. 2 Solution public static int sum(int i1, int i2) { int

More information

CSE wi Final Exam 3/12/18. Name UW ID#

CSE wi Final Exam 3/12/18. Name UW ID# Name UW ID# There are 13 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes,

More information

ALICE: An introduction to progamming

ALICE: An introduction to progamming ALICE: An introduction to progamming What is Computer Science? Computer Science Do you know the difference between ICT and Computer Science? Any suggestions as to what jobs you could do if you were a Computer

More information

1.00 Introduction to Computers and Engineering Problem Solving. Quiz 1 March 7, 2003

1.00 Introduction to Computers and Engineering Problem Solving. Quiz 1 March 7, 2003 1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 7, 2003 Name: Email Address: TA: Section: You have 90 minutes to complete this exam. For coding questions, you do not need to

More information

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 43 Dynamic Binding (Polymorphism): Part III Welcome to Module

More information

Problem Points Score Grader Total 100

Problem Points Score Grader Total 100 University of Illinois at Urbana-Champaign Department of Computer Science Second Examination Fall 2011 CS 125 Introduction to Computer Science 90 minutes permitted First name: Last name: NetID: @ illinois.edu

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #29 Arrays in C

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #29 Arrays in C Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #29 Arrays in C (Refer Slide Time: 00:08) This session will learn about arrays in C. Now, what is the word array

More information

CS100J April 17, 2001

CS100J April 17, 2001 CS100J April 17, 2001 Prelim 3 7:30 PM 9:00 PM (Print last name, first name, middle initial/name) (Student ID) Statement of integrity: I did not, and will not, break the rules of academic integrity on

More information