3. Convert 2E from hexadecimal to decimal. 4. Convert from binary to hexadecimal

Size: px
Start display at page:

Download "3. Convert 2E from hexadecimal to decimal. 4. Convert from binary to hexadecimal"

Transcription

1 APCS A Midterm Review You will have a copy of the one page Java Quick Reference sheet. This is the same reference that will be available to you when you take the AP Computer Science exam. 1. n bits can represent exactly a) n different values b) 2n different values c) 2 n different values d) n 2 different values 2. Select the TRUE statement. a) 16 in base ten is equal to 1111 in base two. b) 16 in base 16 is equal to 10 in base ten. c) 16 in base ten is equal to 10 in base 16. d) 1111 in base ten is equal to 16 in base two. 3. Convert 2E from hexadecimal to decimal 4. Convert from binary to hexadecimal 5. How many assignment statements are in this code? 6. How many boolean expressions are in this code? int x; x = (int)(45*math.random()) - 7; if ( x == 12 ) System.out.println( "A" ); else if ( x > 10 ) x = x + 5; if ( x < 30 ) x = x + 2; else x = x - 11; System.out.println( x ); 7. Select the TRUE statement. a) The JVM compiles a java file into a class file. b) The JVM compiles a class file into a java file. c) The JVM translates the class file into Byte code and executes the program. d) The JVM translates Byte code in the class file into machine language and executes the program. 8. Select the FALSE statement. a) The JVM on a Windows computer is different than the JVM on an Apple computer. b) Mistakes detected by the compiler are called syntax errors or compile-time errors. c) An assignment statement assigns the value of the expression on the left to the variable on the right.

2 9. Select the FALSE statement. a) Some primitive data types are ints, doubles, and Strings. b) There are numeric literals and String literals. c) int17 is a valid variable name. d) A logic error will not be detected by the compiler. 10. What is the value of the expression on the right? a) 3 or 3.0 b) 4 or 4.0 c) 4.75 d) 5 or Select the TRUE statement. a) Line 2 generates a compiler error. b) Line 3 generates a compiler error. c) This compiles and runs. x equals 4, z equals 10. d) This compiles and runs. x equals 4, z equals What is the value of the expression on the right? a) 0.8 b) 2.0 c) 6 d) compiler error 13. What is the result of the code to the right? a) The code does not compile because you cannot assign a value of null to a string. b) The code does not compile because of a null pointer exception. c) The code compiles but throws a null pointer exception during run-time % 4 int x = 10; double z = 4; x = z; z = x; * 6 String s = null; double d = s.length(); System.out.println( d ); d) Code compiles and zero is displayed. 14. What is displayed? int count = 0; for ( int i = 3; i < 6; i++ ){ for ( int k = i; k < 8; k++ ){ count++; System.out.println( count ); 15. Select the FALSE statement. a) To use the Math class, you must first instantiate a Math object. b) The break statement is used to exit a loop early. c) To use the Math class, you do not need to instantiate a Math object. d) The abs methods of the Math class are an example of overloaded methods. 16. The value of n will be an integer so that a) 0 n 10 b) 0 n 11 c) 1 n 10 d) none of the above int n; n = (int) (10 * Math.random() );

3 17. Select the TRUE statement. a) 3.0 d < 50.0 b) 3.0 d 50.0 c) 3.0 d < 53.0 d) 3.0 d After the code executes, a) x = 7, y = 6, z = 5 b) x = 7, y = 6, z = 4 c) x = 7, y = 9, z = 5 d) x = 7, y = 9, z = After the code executes, a) a = 2, b = 8, c = 6 b) a = 3, b = 16, c = 4 c) Run-time error generated by c = c/a d) This is an endless loop. 20. What is printed by the last statement? a) 13 b) 14 c) The second line generates a compiler error. d) The last line generates a compiler error. double d; d = 50*Math.random() + 3; int x = 7, y = 6, z = 5; if (x!= 7 ) y++; else if (x = = y) y += 3; z - - ; int a = 0, b = 4, c = 12; while (b <= c) { a++; b *= a; c = c / a; int b = 10; for (int k = 5; k <=b; k++) { b -= 2; System.out.println(b + k); 21. Select the FALSE statement. a) Methods always have a return type and constructors never do. b) A class usually has instance variables but it doesn't have to. c) Class variables are created whenever an object is instantiated. d) "Garbage collection" refers to the process of deleting any unreferenced objects from memory. 22. The header for the clever method is: a) public void clever( int n ) b) public boolean clever() c) public boolean clever( int n ) d) There is not enough information to answer this question. Fox y = new Fox(); if ( y.clever( 5 ) ) y.win(); 23. Write a method named total that has two int parameters, begin and end, and returns the sum of the all integers between begin and end. For example, if the method is invoked with values of 5 and 7, then the method returns 18. You may assume that begin end.

