Final Exam. COMP Summer I June 26, points

Similar documents
Final Exam COMP Fall 2004 Dec 16, 2004

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

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

CSE 131S Introduction to Computer Science Summer SON Exam I

C212 Early Evaluation Exam Mon Feb Name: Please provide brief (common sense) justifications with your answers below.

Prelim 1, Solution. CS 2110, 13 March 2018, 7:30 PM Total Question Name Short answer

CS 12 Fall 2003 Solutions for mid-term exam #2

COS 126 General Computer Science Spring Written Exam 1

CS 112 Midterm Exam Fall 2016

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

Prelim 1. CS 2110, 13 March 2018, 7:30 PM Total Question Name Short answer

1. What does the following code fragment write to the monitor?

CSE 332 Autumn 2013: Midterm Exam (closed book, closed notes, no calculators)

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

CS 177 Week 15 Recitation Slides. Review

CSE 131 Introduction to Computer Science Fall Exam I

Computing Science 114 Solutions to Midterm Examination Tuesday October 19, In Questions 1 20, Circle EXACTLY ONE choice as the best answer

NATIONAL UNIVERSITY OF SINGAPORE

CS 2505 Computer Organization I

CSE373 Fall 2013, Final Examination December 10, 2013 Please do not turn the page until the bell rings.

Final Exam CS 152, Computer Programming Fundamentals December 9, 2016

Exam 2. CSC 121 MW Class. Lecturer: Howard Rosenthal. April 26, 2017

Problem Score Max Score 1 Syntax directed translation & type

Part 1 (80 points) Multiple Choice Questions (20 questions * 4 points per question = 80 points)

CSE 131 Introduction to Computer Science Fall Exam II

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

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

CSE 131 Introduction to Computer Science Fall Exam I

COMP 401 Midterm. Tuesday, Oct 18, pm-3:15pm. Instructions

CSEN202: Introduction to Computer Science Spring Semester 2017 Midterm Exam

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

CSCI 135 Exam #2 Fundamentals of Computer Science I Fall 2013

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

CSE 131 Introduction to Computer Science Fall Exam I

CSE373 Fall 2013, Final Examination December 10, 2013 Please do not turn the page until the bell rings.

Do not start the test until instructed to do so!

CSCI 135 Exam #2 Fundamentals of Computer Science I Fall 2013

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!

CSE331 Winter 2014, Midterm Examination February 12, 2014

SPRING 13 CS 0007 FINAL EXAM V2 (Roberts) Your Name: A pt each. B pt each. C pt each. D or 2 pts each

Lab5. Wooseok Kim

CIS 110 Introduction to Computer Programming 8 October 2013 Midterm

Prelim 1. CS 2110, 13 March 2018, 5:30 PM Total Question Name Short answer

Final Exam CS 152, Computer Programming Fundamentals December 5, 2014

Fall 2002 Page 1 of 9 READ THIS NOW!

Spring 2013 COMP Midterm Exam Solutions March 07, 2013

New York University Intro to Computer Science (CSCI-UA.101) Fall 2014 Midterm #1 Test G. Instructions:

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

CSE331 Spring 2015, Final Examination June 8, 2015

COMP-202: Foundations of Programming. Lecture 2: Variables, and Data Types Sandeep Manjanna, Summer 2015

Sequence structure. The computer executes java statements one after the other in the order in which they are written. Total = total +grade;

COS 126 General Computer Science Fall Written Exam 1

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

CSE331 Winter 2014, Midterm Examination February 12, 2014

Midterm Exam CS 251, Intermediate Programming March 6, 2015

CSE 332 Spring 2013: Midterm Exam (closed book, closed notes, no calculators)

Prelim 1. CS 2110, September 29, 2016, 7:30 PM Total Question Name Loop invariants

CS 170 Exam 2. Version: A Fall Name (as in OPUS) (print): Instructions:

Final Examination CS 125 Introduction to Computer Science Fall Hours

CSE 247 Data Structures and Algorithms Fall Exam I

Object-oriented Programming and Software Engineering CITS1001. Multiple-choice Mid-semester Test

University of Cape Town ~ Department of Computer Science Computer Science 1015F ~ June Exam

Programming with Java

Solution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring Instructions:

Code Analysis Sample Questions

CSCE 206: Structured Programming in C++

Introduction to Computer Science I Spring 2010 Sample mid-term exam Answer key

Final Exam Practice. Partial credit will be awarded.

CIS Introduction to Computer Programming Spring Exam 1

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

CIS 110 Introduction to Computer Programming Spring 2016 Midterm

Comp 170 Test 1 SAMPLE June 8, 2000

Last Class. While loops Infinite loops Loop counters Iterations

YOU ARE ALLOWED TO HAVE ONLY THE FOLLOWING ON YOUR DESK OR WORKTABLE:

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

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

CIS 110 Introduction to Computer Programming. 13 February 2013 Make-Up Midterm Midterm

CS 455 Midterm Exam 1 Fall 2013 [Bono] Wednesday, Oct. 2, 2013

CS111: PROGRAMMING LANGUAGE II

CSE 131 Introduction to Computer Science Fall Exam II

CS 177 Spring 2010 Exam I

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

CIS 110 Introduction to Computer Programming. 12 February 2013 Midterm

CSE 1223: Exam II Autumn 2016

CS101 Part 2: Practice Questions Algorithms on Arrays, Classes and Objects, String Class, Stack Class

CSE wi Midterm Exam 2/8/18. Name UW ID #

CS 101 Fall 2006 Midterm 1 Name: ID:

UMBC CMSC 331 Final Exam

Final Exam CS 152, Computer Programming Fundamentals May 9, 2014

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

