CSE142 Midterm Autumn This exam is divided into eight questions with the following points: # Problem Area Points Score

Size: px
Start display at page:

Download "CSE142 Midterm Autumn This exam is divided into eight questions with the following points: # Problem Area Points Score"

Transcription

1 CSE142 Midterm Autumn 2015 This exam is divided into eight questions with the following points: # Problem Area Points Score 1 Expressions 10 og 2 Parameter Mystery 12 f/else Simulation 12 \1^ \1^ 4 While Loop Simulation 12 5 Assertions 15 i-u 6 Programming Programming 15 8 Programming 9 H Total 100 This is a closed-book/closed-note exam. Space is provided for your answers. There is a "cheat sheet" at the end that you can use as scratch paper or to write answers. You can also request scratch paper from a TA. You are not allowed to access any of your own papers during the exam. The exam is not graded on style and you do not need to include comments, although you are limited to the constructs included in chapters 1 throuqh 5 of the textbook. You are allowed to abbreviate "Always", "Never," and "Sometimes" as "A", "N", and "S" for the assertions question, but you should otherwise NOT use any abbreviations on the exam. You are NOT to use any electronic devices while taking the test, including calculators. Anyone caught using an electronic device will receive a 10 point penalty. Do not begin work on this exam until instructed to do so. Any student who starts early or who continues to work after time is called will receive a 10 point penalty. f you finish the exam early, please hand your exam to the instructor and exit quietly.

2 1. Expressions, 10 points. For each expression in the left-hand column, indicate its value in' the right-hand column. Be sure to list a consta appropriate type (e.g., 7.0 rather than 7 for a double. Strings in quot Expression 1 2 * 5 / v a.5 2.5*2*5/ %^ 4-%-± ^-^..2--K- (^ K-4.) -2-^^ 482-7^<Lj / 5/ 2.0*2 14/5 16 Value 4,0 i( t( s,76 [ (.0 <1 ^ 0 -j ^ 2. Parameter Mystery, 12 points. Consider the following program. public class Mystery { public static void main(strihg[] args) { String she = "it"; String it = "her"; String her = "you"; String yoo_5_ lija^; saying(yoh^ i^, you); saying(it, her, she); saying(she, "you", her); saying(it, "him", "fred"); public static void saying(string it. String her. String she) { System.out.println(she " can't take " it " with " her); List below the output produced by this program. <yf\ -V hike '^(Xj C<5ti'4 h \A!\^h ycu {^(5^ co/im ^(\ki \f\^ 1^1 n)