4 24. Select the TRUE statement. a) x, y, and z are objects. b) x and z are objects. c) The objects created in lines 2 and 4 are equal. d) x and y reference the same object. 25. Given this method compiles, select the FALSE statement. a) This is an example of a mutator method. b) This is an example of an accessor method. c) value must be an instance or class variable. d) value is an int. 26. Select the TRUE statement. a) This method can change an object s state. b) This method cannot change an object s state. c) Not enough information was provided to determine if this method could or could not change an object s state. d) Moosylvania is a state. 27. Select the FALSE statement. a) This is code for a constructor. b) This is contained in a class named Xyz. c) y contains a reference to an object of the Abc class. d) x is a double; we have no clue what type y is. ClassA x, y, z; x = new ClassA(); y = x; z = new ClassA(); public int getvalue() { return value; public void met( int x ){ y = x; public Xyz(Abc g) { x = 0.0; y = g.action(); 28. Select the TRUE statement. a) Line 2 throws an IllegalArgumentException b) Line 2 throws an NullPointerException c) Line 4 throws an NullPointerException d) Line 3 throws an IllegalArgumentException public static void main( String [] args ){ String [] a = new String[4]; mz( a[2] ); public static void mz( String str ){ int n = str.length(); System.out.println( n ); 29. Suppose your design for a program includes two classes: Apple and Fruit. Which of the following is a good program design? a) Apple could be a subclass of Fruit. b) Fruit could be a subclass of Apple. c) It doesn t matter which one is the subclass and which one is the superclass. d) There is not enough information to say which could be a subclass of the other. 30. What range of values for x will cause code C to run? a) (x < -10) or (x > 0) b) (x < -10) or (0 < x < 5) c) (x < -10) and (x > 0) d) code C will never run 31. If x = 0, what code will run a) code A b) code B c) code D d) none of the above if (x >= 5 && x > -5) { if (x > 10) //code A else if (x <= 10) //code B else if ( x < -10 x > 0) // code C else // code D

5 32. Write the Mobile class that is a subclass of the Phone class. The constructor for the Mobile class has two parameters: the phone number (an int) and the battery life (an int). Mobile has one instance variable for the battery life. The Mobile class has a method named works that returns a boolean value. Every time the works method is called, the battery life decreases by 1. If the battery life is zero or negative, then the method returns false. Otherwise the works method behaves just like a regular phone. public class Phone { private int number; public Phone ( int n ){ number = n; public boolean works(){ // it s secret 33. Select the TRUE statement. a) This compiles. Under some circumstances it will run fine and the rest of the time there will be a run-time error. b) This does not compile. public void m5( Object x ){ String str = (String) x; int n = str.length(); System.out.println( n ); 34. What does this code display? for ( int n = 1; n < 4; n++ ) { for ( int k = n; k < 5; k++ ) System.out.print( "X" ); System.out.println(); 35. What does the code on the right do? a) z is the sum of all the elements in arr. b) z is the sum of all the indices in arr. c) z is the sum of the last two elements in arr. d) none of the above //arr is an array of ints of random values // the length of arr is an even number z = 0; for (int n = 0; n <arr.length - 1; n+=2) z = arr[n] + arr[n+1];

6 36. What values will get A to be printed? a) x = 6 and y = 15 b) x = -1 and y = 0 c) x = 2 and y = 4 d) x = 3 and y = Add one line that changes the title to Mona Lisa. If it cannot be done, write IMPOSSIBLE. Art y = new Art( "Mona Liza" ); 38. Add one line that changes the cost to 300. If it cannot be done, write IMPOSSIBLE. Art y = new Art("Chewbacca Fighting Nazis"); if ( (x < y) && (y >= 3*x) ) System.out.println("A"); else System.out.println("B"); public class Art{ public String title; private int cost; public Art( String s ){ title = s; cost = 100; public void change(int n){ setcost( 2*n ); private void setcost(int n){ cost = n; 39. Complete the method below so that the largest value in the two-dimensional array. You must use the private helper method. The methods are overloaded. public int max( int[][] a ) { private int max( int [] a ){ returns the maximum value in the array (assume it works) 40. Select the true statement. Consider the two methods in problem 39. a) The first max method overrides the second max method. b) The second max method overrides the first max method. c) The two max methods are overloaded. d) There s a problem with these method headers and they will not compile. The simplest solution would be to rename one of the methods.

7 41. Select the TRUE statement. a) The first line creates 50 Rat objects. b) The first line creates an array of 51 Rat reference variables. c) A total of 50 Rat object are instantiated but garbage collection deletes the first 49. d) The third line causes a compiler error. 42. What is printed? a) 5 b) 11 c) 20 d) 25 Rat [ ] b = new Rat[50]; for (int n = 0; n <b.length; n++) b[0] = new Rat(); int [] a = { 5, 8, 7 ; int k = 5; for ( int n : a ) k += n; System.out.println( k ); 43. What is the purpose of the keyword final as used in the code to the right? public class TV{ public final int x = 7; 44. What is displayed? Bug bed = new Bug( 6 ); Bug stink = new Bug( 3 ); int x = stink.mx( bed ); System.out.println( x ); public class Bug{ private int ugly; public Bug( int u ){ ugly = u; public int mx( Bug b ){ return ugly + 10*b.ugly; Problems 45 and 46. int [ ] arr = { 5, 0, -3, 2; 45. What is the value of the expression arr[1 + arr[3] ] a) 0 b) -3 c) 2 d) This is an invalid expression. 46. What is the value of the expression arr[ arr.length ] a) 0 b) -3 c) 2 d) This is an invalid expression. 47. What is the value of the expression to the right? 9 / What is the value of the expression to the right? (double) (5/4)