Total Score /1 /20 /41 /15 /23 Grader

CS 101 Spring 2007 Midterm 2 Name: ID:

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

CSCI 1226 Sample Midterm Exam

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

Midterm I - CSE11 Fall 2013 CLOSED BOOK, CLOSED NOTES 50 minutes, 100 points Total.

CIS 1068 Design and Abstraction Spring 2017 Midterm 1a

Introduction to Programming Using Java (98-388)

Computer Programming: C++

Prelim 2. CS 2110, 16 November 2017, 7:30 PM Total Question Name Short Heaps Tree Collections Sorting Graph

Transcription:

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 or on scratch paper. 3. If you finish before 11:00, you may bring your test to the front of the room. 4. Keep your answers short and to the point. Longer is not necessarily better. 5. Budget your time carefully. Read over the entire exam before starting. 6. Write legibly. If I can t read it, you can t get credit for it. 7. Write your initials on the back of every page of this exam. 8. You do not need to put comments in any code you write. You will not be graded for coding style. But, if I can t understand it you can t get credit for it. 9. Make sure your answer clearly indicates the result (versus your scratch work). Draw a box around your answers. 10. Assume any code segment is embedded in a correct program. 11. Assume all variables have been appropriately declared before they are used. Their type will be obvious from the usage. 12. When showing program output, you do not have to indicate the exact spacing but do show when an output starts on a new line. I pledge that I have neither received nor given unauthorized aid on this examination. Signed: Printed Name:

Initials Question Maximum Score 1 4 2 4 3 4 4 4 5 4 6 4 7 4 8 4 9 4 10 4 11 4 12 5 13 5 14 6 15 30 16 10 17 20 18 15 19 30 20 35 200 points Total Score

Section I Multiple Choice / Fill in the Blank [4 points each] Circle the option that correctly fills in the blank. 1. A(n) allows a single variable to reference multiple values. a) method b) array c) byte d) primitive data type 2. variables are non-static and are declared inside the class, but outside any method. a) Instance b) Class c) Local d) Static 3. A(n) connects machines in the same building or room. a) WAN b) ARPA c) TCP d) LAN 4. The result of compiling Java source code is called. a) compiler b) executable c) bytecode d) machine code 5. class FinalExam { private int numquestions; public double calcscore (int nummissed) { double percentage = (double) nummissed / numquestions; return (percentage); The scope of nummissed is the. a) class b) method c) variable d) object

Initials

Section II True or False [4 points each] Evaluate each Boolean expression as true or false, given int count = 0, sum = 54; double x = 4.3, y = 1.2; boolean wrong = true; 6. (wrong && (sum > 60)) 7. ((x > 5)!(sum == 55)) 8.!((y < 1.0) && (x > 4)) 9. ((count!= 4) (sum < 100) && (wrong)) 10. (!((count <= 0) && (sum > 25)) ((x < 10)!(y > 2)) && (!wrong)) Section III Short Answer 11. [4 points] List the four parts of every loop. 1. 2. 3. 4. 12. [5 points] Describe the difference between formal and actual parameters.

Initials

13. [5 points] Describe the difference between private and public variables. 14. [6 points] Given the operation of the following sort, identify the type of sort (selection or insertion). original array 3 7 1 6 2 after pass 1 3 7 1 6 2 after pass 2 1 3 7 6 2 after pass 3 1 3 6 7 2 after pass 4 1 2 3 6 7 15. [30 points] Translate the following English sentences into Java code. a) [10 points] Print all of the elements of an array of doubles called grades. b) [10 points] Print the minimum value in the grades array. c) [10 points] Print all of the odd integers between 0 and 100 inclusive.

Initials

16. [10 points] Write the exact output from the following code fragment: int[] array = {3, 6, 9, 12, 37; int count = 0; boolean found = false; while (!found) { if (array[count++] < 10) { System.out.println ( Items left to look at: ); for (int i = count; i<array.length; i++) System.out.print (array[i] + ); else found = true; System.out.println(); 17. [20 points] The class Can includes a public method, IsCrushed, which returns a boolean. a) [5 points] Write the code to declare a variable that can refer to an object of the Can class. b) [5 points] Write the code to create a new object of the Can class and assign it to the variable declared in part a. c) [10 points] Write the code to call the IsCrushed method using the object you created in part b and print the results of the method call.

Initials

18. [15 points] Write the exact output from the following program: class Arr { private double[] array = {1.4, 2.2, 3.6, 4.7, 5.1; public int getlength() { return (array.length); public double getelement (int ind) { return (array[ind]); public void swap (int ind1, int ind2) { double temp = array[ind1]; array[ind1] = array[ind2]; array[ind2] = temp; public static void main (String[] args) { Arr myarray = new Arr(); for (int i=0; i<myarray.getlength()-2; i++) myarray.swap (i, i+2); for (int i=0; i<myarray.getlength(); i++) System.out.print (myarray.getelement(i) + );

Initials

19. [30 points] The method mergearrays interleaves (merges, not concatenates) the contents of the two integer arrays (of the same size) into a new array that is returned from the method. (Note: the two arrays passed as parameters are unchanged.) a) [10 points] Write the exact output of the following code fragment: int[] busy = {4, 6, 23, 15, 100; int[] work = {45, 78, 1, 43, 89; int[] busywork = mergearrays (busy, work); for (int i=0; i<busywork.length; i++) System.out.print (busywork[i] + ); b) [20 points] Write the mergearrays method.

Initials

20. [35 points] Write nested for loops that produce the following output. (Hint: don t try to print the spaces and the # inside the same inner loop.) # ### ##### #######