3 Simulation, 12 points. Consider the following method public static void ifelsemystery(int a, int b) { if (a < b) { a = a 2; tj b,= b - ; U. else if (a == b) { a = a * 2; O b = b 5; else { O a = a - ; 5 > if (a == b) { b = b 10; System.out.println(a " " b); For each call below, indicate what output is produced. Method Call ifelsemystery(2, 5) ifelsemystery(5, 5) ifelsemystery(6, ) ifelsemystery(4, 4) ifelsemystery(, 8) ifelsemystery(9, 5) Output Produced g While Loop Simulation, 12 points. Consider the following method: 5 G 5 public static void mystery(int x) { int y = 1; int z = while (x > z) { if (x % z == 0) { X = X- / z; y; else { Z; System.out.println(y " z); For each call below, indicate what output is produced: Method Call mystery(2); mystery(5); mysteryj^; ^ mystery(12); Output Produced a -2. g a 1 -z a Y

4 5. Assertions, 15 points. You will identify various assertions as bein always true, never true or sometimes true/sometimes false at various in program execution. The comments in the method below indicate the of interest. lah public static void mystery(scanner console) { int y = 42; int z = 0; // Point A while (y!= 0) { ^^ ^ // Point B y = console.nextint0; if (y % 2 == 0) { Z; // Point C wc /)d<^ // Point D Od 0^^ o y--; // Point E System.out.printlnC'z = z); A A, ro 0/^ '0 P po Fill in the table below with the words ALWAYS, NEVER or SOMETMES. Point Point Point Point Point A B C D E y == 0 y % 2 == 0 z == 0 K/ \ f\ \ i...i....^a rsl...i- '.. y......i- --S...

5 L u 0 ' 'j ^ points. Write a. static method called spinwheel that takes a id an'integer n as parameters and that simulates the spinning the number 20 comes up n times in a row. On the wheel are 0, 40, 50, and 60 and each number should be equally likely the wheel is spun. Your method should report the individual 5 indicating how many times it takes to get n occurrences of Dr example, below are two sample calls: = new Random 0; Mr, 2); Mr, ); should produce two lines of output like this: 40, 50, 20, 50, 50, 40, 20, 0, 40, 50, 20, 20 after 1 spins should produce two lines of output like this: 50, 50, 20, 40, 20, 40, 20, 20, 20 after 10 spins spin values ape separated by commas and that the method las seen n occurrences of the value 20 in a row. You are to ice the format of these logs. You may assume that the value n method is greater than or equal to 1. void ^ non p /fii O' 5 piw;; > rn 0 y P<(\^j C6^K\\ ;, (c J ^ J f 2)$ i-f- Covm \ \ J 4-2)^/0 a H 6 Covn-^ 0\ ' / V Sy5 (fna,(vi"'pr''l4lri -t

6 ng, 15 points. Write a static method called spinwheel that takes a,m object and an integer n as parameters and that simulates the spinning f' a wheel until the number 20 comes up n times in a row. On the wheel are the numbers 20, 0, 40, 50, and 60 and each number should be equally likely to come up when the wheel is spun. Your method should report the individual spins as well as indicating how many times it takes to get n occurrences of 20 in a row. For example, below are two sample calls: c * ' S' ^ ^ Random r = new RandomO; spinwheel(r, 2); spinwheel(r, ); P P The first call should produce two lines of output like this: spins: 40, 40, 50, 20, 50, 50, 40, 20, 0, 40, 50, 20, 20 2 in a row after 1 spins The second call should produce two lines of output like this: spins: 50, 50, 50, 20, 40, 20, 40, 20, 20, 20 in a row after 10 spins Notice that the spin values are separated by commas and that the method stops when it has seen n occurrences of the value 20 in a row. You are to exactly reproduce the format of these logs. You may assume that the value n passed to your method is greater than or equal to 1. 1a pri^viws^j/ J T "5 W '^S i/^hi (c s>.'^a1^.' ( f 2)^ Covm ) 2))elD a H 1 N S 'C 0VV''' O' <r ^ u ^ r^p'iwsft; f nvwac);^'^' Svsfew.(vTiPrHn [r(aa\ gpivs sj iav-s 0/ ^

7 Programming, 15 points. Write a static method called balancecheckbd takes a console Scanner as a parameter and that prompts a user for information about transactions for a bank account, reporting the new b after each transaction and the minimum balance at the end and returning whether or not the account was ever overdrawn (true if it was, false if i was not). The user is prompted for an initial balance, the number of transactions to process, and the individual transaction amounts. Deposits to the account are entered as positive numbers and checks and ATM withdrawals are entered as negative numbers. A new balance is reported after each transaction. For example, the method would be called as follows: Scanner console = new Scanner(System.in); balancecheckbook(console); Below are two sample logs of execution that might be produced: initial balance? how many transactions? 4 1/4 amount? new balance = $28.5 2/4 amount? new balance = $22.75 /4 amount? new balance = $ /4 amount? new balance = $ minimum balance = $22.75 initial balance? 9.75 how many transactions? 5 1/5 amount? new balance = $ /5 amount? new balance = $14.05 /5 amount? new balance = $ /5 amount? new balance = $ /5 amount? new balance = $2.5 minimum balance = $-9.05 n the log to the left, the user enters 4 different transactions and the minimum balance is not negative, so the method would return false to indicate that the account was never overdrawn. n the log to the right, the user enters 5 transactions and the minimum balance is negative, so the method would return true to indicate that the account was overdrawn. You are to exactly reproduce the format of these logs. You may assume that the number of transactions entered by the user is at least 1. Space is provided on the opposite page for your answer.

8 y.. provide your answer to balancecheckbook below. r ys<rn.aaf)i'f)^'ir),-l,'^( Marcel j>\ VJ np^- Aojiole ohn - ^ ''-y fisi' Cm ^ JL' ' i tt'- JU -^/ ' <-n M _ ^(mv t'l ;,s - '«n fr\m - d ''i ( i {!-r\ t V

9 8, or- Programming, 9 points. Write a static method called samedashes th two strings as parameters and that returns whether or not they have d in the same places (returning true if they do and returning false otherwise). For example, below are four pairs of strings of equal lengt that have the same pattern of dashes. Notice that the last pair has no dashes at all. Stringl: stringz: "hi--there-you." "12--(14)-759" "-15-89" -xy-zzy "criminal-plan" "(206) " "ab,c" "9.8" To be considered a match, the strings must have exactly the same number of dashes in exactly the same positions. The strings might be of different length. For example, the following calls should each return true: samedashes("lst-has-more characters", "2nd-has-less") samedashes("lst-has-less", "2nd-has-more characters") because the strings each have two dashes and they are in the same positions. But the following calls should each return false because the longer string has a third dash where the shorter string does not: samedashes("1st-has-more-characters", "2nd-has-less") samedashes("1st-has-less", "2nd-has-more-characters") n solving this problem you may use only methods listed ui L 1C Cl ica L 'a s4.ica»t,ri ^ Y-= i,, 1-0/i ^ X' i)5( si. r,

10 C\jr^

CSE142 Sample Midterm Spring Name UW NetId (e.g. whitab) Section (e.g., AA) TA

CSE142 Sample Midterm Spring Name UW NetId (e.g. whitab) Section (e.g., AA) TA CSE142 Sample Midterm Spring 2018 Name UW NetId (e.g. whitab) Section (e.g., AA) TA This exam is divided into nine questions with the following points: # Problem Area Points Score ---------------------------------------------

More information

CSE 142, Autumn 2011 Midterm Exam: Friday, November 4, 2011

CSE 142, Autumn 2011 Midterm Exam: Friday, November 4, 2011 CSE 142, Autumn 2011 Midterm Exam: Friday, November 4, 2011 Name: Section: Student ID #: TA: You have 50 minutes to complete this exam. You may receive a deduction if you keep working after the instructor

More information

CSE142 Sample Midterm, Winter 2018

CSE142 Sample Midterm, Winter 2018 CSE142 Sample Midterm, Winter 2018 1. Expressions, 10 points. For each expression in the left-hand column, indicate its value in the right-hand column. Be sure to list a constant of appropriate type (e.g.,

More information

CSE 142 Sample Midterm Exam #2

CSE 142 Sample Midterm Exam #2 CSE 142 Sample Midterm Exam #2 1. Expressions For each expression in the left-hand column, indicate its value in the right-hand column. Be sure to list a constant of appropriate type (e.g., 7.0 rather

More information

Building Java Programs A Back to Basics Approach 4th Edition Reges TEST BANK Full download at:

Building Java Programs A Back to Basics Approach 4th Edition Reges TEST BANK Full download at: Building Java Programs A Back to Basics Approach 4th Edition Reges TEST BANK Full download at: Building Java Programs A Back to Basics Approach 4th Edition Reges SOLUTIONS MANUAL https://testbankreal.com/download/building-java-programs-a-back-to-basicsapproach-4th-edition-reges-test-bank/

More information

CSE 142, Autumn 2010 Midterm Exam, Friday, November 5, 2010

CSE 142, Autumn 2010 Midterm Exam, Friday, November 5, 2010 CSE 142, Autumn 2010 Midterm Exam, Friday, November 5, 2010 Name: Section: TA: Student ID #: You have 50 minutes to complete this exam. You may receive a deduction if you keep working after the instructor

More information

CSE142 Sample Midterm Autumn 2018

CSE142 Sample Midterm Autumn 2018 CSE142 Sample Midterm Autumn 2018 1. Expressions, 10 points. For each expression in the left-hand column, indicate its value in the right-hand column. Be sure to list a constant of appropriate type (e.g.,

More information

CSE 142, Summer 2013 Midterm Exam, Friday, July 26, 2013

CSE 142, Summer 2013 Midterm Exam, Friday, July 26, 2013 CSE 142, Summer 2013 Midterm Exam, Friday, July 26, 2013 Name: Section: TA: Student ID #: You have 60 minutes to complete this exam. You may receive a deduction if you keep working after the instructor

More information

CSE 142, Autumn 2008 Midterm Exam, Friday, October 31, 2008

CSE 142, Autumn 2008 Midterm Exam, Friday, October 31, 2008 CSE 142, Autumn 2008 Midterm Exam, Friday, October 31, 2008 Name: Section: Student ID #: TA: You have 50 minutes to complete this exam. You may receive a deduction if you keep working after the instructor

More information

CSE 142, Summer 2010 Midterm Exam, Friday, July 30, 2010

CSE 142, Summer 2010 Midterm Exam, Friday, July 30, 2010 CSE 142, Summer 2010 Midterm Exam, Friday, July 30, 2010 Name: Section: TA: Student ID #: You have 60 minutes to complete this exam. You may receive a deduction if you keep working after the instructor

More information

CSE 142, Autumn 2007 Midterm Exam, Friday, November 2, 2007

CSE 142, Autumn 2007 Midterm Exam, Friday, November 2, 2007 CSE 142, Autumn 2007 Midterm Exam, Friday, November 2, 2007 Name: Section: Student ID #: TA: Rules: You have 50 minutes to complete this exam. You may receive a deduction if you keep working after the

More information

CSE 142 Sample Midterm Exam #3

CSE 142 Sample Midterm Exam #3 CSE 142 Sample Midterm Exam #3 1. Expressions (10 points) For each expression in the left-hand column, indicate its value in the right-hand column. Be sure to list a constant of appropriate type (e.g.,

More information

Sample Midterm Exam #2

Sample Midterm Exam #2 Sample Midterm Exam #2 1. Expressions For each expression in the left-hand column, indicate its value in the right-hand column. Be sure to list a constant of appropriate type (e.g., 7.0 rather than 7 for

More information

CSE 142 Sample Midterm Exam #3

CSE 142 Sample Midterm Exam #3 CSE 142 Sample Midterm Exam #3 1. Expressions For each expression in the left-hand column, indicate its value in the right-hand column. Be sure to list a constant of appropriate type (e.g., 7.0 rather

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 5 Lecture 5-4: do/while loops, assertions reading: 5.1, 5.5 1 The do/while loop do/while loop: Performs its test at the end of each repetition. Guarantees that the loop's

More information

CSE 142, Spring 2009, Final Exam

CSE 142, Spring 2009, Final Exam CSE 142, Spring 2009, Final Exam Name: Section: Student ID #: TA: Rules: You have 110 minutes to complete this exam. You will receive a deduction if you keep working after the instructor calls for papers.

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 5 Lecture 5-4: do/while loops, assertions reading: 5.1, 5.5 1 The do/while loop do/while loop: Performs its test at the end of each repetition. Guarantees that the loop's

More information

CSE143 Midterm Summer Name of Student: Section (e.g., AA): Student Number:

CSE143 Midterm Summer Name of Student: Section (e.g., AA): Student Number: CSE143 Midterm Summer 2017 Name of Student: Section (e.g., AA): Student Number: The exam is divided into six questions with the following points: # Problem Area Points Score ---------------------------------------------

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 5 Lecture 5-4: Assertions reading: 5.5 1 Punchline to a longer comic: http://www.smbc-comics.com/index.php?db=comics&id=2362#comic 2 Logical assertions assertion: A statement

More information

CSE 142, Spring 2009, Sample Final Exam #2. Good luck!

CSE 142, Spring 2009, Sample Final Exam #2. Good luck! CSE 142, Spring 2009, Sample Final Exam #2 Name: Section: Student ID #: TA: Rules: You have 110 minutes to complete this exam. You will receive a deduction if you keep working after the instructor calls

More information

CSEN202: Introduction to Computer Science Spring Semester 2017 Midterm Exam

CSEN202: Introduction to Computer Science Spring Semester 2017 Midterm Exam Page 0 German University in Cairo April 6, 2017 Media Engineering and Technology Faculty Prof. Dr. Slim Abdennadher CSEN202: Introduction to Computer Science Spring Semester 2017 Midterm Exam Bar Code

More information

1. An operation in which an overall value is computed incrementally, often using a loop.

1. An operation in which an overall value is computed incrementally, often using a loop. Practice Exam 2 Part I: Vocabulary (10 points) Write the terms defined by the statements below. 1. An operation in which an overall value is computed incrementally, often using a loop. 2. The < (less than)

More information

CS 305j Midterm 2 Fall 2006

CS 305j Midterm 2 Fall 2006 Exam Number: Points off 1 2 3 4 5 6 Total off Net Score CS 305j Midterm 2 Fall 2006 Your Name Your UTEID Circle you TA's name: Brad Jacob Instructions: 1. Please turn off your cell phones 2. There are

More information

Question: Total Points: Score:

Question: Total Points: Score: CS 170 Exam 1 Section 001 Fall 2014 Name (print): Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than

More information

CSE143 Summer 2008 Final Exam Part B KEY August 22, 2008

CSE143 Summer 2008 Final Exam Part B KEY August 22, 2008 CSE143 Summer 2008 Final Exam Part B KEY August 22, 2008 Name : Section (eg. AA) : TA : This is an open-book/open-note exam. Space is provided for your answers. Use the backs of pages if necessary. The

More information

Section 003 Fall CS 170 Exam 2. Name (print): Instructions:

Section 003 Fall CS 170 Exam 2. Name (print): Instructions: CS 170 Exam 2 Section 003 Fall 2012 Name (print): Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than

More information

CSE 1223: Exam II Autumn 2016

CSE 1223: Exam II Autumn 2016 CSE 1223: Exam II Autumn 2016 Name: Instructions: Do not open the exam before you are told to begin. This exam is closed book, closed notes. You may not use any calculators or any other kind of computing

More information

CSE 142, Autumn 2010 Final Exam Wednesday, December 15, Name:

CSE 142, Autumn 2010 Final Exam Wednesday, December 15, Name: CSE 142, Autumn 2010 Final Exam Wednesday, December 15, 2010 Name: Section: Student ID #: TA: Rules: You have 110 minutes to complete this exam. You may receive a deduction if you keep working after the

More information

CS 1063 Introduction to Computer Programming Midterm Exam 2 Section 1 Sample Exam

CS 1063 Introduction to Computer Programming Midterm Exam 2 Section 1 Sample Exam Seat Number Name CS 1063 Introduction to Computer Programming Midterm Exam 2 Section 1 Sample Exam This is a closed book exam. Answer all of the questions on the question paper in the space provided. If

More information

CSE143 Summer 2008 Final Exam Part A KEY August 21, 2008

CSE143 Summer 2008 Final Exam Part A KEY August 21, 2008 CSE143 Summer 28 Final Exam Part A KEY August 21, 28 Name : Section (eg. AA) : TA : This is an open-book/open-note exam. Space is provided for your answers. Use the backs of pages if necessary. The exam

More information

Place your name tag here

Place your name tag here CS 170 Exam 1 Section 001 Spring 2015 Name: Place your name tag here Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with

More information

Midterm Review Session

Midterm Review Session Midterm Review Session Programming Problems For more practice: http://webster.cs.washington.edu:8080/practiceit/ Copyright 2009 by Pearson Education Midterm Logistics Bring your UW Student ID card!! Will

More information

assertion: A statement that is either true or false.

assertion: A statement that is either true or false. Logical assertions assertion: A statement that is either true or false. Examples: Java was created in 1995. The sky is purple. 23 is a prime number. 10 is greater than 20. x divided by 2 equals 7. (depends

More information

CSE 142, Winter 2007 Final Exam. Name:

CSE 142, Winter 2007 Final Exam. Name: 1 of 10 CSE 142, Winter 2007 Final Exam Name: Section: Student ID #: TA: You have 110 minutes to complete this exam. You may receive a deduction if you keep working after the instructor calls for papers.

More information

Java. Programming: Chapter Objectives. Why Is Repetition Needed? Chapter 5: Control Structures II. Program Design Including Data Structures

Java. Programming: Chapter Objectives. Why Is Repetition Needed? Chapter 5: Control Structures II. Program Design Including Data Structures Chapter 5: Control Structures II Java Programming: Program Design Including Data Structures Chapter Objectives Learn about repetition (looping) control structures Explore how to construct and use count-controlled,

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

CSE 143: Computer Programming II Spring 2015 Midterm Exam Solutions

CSE 143: Computer Programming II Spring 2015 Midterm Exam Solutions CSE 143: Computer Programming II Spring 2015 Midterm Exam Solutions Name: Sample Solutions ID #: 1234567 TA: The Best Section: A9 INSTRUCTIONS: You have 50 minutes to complete the exam. You will receive

More information

CSE 143, Winter 2010 Midterm Exam Wednesday February 17, 2010

CSE 143, Winter 2010 Midterm Exam Wednesday February 17, 2010 CSE 143, Winter 2010 Midterm Exam Wednesday February 17, 2010 Personal Information: Name: Section: Student ID #: TA: You have 50 minutes to complete this exam. You may receive a deduction if you keep working

More information

NoSuchElementException 5. Name of the Exception that occurs when you try to read past the end of the input data in a file.

NoSuchElementException 5. Name of the Exception that occurs when you try to read past the end of the input data in a file. CSC116 Practice Exam 2 - KEY Part I: Vocabulary (10 points) Write the terms defined by the statements below. Cumulative Algorithm 1. An operation in which an overall value is computed incrementally, often

More information

CIS Introduction to Computer Programming. 5 October 2012 Midterm

CIS Introduction to Computer Programming. 5 October 2012 Midterm CIS 110-001 Introduction to Computer Programming 5 October 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

Type boolean. Building Java Programs. Recap: Type boolean. "Short-circuit" evaluation. De Morgan's Law. Boolean practice questions.

Type boolean. Building Java Programs. Recap: Type boolean. Short-circuit evaluation. De Morgan's Law. Boolean practice questions. Building Java Programs Chapter 5 Lecture 5-4: More boolean, Assertions, do/while loops Type boolean reading: 5.3 reading: 5.3, 5.4, 5.1 1 Recap: Type boolean boolean: A logical type whose values are true

More information

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

Exam 2. Programming I (CPCS 202) Instructor: M. G. Abbas Malik. Total Marks: 40 Obtained Marks: كلية الحاسبات وتقنية المعلوما Exam 2 Programming I (CPCS 202) Instructor: M. G. Abbas Malik Date: November 22, 2015 Student Name: Student ID: Total Marks: 40 Obtained Marks: Instructions: Do not open this

More information

1. Reference Mystery, 5 points. What output is produced by this program? import java.util.*;

1. Reference Mystery, 5 points. What output is produced by this program? import java.util.*; CSE142 Sample Final Exam, Winter 2018 1. Reference Mystery, 5 points. What output is produced by this program? import java.util.*; public class Rectangle { int w; int h; public Rectangle(int width, int

More information

The American University in Cairo Department of Computer Science & Engineering CSCI &09 Dr. KHALIL Exam-I Fall 2011

The American University in Cairo Department of Computer Science & Engineering CSCI &09 Dr. KHALIL Exam-I Fall 2011 The American University in Cairo Department of Computer Science & Engineering CSCI 106-07&09 Dr. KHALIL Exam-I Fall 2011 Last Name :... ID:... First Name:... Form I Section No.: EXAMINATION INSTRUCTIONS

More information

CS 112 Introduction to Programming

CS 112 Introduction to Programming CS 112 Introduction to Programming Program Analysis Yang (Richard) Yang Computer Science Department Yale University 308A Watson, Phone: 432-6400 Email: yry@cs.yale.edu Admin q PS5 Walkthrough Thursday

More information

(the bubble footer is automatically inserted into this space)

(the bubble footer is automatically inserted into this space) CS 1110 Exam 1, Fall 2018 Page 1 of 8 UVa userid: CS 1110 Exam 1 Name Bubble in your computing ID in the footer of this page. We use an optical scanner to read it, so fill in the bubbles darkly. If you

More information

CSE 114 Midterm 1. Please leave one seat between yourself and each of your neighbors.

CSE 114 Midterm 1. Please leave one seat between yourself and each of your neighbors. CSE 114 Midterm 1 Please leave one seat between yourself and each of your neighbors. Please place ALL of your final answers on the answer sheet that you were given at the start of the exam. Answers and

More information

University of Massachusetts Amherst, Electrical and Computer Engineering

University of Massachusetts Amherst, Electrical and Computer Engineering University of Massachusetts Amherst, Electrical and Computer Engineering ECE 122 Midterm Exam 1 Makeup Answer key March 2, 2018 Instructions: Closed book, Calculators allowed; Duration:120 minutes; Write

More information

CIS 110 Introduction To Computer Programming. November 21st, 2011 Exam 2

CIS 110 Introduction To Computer Programming. November 21st, 2011 Exam 2 CIS 110 Introduction To Computer Programming November 21st, 2011 Exam 2 Name and section # Pennkey (# and username): My signature below certifies that I have complied with the University of Pennsylvania

More information

CSE 143 Lecture 10. Recursion

CSE 143 Lecture 10. Recursion CSE 143 Lecture 10 Recursion slides created by Marty Stepp and Alyssa Harding http://www.cs.washington.edu/143/ Recursion Iteration: a programming technique in which you describe actions to be repeated

More information

Section 002 Spring CS 170 Exam 1. Name (print): Instructions:

Section 002 Spring CS 170 Exam 1. Name (print): Instructions: CS 170 Exam 1 Section 002 Spring 2015 Name (print): Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than

More information

CSE 143 Sample Midterm Exam #1

CSE 143 Sample Midterm Exam #1 CSE 143 Sample Midterm Exam #1 1. ArrayList Mystery. Consider the following method: public static void mystery1(arraylist list) { for (int i = 0; i < list.size(); i += 2) { int element = list.get(i);

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

Computer Department. Question (1): State whether each of the following is true or false. Question (2): Select the correct answer from the following:

Computer Department. Question (1): State whether each of the following is true or false. Question (2): Select the correct answer from the following: Computer Department Program: Computer Midterm Exam Date : 19/11/2016 Major: Information & communication technology 1 st Semester Time : 1 hr (10:00 11:00) Course: Introduction to Programming 2016/2017

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 5 Lecture 5-2: Random Numbers reading: 5.1, 5.6 1 http://xkcd.com/221/ 2 Randomness Lack of predictability: don't know what's coming next Random process: outcomes do not

More information

COMP-202B - Introduction to Computing I (Winter 2011) - All Sections Example Questions for In-Class Quiz

COMP-202B - Introduction to Computing I (Winter 2011) - All Sections Example Questions for In-Class Quiz COMP-202B - Introduction to Computing I (Winter 2011) - All Sections Example Questions for In-Class Quiz The in-class quiz is intended to give you a taste of the midterm, give you some early feedback about

More information

CSC 1051 Data Structures and Algorithms I. Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University

CSC 1051 Data Structures and Algorithms I. Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Last Class CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: www.csc.villanova.edu/~map/1051/ Some slides in this

More information

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

York University AK/ITEC OBJECT-BASED PROGRAMMING. Midterm Test Sample. Examiner: S.Y. Chen Duration: One Hour and Fifteen Minutes York University AK/ITEC 1620 3.0 OBJECT-BASED PROGRAMMING Midterm Test Sample Examiner: S.Y. Chen Duration: One Hour and Fifteen Minutes This exam is closed textbook(s) and closed notes. Use of any electronic

More information

Computer Security Spring 2010 Paxson/Wagner HW 4. Due Thursday April 15, 5:00pm

Computer Security Spring 2010 Paxson/Wagner HW 4. Due Thursday April 15, 5:00pm CS 161 Computer Security Spring 2010 Paxson/Wagner HW 4 Due Thursday April 15, 5:00pm Instructions: Submit your solution by Thursday, April 15, 5:00pm electronically. Write up your answers in either PDF

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 4 Lecture 4-1: if and if/else Statements reading: 4.2 self-check: #4-5, 7, 10, 11 exercises: #7 videos: Ch. 4 #2-4 The if/else statement Executes one block if a test is true,

More information

CIS November 14, 2017

CIS November 14, 2017 CIS 1068 November 14, 2017 Administrative Stuff Netflix Challenge New assignment posted soon Lab grades Last Time. Building Our Own Classes Why Abstraction More on the new operator Fields Class vs the

More information

CIS 1068 Netflix Challenge New assignment posted soon Lab grades November 14, 2017

CIS 1068 Netflix Challenge New assignment posted soon Lab grades November 14, 2017 Administrative Stuff CIS 1068 Netflix Challenge New assignment posted soon Lab grades November 14, 2017 Last Time. Building Our Own Classes Why Abstraction More on the new operator Fields Class vs the

More information

Java Programming: Guided Learning with Early Objects Chapter 5 Control Structures II: Repetition

Java Programming: Guided Learning with Early Objects Chapter 5 Control Structures II: Repetition Java Programming: Guided Learning with Early Objects Chapter 5 Control Structures II: Repetition Learn about repetition (looping) control structures Explore how to construct and use: o Counter-controlled

More information

Session 14 March 31, 2018

Session 14 March 31, 2018 Notes: Session 13 (2/28) and Session 15 (3/7) are catch up Sessions. This document contains documentation for the next group of Core Competencies, including practice problems that you should work. We will

More information

Instructor: Yu Wang 11/16/2012

Instructor: Yu Wang 11/16/2012 CS170 SECTION 001 INTRODUCTION TO COMPUTER SCIENCE I, FALL 2012 Midterm Exam II Instructor: Yu Wang 11/16/2012 Name: Emory Alias: INSTRUCTIONS: Keep your eyes on your own paper and do your best to prevent

More information

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

New York University Introduction to Computer Science Midterm2 Sample Problems 2013 Andrew I. Case. Instructions: Name: New York University Introduction to Computer Science Midterm2 Sample Problems 2013 Andrew I. Case Instructions: KEEP TEST BOOKLET CLOSED UNTIL YOU ARE INSTRUCTED TO BEGIN. This exam is double sided

More information

CSE 142, Spring 2010 Final Exam Wednesday, June 9, Name: Student ID #: Rules:

CSE 142, Spring 2010 Final Exam Wednesday, June 9, Name: Student ID #: Rules: CSE 142, Spring 2010 Final Exam Wednesday, June 9, 2010 Name: Section: Student ID #: TA: Rules: You have 110 minutes to complete this exam. You may receive a deduction if you keep working after the instructor

More information

CS 101 Exam 2 Spring Id Name

CS 101 Exam 2 Spring Id Name CS 101 Exam 2 Spring 2005 Email Id Name This exam is open text book and closed notes. Different questions have different points associated with them. Because your goal is to maximize your number of points,

More information

The American University in Cairo Computer Science & Engineering Department CSCE 106 Fundamentals of Computer Science

The American University in Cairo Computer Science & Engineering Department CSCE 106 Fundamentals of Computer Science The American University in Cairo Computer Science & Engineering Department CSCE 106 Fundamentals of Computer Science Instructor: Dr. Khalil Final Exam Fall 2012 Last Name :... ID:... First Name:... Form

More information

Final. Your Name CS Fall 2014 December 13, points total Your Instructor and Section

Final. Your Name CS Fall 2014 December 13, points total Your Instructor and Section Final Your Name CS 1063 - Fall 2014 December 13, 2014 100 points total Your Instructor and Section I. (10 points, 1 point each) Match each of the terms on the left by choosing the upper case letter of

More information

Control Flow Practice Problems Mr. Fahrenbacher AP Computer Science A

Control Flow Practice Problems Mr. Fahrenbacher AP Computer Science A Control Flow Practice Problems Mr. Fahrenbacher AP Computer Science A This problem set has four sections. After each section is the answer key. This problem set is NOT exhaustive, but it is too long. Find

More information

CSC 1051 Villanova University. CSC 1051 Data Structures and Algorithms I. Course website:

CSC 1051 Villanova University. CSC 1051 Data Structures and Algorithms I. Course website: Repetition CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: www.csc.villanova.edu/~map/1051/ Some slides in this

More information

CS 312 Exam 2 Fall Circle your TA's Name: Aish Anthony Bri Carla Chris

CS 312 Exam 2 Fall Circle your TA's Name: Aish Anthony Bri Carla Chris CS 312 Exam 2 Fall 2017 Your Name Your UTEID Circle your TA's Name: Aish Anthony Bri Carla Chris CK Dayanny Fatima Hailey Omer Problem Number Topic Points Possible 1 code trace 28 2 program logic 8 3 strings

More information

CS 367: Introduction to Data Structures Midterm Sample Questions

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

Java Programming: Guided Learning with Early Objects Chapter 5 Control Structures II: Repetition

Java Programming: Guided Learning with Early Objects Chapter 5 Control Structures II: Repetition Java Programming: Guided Learning with Early Objects Chapter 5 Control Structures II: Repetition Learn about repetition (looping) control structures Explore how to construct and use: o Counter-controlled

More information

Back to Basics for APCS Success

Back to Basics for APCS Success Back to Basics for APCS Success Stuart Reges, Principal Lecturer University of Washington Hélène Martin, CS teacher Garfield High School Selective Timeline 1984: AP/CS first offered in Pascal 1998-1999:

More information

Assignment 2.4: Loops

Assignment 2.4: Loops Writing Programs that Use the Terminal 0. Writing to the Terminal Assignment 2.4: Loops In this project, we will be sending our answers to the terminal for the user to see. To write numbers and text to

More information

Introduction to OOP with Java. Instructor: AbuKhleif, Mohammad Noor Sep 2017

Introduction to OOP with Java. Instructor: AbuKhleif, Mohammad Noor Sep 2017 Introduction to OOP with Java Instructor: AbuKhleif, Mohammad Noor Sep 2017 Lecture 03: Control Flow Statements: Selection Instructor: AbuKhleif, Mohammad Noor Sep 2017 Instructor AbuKhleif, Mohammad Noor

More information

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

Exam 1. Programming I (CPCS 202) Instructor: M. G. Abbas Malik. Total Marks: 45 Obtained Marks: كلية الحاسبات وتقنية المعلوما Exam 1 Programming I (CPCS 202) Instructor: M. G. Abbas Malik Date: October 18, 2015 Student Name: Student ID: Total Marks: 45 Obtained Marks: Instructions: Do not open this

More information

STUDENT LESSON A12 Iterations

STUDENT LESSON A12 Iterations STUDENT LESSON A12 Iterations Java Curriculum for AP Computer Science, Student Lesson A12 1 STUDENT LESSON A12 Iterations INTRODUCTION: Solving problems on a computer very often requires a repetition of

More information

CSE548, AMS542: Analysis of Algorithms, Fall 2012 Date: October 16. In-Class Midterm. ( 11:35 AM 12:50 PM : 75 Minutes )

CSE548, AMS542: Analysis of Algorithms, Fall 2012 Date: October 16. In-Class Midterm. ( 11:35 AM 12:50 PM : 75 Minutes ) CSE548, AMS542: Analysis of Algorithms, Fall 2012 Date: October 16 In-Class Midterm ( 11:35 AM 12:50 PM : 75 Minutes ) This exam will account for either 15% or 30% of your overall grade depending on your

More information

CS 111X - Fall Test 1 - KEY KEY KEY KEY KEY KEY KEY

CS 111X - Fall Test 1 - KEY KEY KEY KEY KEY KEY KEY CS 111X - Fall 2016 - Test 1 1/9 Computing ID: CS 111X - Fall 2016 - Test 1 - KEY KEY KEY KEY KEY KEY KEY Name: Computing ID: On my honor as a student, I have neither given nor received unauthorized assistance

More information

SFWR ENG/COMP SCI 2S03 Principles of Programming SOLUTIONS

SFWR ENG/COMP SCI 2S03 Principles of Programming SOLUTIONS SFWR ENG/COMP SCI 2S03 Principles of Programming SOLUTIONS Day Class Midterm Exam Dr. R. Khedri DURATION : 50 minutes McMaster University Midterm Exam (CAS) October 29, 2012 Please CLEARLY print: NAME:

More information

CS 112 Introduction to Programming

CS 112 Introduction to Programming CS 112 Introduction to Programming (Spring 2012) Lecture #8: More on Conditional & Loop Zhong Shao Department of Computer Science Yale University Office: 314 Watson http://flint.cs.yale.edu/cs112 Acknowledgements:

More information

Flow of Control of Program Statements CS 112 Introduction to Programming. Basic if Conditional Statement Basic Test: Relational Operators

Flow of Control of Program Statements CS 112 Introduction to Programming. Basic if Conditional Statement Basic Test: Relational Operators Flow of Control of Program Statements CS 112 Introduction to Programming (Spring 2012) q Java provides two types of program flow of control statements: decision statements, or conditional statements: decide

More information

CSE 303, Spring 2009 Final Exam Wednesday, June 10, 2009

CSE 303, Spring 2009 Final Exam Wednesday, June 10, 2009 CSE 303, Spring 2009 Final Exam Wednesday, June 10, 2009 Personal Information: Name: Student ID #: You have 110 minutes to complete this exam. You may receive a deduction if you keep working after the

More information

ENGR 2710U Midterm Exam UOIT SOLUTION SHEET

ENGR 2710U Midterm Exam UOIT SOLUTION SHEET SOLUTION SHEET ENGR 2710U: Object Oriented Programming & Design Midterm Exam October 19, 2012, Duration: 80 Minutes (9 Pages, 14 questions, 100 Marks) Instructor: Dr. Kamran Sartipi Name: Student Number:

More information

CS 177 Spring 2009 Exam I

CS 177 Spring 2009 Exam I CS 177 Spring 2009 Exam I There are 40 multiple choice questions. Each one is worth 2.5 points. The total score for the exam is 100. Answer the multiple choice questions on the bubble sheet given. Fill

More information

Project#3 [40 points] COP 2220 Fall 2017

Project#3 [40 points] COP 2220 Fall 2017 Project#3 [40 points] COP 2220 Fall 2017 (Materials that you MUST review for this project) 2017 Saeed Rajput, Ph.D. Problem Requirements: Allow students to submit assignments and instructor to award grades

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

CIS November 14, 2017

CIS November 14, 2017 CIS 1068 November 14, 2017 Administrative Stuff Netflix Challenge New assignment posted soon Lab grades Last Time. Building Our Own Classes Why Abstraction More on the new operator Fields Class vs the

More information

The American University in Cairo Computer Science & Engineering Department CSCE Dr. KHALIL Exam II Spring 2010

The American University in Cairo Computer Science & Engineering Department CSCE Dr. KHALIL Exam II Spring 2010 The American University in Cairo Computer Science & Engineering Department CSCE 106-08 Dr. KHALIL Exam II Spring 2010 Last Name :... ID:... First Name:... Form - I EXAMINATION INSTRUCTIONS * Do not turn

More information

COSC 236 Section 101 Computer Science 1 -- Prof. Michael A. Soderstrand

COSC 236 Section 101 Computer Science 1 -- Prof. Michael A. Soderstrand COSC 236 Section 101 Computer Science 1 -- Prof. Michael A. Soderstrand COSC 236 Web Site You will always find the course material at: http://www.class-notes.us or http://www.class-notes.info or http://www.lecture-notes.tripod.com

More information

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

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

More information

Problem Grade Total

Problem Grade Total CS 101, Prof. Loftin: Final Exam, May 11, 2009 Name: All your work should be done on the pages provided. Scratch paper is available, but you should present everything which is to be graded on the pages

More information

Building Java Programs Sample Final Exam #1. Name of Student. Section (e.g., AA)

Building Java Programs Sample Final Exam #1. Name of Student. Section (e.g., AA) Building Java Programs Sample Final Exam #1 Name of Student Section (e.g., AA) TA This is an open-book/open-note exam. Space is provided for your answers. Use the backs of pages if necessary. The exam

More information

Question: Total Points: Score:

Question: Total Points: Score: CS 170 Exam 1 Section 003 Fall 2013 Name (print): Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than

More information

CIS 110 Introduction to Computer Programming Fall 2017 Midterm. Recitation ROOM :

CIS 110 Introduction to Computer Programming Fall 2017 Midterm. Recitation ROOM : CIS 110 Introduction to Computer Programming Fall 2017 Midterm Name: Recitation ROOM : Pennkey (e.g., paulmcb): DO NOT WRITE YOUR ID# ABOVE, YOU WILL LOSE A POINT My signature below certifies that I have

More information

Problem Description Earned Max 1 CSS 20 2 PHP 20 3 SQL 10 TOTAL Total Points 50

Problem Description Earned Max 1 CSS 20 2 PHP 20 3 SQL 10 TOTAL Total Points 50 CSE 154, Autumn 2014 Midterm Exam, Friday, November 7, 2014 Name: Quiz Section: Student ID #: TA: Rules: You have 50 minutes to complete this exam. You may receive a deduction if you keep working after

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