8 49. Write a method that has one parameter, a two-dimensional array of ints with at least one value in it. The method returns a one-dimensional array of ints that contains all of the values in the parameter. The values in the first column will be at the start of the one-dimensional array, followed by the values in the second column and so on. You may assume that the length of each row is the same. For example, if the 2D array is { then the method returns { 1, 4, 2, 5, 3, public int [] convert( int [][] a ){ _ 50. Select the TRUE statement. The variables a) may be either instance or class variables. b) must class variables. c) must instance variables. d) must local variables. 51. After the top three lines are run and the method is executed, the values of x and array z are a) z is {2, 2, 2, 2, 2 and x is 6 b) z is {4, 5, 6, 7, 8 and x is 6 c) z is {2, 2, 2, 2, 2 and x is 33 d) z is {4, 5, 6, 7, 8 and x is 33 public static void md(){ System.out.println( a + b ); int [ ] z = {4, 5, 6, 7, 8; int x = 6; notypos(z, x); ***************************** public void notypos (int [ ] p, int q) { for (int i = 0; i < p.length; i++) p[i] = 2; q = 33;

9 52. In the box on the right, write the result of the code on the left. for (int n = 0; n <= 3; n++) { for (int k = 0; k <= n; k++) System.out.print(k + " "); System.out.println(); 53. Write a method that returns the total number of times that the TH appears in the array. Assume that all letters are uppercase. Write and use a private helper method that counts the number of times TH appears in a single string. public int count( String [] s ){ private 54. Select the TRUE statement. The method m77 a) must be a class method. b) may be a class or instance method. 55. Select the TRUE statement. The method m44 a) must be a class method. b) may be a class or instance method. 56. An advantage of inheritance is that it reduces the amount of redundant code. public static void m88() { int n = m77(); public void m55() { int n = m44(); TRUE FALSE

10 57. What is displayed? public class Runner{ public static void main( String [] args ){ int [] a = { 5, 6, 7 ; String s = "bab"; mx( s, a ); System.out.println( s + "," + a[0] ); public static void mx( String s, int [] b ){ s += "y"; b[0] = 9; 58. What is displayed? public class Runner{ public static void main( String [] args ){ Ax y = new Ax( 23 ); int h = 70; my( y, h ); System.out.println( y + "," + h ); public static void my( Ax x, int z ){ x.set( 99 ); z = 33; public class Ax{ private int z; public Ax(int n){ z = 8; public void set(int n){ z = n; public String tostring(){ return "" + z; 59. If the array is {8, 5, 2, 7, what does the method return? 60. If the array is {9, 1, 17, 14, what does the method return? public int mm( int[] a ){ int z = a[0]; for ( int k = 1; k < a.length; k++ ){ if ( a[k] < a[k-1] ) z = a[k]; return z; 61. Line 6 generates the following compiler error: Cannot find symbol variable p. Why? for ( int k = 0; k <= 5; k++ ){ int p = 1; System.out.println( k + "," + p ); p++; System.out.println( p ); 62. What is the final value of n? String s = "needed"; int n = s.indexof("e", 0 ); n = s.indexof("e", n );

11 Problems 63 to 68 all refer to the code to the right. Assume the code compiles and runs. Manny moe = new Jack(); moe.methoda(); 63. Manny may be an abstract class. True False 64. Manny may be a superclass of Jack. True False 65. Manny may be a subclass of Jack. True False 66. Jack may be an abstract class. True False 67. Jack must be a class that implements, or inherits, methoda(). True False 68. Manny must have a methoda True False 70. What is displayed? String s = "washer"; s.substring( 3 ); System.out.println( s ); 71. If the string is SESSION, what does the method return? 72. Under what circumstances with there be a run-time error, or will there never be a runtime error? public int mx( String s ){ for ( int k = 0; k < s.length(); k++ ){ String s1 = s.substring( k, k+1 ); String s2 = s.substring( k+1, k+2 ); if ( s1.equals( s2 ) ) return k; else return k+ 1; return -1; 73. In the client code call the sort method and use array b as the argument. Then display the largest value in the returned array. Do not write any loops. // client code public class Clerk{ double [] b = new double[ 900 ]; private Clerk(){ for ( int i = 0; i < 900; i++) b[ i ] = 50000*Math.random() ; public static int [] sort( double [] a ){ /* this returns a copy of the parameter except all the numbers have been rounded and the contents have been sorted and put into increasing order */

12 74. If the string is BARN, what does the method return? public String mx( String s ){ String x = ""; for ( int k = 0; k < s.length(); k++ ){ String temp = s.substring( k, k+1 ); x = temp + x; return x; public class ABC { private int w; private static int x = 7; public ABC( int n) { x++; w = n; public String tostring() { return w + " " + x; Problems 75 and 76 refer to the above code. public class Runner { public static void main( String [] args ){ ABC h1 = new ABC( 14 ); ABC h2 = new ABC( 45 ); ABC h3 = new ABC( -2 ); System.out.println( h1 ); What is displayed when the main method is executed? 76. At the time that line 4 of the main method is being executed, how many w variables had been created? How many x variables had been created? 77. What does the client code display? If there s an error, write ERROR. AA ab = new BB(); System.out.println( ab.meth3() ); 78. What does the client code display? If there s an error, write ERROR. BB bb = new BB(); System.out.println( bb.meth3() ); 79. What does the client code display? If there s an error, write ERROR. AA ab = new BB(); System.out.println( ab.meth2() ); public class AA { public int meth1() { int x = 3 * meth2(); return x; public int meth2() { return 8; public class BB extends AA{ public int meth2() { return 7; public int meth3() { return 2*meth1();

AP CS Unit 7: Arrays Exercises

AP CS Unit 7: Arrays Exercises AP CS Unit 7: Arrays Exercises 1. What is displayed? int [] a = new int[ 3 ]; System.out.println(a.length ); 2. What is displayed? int [] sting = { 34, 23, 67, 89, 12 ; System.out.println( sting[ 1 ] );

More information

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8 Epic Test Review 1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4 Write a line of code that outputs the phase Hello World to the console without creating a new line character. System.out.print(

More information

Language Features. 1. The primitive types int, double, and boolean are part of the AP

Language Features. 1. The primitive types int, double, and boolean are part of the AP Language Features 1. The primitive types int, double, and boolean are part of the AP short, long, byte, char, and float are not in the subset. In particular, students need not be aware that strings are

More information

AP CS Unit 7: Interfaces Exercises Assume all code compiles unless otherwise suggested.

AP CS Unit 7: Interfaces Exercises Assume all code compiles unless otherwise suggested. AP CS Unit 7: Interfaces Exercises Assume all code compiles unless otherwise suggested. 1. The Nose class... b) will not compile because the m1 method parameter should be named n, not x. 2. The Ears class...

More information

AP Computer Science Chapter 10 Implementing and Using Classes Study Guide

AP Computer Science Chapter 10 Implementing and Using Classes Study Guide AP Computer Science Chapter 10 Implementing and Using Classes Study Guide 1. A class that uses a given class X is called a client of X. 2. Private features of a class can be directly accessed only within

More information

NATIONAL UNIVERSITY OF SINGAPORE

NATIONAL UNIVERSITY OF SINGAPORE NATIONAL UNIVERSITY OF SINGAPORE SCHOOL OF COMPUTING TERM TEST #1 Semester 1 AY2006/2007 CS1101X/Y/Z PROGRAMMING METHODOLOGY 16 September 2006 Time Allowed: 60 Minutes INSTRUCTIONS 1. This question paper

More information

AP CS Unit 6: Inheritance Exercises

AP CS Unit 6: Inheritance Exercises AP CS Unit 6: Inheritance Exercises 1. Suppose your program contains two classes: a Student class and a Female class. Which of the following is true? a) Making the Student class a subclass of the Female

More information

Unit 4: Classes and Objects Notes

Unit 4: Classes and Objects Notes Unit 4: Classes and Objects Notes AP CS A Another Data Type. So far, we have used two types of primitive variables: ints and doubles. Another data type is the boolean data type. Variables of type boolean

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

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

APCS Semester #1 Final Exam Practice Problems

APCS Semester #1 Final Exam Practice Problems Name: Date: Per: AP Computer Science, Mr. Ferraro APCS Semester #1 Final Exam Practice Problems The problems here are to get you thinking about topics we ve visited thus far in preparation for the semester

More information

AP CS Unit 7: Interfaces Exercises 1. Select the TRUE statement(s).

AP CS Unit 7: Interfaces Exercises 1. Select the TRUE statement(s). AP CS Unit 7: Interfaces Exercises 1. Select the TRUE statement(s). a) This code will not compile because a method cannot specify an interface as a parameter. public class Testing { public static void

More information

Unit 5: More on Classes/Objects Exercises

Unit 5: More on Classes/Objects Exercises Unit 5: More on Classes/Objects Exercises AP CS A 1. Select the TRUE statement. a) This does not compile. b) This does compile.. Select the TRUE statement. a) This does not compile. b) This does compile.

More information

Practice Questions for Final Exam: Advanced Java Concepts + Additional Questions from Earlier Parts of the Course

Practice Questions for Final Exam: Advanced Java Concepts + Additional Questions from Earlier Parts of the Course : Advanced Java Concepts + Additional Questions from Earlier Parts of the Course 1. Given the following hierarchy: class Alpha {... class Beta extends Alpha {... class Gamma extends Beta {... In what order

More information

AP CS Unit 8: Inheritance Exercises

AP CS Unit 8: Inheritance Exercises AP CS Unit 8: Inheritance Exercises public class Animal{ System.out.print("A"); public void m2(){ System.out.print("B"); public class Dog extends Animal{ System.out.print("C"); public void m3(){ System.out.print("D");

More information

CS 231 Data Structures and Algorithms, Fall 2016

CS 231 Data Structures and Algorithms, Fall 2016 CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard

More information

if (x == 0); System.out.println( x=0 ); if (x = 0) System.out.println( x=0 );

if (x == 0); System.out.println( x=0 ); if (x = 0) System.out.println( x=0 ); Sample Final Exam 1. Evaluate each of the following expressions and show the result and data type of each: Expression Value Data Type 14 % 5 1 / 2 + 1 / 3 + 1 / 4 4.0 / 2.0 Math.pow(2.0, 3.0) (double)(2

More information

TeenCoder : Java Programming (ISBN )

TeenCoder : Java Programming (ISBN ) TeenCoder : Java Programming (ISBN 978-0-9887070-2-3) and the AP * Computer Science A Exam Requirements (Alignment to Tennessee AP CS A course code 3635) Updated March, 2015 Contains the new 2014-2015+

More information

Points To Remember for SCJP

Points To Remember for SCJP Points To Remember for SCJP www.techfaq360.com The datatype in a switch statement must be convertible to int, i.e., only byte, short, char and int can be used in a switch statement, and the range of the

More information

Chapter 6 Introduction to Defining Classes

Chapter 6 Introduction to Defining Classes Introduction to Defining Classes Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives Design and implement a simple class from user requirements. Organize a program in terms of

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

CompuScholar, Inc. 9th - 12th grades

CompuScholar, Inc. 9th - 12th grades CompuScholar, Inc. Alignment to the College Board AP Computer Science A Standards 9th - 12th grades AP Course Details: Course Title: Grade Level: Standards Link: AP Computer Science A 9th - 12th grades

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

AP Computer Science A Unit 7. Notes on Arrays

AP Computer Science A Unit 7. Notes on Arrays AP Computer Science A Unit 7. Notes on Arrays Arrays. An array is an object that consists of an of similar items. An array has a single name and the items in an array are referred to in terms of their

More information

Selected Questions from by Nageshwara Rao

Selected Questions from  by Nageshwara Rao Selected Questions from http://way2java.com by Nageshwara Rao Swaminathan J Amrita University swaminathanj@am.amrita.edu November 24, 2016 Swaminathan J (Amrita University) way2java.com (Nageshwara Rao)

More information

FORM 2 (Please put your name and form # on the scantron!!!!)

FORM 2 (Please put your name and form # on the scantron!!!!) CS 161 Exam 2: FORM 2 (Please put your name and form # on the scantron!!!!) True (A)/False(B) (2 pts each): 1. Recursive algorithms tend to be less efficient than iterative algorithms. 2. A recursive function

More information

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java

More information

c) And last but not least, there are javadoc comments. See Weiss.

c) And last but not least, there are javadoc comments. See Weiss. CSCI 151 Spring 2010 Java Bootcamp The following notes are meant to be a quick refresher on Java. It is not meant to be a means on its own to learn Java. For that you would need a lot more detail (for

More information

a) Answer all questions. b) Write your answers in the space provided. c) Show all calculations where applicable.

a) Answer all questions. b) Write your answers in the space provided. c) Show all calculations where applicable. Name: Please fill in your Student Number and Name. Student Number : Student Number: University of Cape Town ~ Department of Computer Science Computer Science 1015F ~ 2008 January Exam Question Max Internal

More information

1 Shyam sir JAVA Notes

1 Shyam sir JAVA Notes 1 Shyam sir JAVA Notes 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write

More information

Programming Language Concepts: Lecture 2

Programming Language Concepts: Lecture 2 Programming Language Concepts: Lecture 2 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2009 PLC 2009, Lecture 2, 19 January 2009 Classes and

More information

CISC-124. Passing Parameters. A Java method cannot change the value of any of the arguments passed to its parameters.

CISC-124. Passing Parameters. A Java method cannot change the value of any of the arguments passed to its parameters. CISC-124 20180215 These notes are intended to summarize and clarify some of the topics that have been covered recently in class. The posted code samples also have extensive explanations of the material.

More information

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012 MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012 Instructor: K. S. Booth Time: 70 minutes (one hour ten minutes)

More information

COMPUTER APPLICATIONS

COMPUTER APPLICATIONS COMPUTER APPLICATIONS (Theory) (Two Hours) Answers to this Paper must be written on the paper provided separately. You will not be allowed to write during the first 15 minutes. This time is to be spent

More information

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring Java Outline Java Models for variables Types and type checking, type safety Interpretation vs. compilation Reasoning about code CSCI 2600 Spring 2017 2 Java Java is a successor to a number of languages,

More information

Objects and Classes. 1 Creating Classes and Objects. CSCI-UA 101 Objects and Classes

Objects and Classes. 1 Creating Classes and Objects. CSCI-UA 101 Objects and Classes Based on Introduction to Java Programming, Y. Daniel Liang, Brief Version, 10/E 1 Creating Classes and Objects Classes give us a way of defining custom data types and associating data with operations on

More information

CS 101 Exam 1 Spring 200 Id Name

CS 101 Exam 1 Spring 200  Id Name This exam is open text book and closed notes. Different questions have different points associated with them with later occurring questions having more worth than the beginning questions. Because your

More information

Programming Language Concepts: Lecture 2

Programming Language Concepts: Lecture 2 Programming Language Concepts: Lecture 2 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2011 PLC 2011, Lecture 2, 6 January 2011 Classes and

More information

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

Prelim 1 Solutions. CS 2110, March 10, 2015, 5:30 PM Total Question True False. Loop Invariants Max Score Grader Prelim 1 Solutions CS 2110, March 10, 2015, 5:30 PM 1 2 3 4 5 Total Question True False Short Answer Recursion Object Oriented Loop Invariants Max 20 15 20 25 20 100 Score Grader The exam is closed book

More information

1. Java is a... language. A. moderate typed B. strogly typed C. weakly typed D. none of these. Answer: B

1. Java is a... language. A. moderate typed B. strogly typed C. weakly typed D. none of these. Answer: B 1. Java is a... language. A. moderate typed B. strogly typed C. weakly typed D. none of these 2. How many primitive data types are there in Java? A. 5 B. 6 C. 7 D. 8 3. In Java byte, short, int and long

More information

Computer Components. Software{ User Programs. Operating System. Hardware

Computer Components. Software{ User Programs. Operating System. Hardware Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point

More information

Index COPYRIGHTED MATERIAL

Index COPYRIGHTED MATERIAL Index COPYRIGHTED MATERIAL Note to the Reader: Throughout this index boldfaced page numbers indicate primary discussions of a topic. Italicized page numbers indicate illustrations. A abstract classes

More information

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this

More information

Operators and Expressions

Operators and Expressions Operators and Expressions Conversions. Widening and Narrowing Primitive Conversions Widening and Narrowing Reference Conversions Conversions up the type hierarchy are called widening reference conversions

More information

https://asd-pa.perfplusk12.com/admin/admin_curric_maps_display.aspx?m=5507&c=618&mo=18917&t=191&sy=2012&bl...

https://asd-pa.perfplusk12.com/admin/admin_curric_maps_display.aspx?m=5507&c=618&mo=18917&t=191&sy=2012&bl... Page 1 of 13 Units: - All - Teacher: ProgIIIJavaI, CORE Course: ProgIIIJavaI Year: 2012-13 Intro to Java How is data stored by a computer system? What does a compiler do? What are the advantages of using

More information

Full file at

Full file at Chapter 1 Primitive Java Weiss 4 th Edition Solutions to Exercises (US Version) 1.1 Key Concepts and How To Teach Them This chapter introduces primitive features of Java found in all languages such as

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

I pledge by honor that I will not discuss this exam with anyone until my instructor reviews the exam in the class.

I pledge by honor that I will not discuss this exam with anyone until my instructor reviews the exam in the class. Name: Covers Chapters 1-3 50 mins CSCI 1301 Introduction to Programming Armstrong Atlantic State University Instructor: Dr. Y. Daniel Liang I pledge by honor that I will not discuss this exam with anyone

More information

boolean, char, class, const, double, else, final, float, for, if, import, int, long, new, public, return, static, throws, void, while

boolean, char, class, const, double, else, final, float, for, if, import, int, long, new, public, return, static, throws, void, while CSCI 150 Fall 2007 Java Syntax The following notes are meant to be a quick cheat sheet for Java. It is not meant to be a means on its own to learn Java or this course. For that you should look at your

More information

A First Look At Java. Didactic Module 13 Programming Languages - EEL670 1

A First Look At Java. Didactic Module 13 Programming Languages - EEL670 1 A First Look At Java Didactic Module 13 Programming Languages - EEL670 1 Outline Thinking about objects Simple expressions and statements Class definitions About references and pointers Getting started

More information

Unit 10: Sorting/Searching/Recursion

Unit 10: Sorting/Searching/Recursion Unit 10: Sorting/Searching/Recursion Notes AP CS A Searching. Here are two typical algorithms for searching a collection of items (which for us means an array or a list). A Linear Search starts at the

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

Computer Components. Software{ User Programs. Operating System. Hardware

Computer Components. Software{ User Programs. Operating System. Hardware Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point

More information

COE318 Lecture Notes Week 10 (Nov 7, 2011)

COE318 Lecture Notes Week 10 (Nov 7, 2011) COE318 Software Systems Lecture Notes: Week 10 1 of 5 COE318 Lecture Notes Week 10 (Nov 7, 2011) Topics More about exceptions References Head First Java: Chapter 11 (Risky Behavior) The Java Tutorial:

More information

CSC 240 Computer Science III Spring 2018 Midterm Exam. Name

CSC 240 Computer Science III Spring 2018 Midterm Exam. Name CSC 240 Computer Science III Spring 2018 Midterm Exam Name Page Points Score 2 9 4-6 53 7-10 38 Total 100 1 P age 1. Tracing programs (1 point each value): For each snippet of Java code on the left, write

More information

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

CSCI 135 Exam #2 Fundamentals of Computer Science I Fall 2013 CSCI 135 Exam #2 Fundamentals of Computer Science I Fall 2013 Name: This exam consists of 6 problems on the following 6 pages. You may use your two-sided hand-written 8 ½ x 11 note sheet during the exam.

More information

Birkbeck (University of London) Software and Programming 1 In-class Test Mar Answer ALL Questions

Birkbeck (University of London) Software and Programming 1 In-class Test Mar Answer ALL Questions Birkbeck (University of London) Software and Programming 1 In-class Test 2.1 16 Mar 2017 Student Name Student Number Answer ALL Questions 1. What output is produced when the following Java program fragment

More information

Array. Prepared By - Rifat Shahriyar

Array. Prepared By - Rifat Shahriyar Java More Details Array 2 Arrays A group of variables containing values that all have the same type Arrays are fixed length entities In Java, arrays are objects, so they are considered reference types

More information

Computer Science 2 Lecture 4 Inheritance: Trinidad Fruit Stand 02/15/2014 Revision : 1.7

Computer Science 2 Lecture 4 Inheritance: Trinidad Fruit Stand 02/15/2014 Revision : 1.7 Computer Science 2 Lecture 4 Inheritance: Trinidad Fruit Stand 02/15/2014 Revision : 1.7 1 Problem Ralph owns the Trinidad Fruit Stand that sells its fruit on the street, and he wants to use a computer

More information

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

CSCI 135 Exam #2 Fundamentals of Computer Science I Fall 2013 CSCI 135 Exam #2 Fundamentals of Computer Science I Fall 2013 Name: This exam consists of 6 problems on the following 6 pages. You may use your two-sided hand-written 8 ½ x 11 note sheet during the exam.

More information

Class, Variable, Constructor, Object, Method Questions

Class, Variable, Constructor, Object, Method Questions Class, Variable, Constructor, Object, Method Questions http://www.wideskills.com/java-interview-questions/java-classes-andobjects-interview-questions https://www.careerride.com/java-objects-classes-methods.aspx

More information

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

1. Which of the following is the correct expression of character 4? a. 4 b. 4 c. '\0004' d. '4' Practice questions: 1. Which of the following is the correct expression of character 4? a. 4 b. "4" c. '\0004' d. '4' 2. Will System.out.println((char)4) display 4? a. Yes b. No 3. The expression "Java

More information

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance Contents Topic 04 - Inheritance I. Classes, Superclasses, and Subclasses - Inheritance Hierarchies Controlling Access to Members (public, no modifier, private, protected) Calling constructors of superclass

More information

CS260 Intro to Java & Android 03.Java Language Basics

CS260 Intro to Java & Android 03.Java Language Basics 03.Java Language Basics http://www.tutorialspoint.com/java/index.htm CS260 - Intro to Java & Android 1 What is the distinction between fields and variables? Java has the following kinds of variables: Instance

More information

CS 102/107 - Introduction to Programming Midterm Exam #2 - Prof. Reed Spring 2011

CS 102/107 - Introduction to Programming Midterm Exam #2 - Prof. Reed Spring 2011 CS 102/107 - Introduction to Programming Midterm Exam #2 - Prof. Reed Spring 2011 What is your name?: This test has the following sections: I. True/False... 60 points; (30 questions, 2 points each) II.

More information

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

SPRING 13 CS 0007 FINAL EXAM V2 (Roberts) Your Name: A pt each. B pt each. C pt each. D or 2 pts each Your Name: Your Pitt (mail NOT peoplesoft) ID: Part Question/s Points available Rubric Your Score A 1-6 6 1 pt each B 7-12 6 1 pt each C 13-16 4 1 pt each D 17-19 5 1 or 2 pts each E 20-23 5 1 or 2 pts

More information

Account joeacct = new Account (100, new Account (500)); Account joeacct = new Account (100, new Account (500, null));

Account joeacct = new Account (100, new Account (500)); Account joeacct = new Account (100, new Account (500, null)); Exam information 369 students took the exam. Scores ranged from 1 to 20, with a median of 11 and an average of 11.1. There were 40 scores between 15.5 and 20, 180 between 10.5 and 15, 132 between 5.5 and

More information

Chapter 1: Introduction to Computers, Programs, and Java

Chapter 1: Introduction to Computers, Programs, and Java Chapter 1: Introduction to Computers, Programs, and Java 1. Q: When you compile your program, you receive an error as follows: 2. 3. %javac Welcome.java 4. javac not found 5. 6. What is wrong? 7. A: Two

More information

DOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS

DOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS Chapter 1 : Chapter-wise Java Multiple Choice Questions and Answers Interview MCQs Java Programming questions and answers with explanation for interview, competitive examination and entrance test. Fully

More information

CS Week 5. Jim Williams, PhD

CS Week 5. Jim Williams, PhD CS 200 - Week 5 Jim Williams, PhD The Study Cycle Check Am I using study methods that are effective? Do I understand the material enough to teach it to others? http://students.lsu.edu/academicsuccess/studying/strategies/tests/studying

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

https://asd-pa.perfplusk12.com/admin/admin_curric_maps_display.asp...

https://asd-pa.perfplusk12.com/admin/admin_curric_maps_display.asp... 1 of 8 8/27/2014 2:15 PM Units: Teacher: ProgIIIAPCompSci, CORE Course: ProgIIIAPCompSci Year: 2012-13 Computer Systems This unit provides an introduction to the field of computer science, and covers the

More information

PROGRAMMING FUNDAMENTALS

PROGRAMMING FUNDAMENTALS PROGRAMMING FUNDAMENTALS Q1. Name any two Object Oriented Programming languages? Q2. Why is java called a platform independent language? Q3. Elaborate the java Compilation process. Q4. Why do we write

More information

AP CS Unit 6: Inheritance Notes

AP CS Unit 6: Inheritance Notes AP CS Unit 6: Inheritance Notes Inheritance is an important feature of object-oriented languages. It allows the designer to create a new class based on another class. The new class inherits everything

More information

Write the letter of the correct answer for each problem in the blanks on the answer form.

Write the letter of the correct answer for each problem in the blanks on the answer form. APCS A Review Write the letter of the correct answer for each problem in the blanks on the answer form. 1. Which of the following boolean expressions evaluates to true given the boolean variables a = true,

More information

CS201- Introduction to Programming Current Quizzes

CS201- Introduction to Programming Current Quizzes CS201- Introduction to Programming Current Quizzes Q.1 char name [] = Hello World ; In the above statement, a memory of characters will be allocated 13 11 12 (Ans) Q.2 A function is a block of statements

More information

Java for Non Majors. Final Study Guide. April 26, You will have an opportunity to earn 20 extra credit points.

Java for Non Majors. Final Study Guide. April 26, You will have an opportunity to earn 20 extra credit points. Java for Non Majors Final Study Guide April 26, 2017 The test consists of 1. Multiple choice questions 2. Given code, find the output 3. Code writing questions 4. Code debugging question 5. Short answer

More information

Subclass Gist Example: Chess Super Keyword Shadowing Overriding Why? L10 - Polymorphism and Abstract Classes The Four Principles of Object Oriented

Subclass Gist Example: Chess Super Keyword Shadowing Overriding Why? L10 - Polymorphism and Abstract Classes The Four Principles of Object Oriented Table of Contents L01 - Introduction L02 - Strings Some Examples Reserved Characters Operations Immutability Equality Wrappers and Primitives Boxing/Unboxing Boxing Unboxing Formatting L03 - Input and

More information

Final Exam Practice Questions

Final Exam Practice Questions Final Exam Practice Questions 1. Short Answer Questions (10 points total) (a) Given the following hierarchy: class Alpha {... class Beta extends Alpha {... class Gamma extends Beta {... What order are

More information

AP CS Unit 6: Inheritance Programs

AP CS Unit 6: Inheritance Programs AP CS Unit 6: Inheritance Programs Program 1. Complete the Rectangle class. The Rectangle public class Rectangle{ class represents private int x1, y1, x2, y2; a rectangle in a standard coordinate plane

More information

Quiz 1 Unit 5A Arrays/Static Name

Quiz 1 Unit 5A Arrays/Static Name Quiz 1 Unit 5A Arrays/Static Name 1. What values are stored in arr after the following code segment has been executed? int[] arr = 1, 2, 3, 4, 5, 6, 7, 8; for (int k = 1; k

More information

CSCI 135 Exam #1 Fundamentals of Computer Science I Fall 2014

CSCI 135 Exam #1 Fundamentals of Computer Science I Fall 2014 CSCI 135 Exam #1 Fundamentals of Computer Science I Fall 2014 Name: This exam consists of 8 problems on the following 8 pages. You may use your two- sided hand- written 8 ½ x 11 note sheet during the exam.

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

Fall CS 101: Test 2 Name UVA ID. Grading. Page 1 / 4. Page3 / 20. Page 4 / 13. Page 5 / 10. Page 6 / 26. Page 7 / 17.

Fall CS 101: Test 2 Name UVA  ID. Grading. Page 1 / 4. Page3 / 20. Page 4 / 13. Page 5 / 10. Page 6 / 26. Page 7 / 17. Grading Page 1 / 4 Page3 / 20 Page 4 / 13 Page 5 / 10 Page 6 / 26 Page 7 / 17 Page 8 / 10 Total / 100 1. (4 points) What is your course section? CS 101 CS 101E Pledged Page 1 of 8 Pledged The following

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

More on methods and variables. Fundamentals of Computer Science Keith Vertanen

More on methods and variables. Fundamentals of Computer Science Keith Vertanen More on methods and variables Fundamentals of Computer Science Keith Vertanen Terminology of a method Goal: helper method than can draw a random integer between start and end (inclusive) access modifier

More information

CS 302 Week 9. Jim Williams

CS 302 Week 9. Jim Williams CS 302 Week 9 Jim Williams This Week P2 Milestone 3 Lab: Instantiating Classes Lecture: Wrapper Classes More Objects (Instances) and Classes Next Week: Spring Break Will this work? Double d = new Double(10);

More information

Unit 5: More on Classes/Objects Notes

Unit 5: More on Classes/Objects Notes Unit 5: More on Classes/Objects Notes AP CS A The Difference between Primitive and Object/Reference Data Types First, remember the definition of a variable. A variable is a. So, an obvious question is:

More information

Chapter 11 Inheritance and Polymorphism. Motivations. Suppose you will define classes to model circles,

Chapter 11 Inheritance and Polymorphism. Motivations. Suppose you will define classes to model circles, Chapter 11 Inheritance and Polymorphism 1 Motivations Suppose you will define classes to model circles, rectangles, and triangles. These classes have many common features. What is the best way to design

More information

Introduction to Java https://tinyurl.com/y7bvpa9z

Introduction to Java https://tinyurl.com/y7bvpa9z Introduction to Java https://tinyurl.com/y7bvpa9z Eric Newhall - Laurence Meyers Team 2849 Alumni Java Object-Oriented Compiled Garbage-Collected WORA - Write Once, Run Anywhere IDE Integrated Development

More information

Term 1 Unit 1 Week 1 Worksheet: Output Solution

Term 1 Unit 1 Week 1 Worksheet: Output Solution 4 Term 1 Unit 1 Week 1 Worksheet: Output Solution Consider the following what is output? 1. System.out.println("hot"); System.out.println("dog"); Output hot dog 2. System.out.print("hot\n\t\t"); System.out.println("dog");

More information

CS 113 PRACTICE FINAL

CS 113 PRACTICE FINAL CS 113 PRACTICE FINAL There are 13 questions on this test. The value of each question is: 1-10 multiple choice (4 pt) 11-13 coding problems (20 pt) You may get partial credit for questions 11-13. If you

More information

CMP 326 Midterm Fall 2015

CMP 326 Midterm Fall 2015 CMP 326 Midterm Fall 2015 Name: 1) (30 points; 5 points each) Write the output of each piece of code. If the code gives an error, write any output that would happen before the error, and then write ERROR.

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 Supplementary Examination Question

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

Advanced Java Concepts Unit 2: Linked Lists.

Advanced Java Concepts Unit 2: Linked Lists. Advanced Java Concepts Unit 2: Linked Lists. The List interface defines the structure of a linear collection. Here are some of its methods. boolean add( E element ) Appends the element to the end of the

More information

CSCI 355 Lab #2 Spring 2007

CSCI 355 Lab #2 Spring 2007 CSCI 355 Lab #2 Spring 2007 More Java Objectives: 1. To explore several Unix commands for displaying information about processes. 2. To explore some differences between Java and C++. 3. To write Java applications

More information

CS 251 Intermediate Programming Methods and Classes

CS 251 Intermediate Programming Methods and Classes CS 251 Intermediate Programming Methods and Classes Brooke Chenoweth University of New Mexico Fall 2018 Methods An operation that can be performed on an object Has return type and parameters Method with

More information

CS 251 Intermediate Programming Methods and More

CS 251 Intermediate Programming Methods and More CS 251 Intermediate Programming Methods and More Brooke Chenoweth University of New Mexico Spring 2018 Methods An operation that can be performed on an object Has return type and parameters Method with

More information

CSE 143 SAMPLE MIDTERM

CSE 143 SAMPLE MIDTERM CSE 143 SAMPLE MIDTERM 1. (5 points) In some methods, you wrote code to check if a certain precondition was held. If the precondition did not hold, then you threw an exception. This leads to robust code

More information