New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Java: Final Exam Study Guide

by: SloanTheSloth

Java: Final Exam Study Guide COMP1210

Marketplace > Auburn University > Arts and Humanities > COMP1210 > Java Final Exam Study Guide
GPA 3.0

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

73 question long all-inclusive, cumulative study guide for the final. (STUDENT MADE)
Fundamentals of Computing I
James H Cross
Study Guide
java, final, auburn, comp1210
50 ?




Popular in Fundamentals of Computing I

Popular in Arts and Humanities

This 11 page Study Guide was uploaded by SloanTheSloth on Monday April 25, 2016. The Study Guide belongs to COMP1210 at Auburn University taught by James H Cross in Winter 2016. Since its upload, it has received 135 views. For similar materials see Fundamentals of Computing I in Arts and Humanities at Auburn University.


Reviews for Java: Final Exam Study Guide


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 04/25/16
STUDENT MADE FINAL EXAM STUDY GUIDE: 1. When an object is no longer referenced, its memory is returned to the system for future use when automatic __________ is done by the Java runtime system. a. Encapsulation b. White boxing c. Garbage collection d. autoboxing 2. In which of the following lines of code will a run-time error occur when it is executed? a. int nums = new int[10]; b. for(int i = 0; i <=nums.length; i++){ c. nums[i] = I; } d. System.out.println(nums); 3. Which of the following is not true about identifiers? a. An identifier can begin with a digit b. An Identifier can contain a dollar sign. c. An identifier can begin with an underscore. d. All of the above Use the following code to answer questions 4-6. int x = 10; char choice = _______; switch choice{ case ‘A’: x=x+7; break; case ‘S’: x=x-5; case ‘M’: x*= -2; case ‘R’: x %= 2; break; default: x = -1; 4. When choice = ‘m’ and the code is executed, what is the value of x? a. 1 b. -1 c. -2 d. 0 5. When choice = ‘A’ and the code is executed, what is the resulting value of x? a. 0 b. -10 c. -1 d. 17 6. When choice = ‘S’ and the executed, what is the value of x? a. -10 b. 5 c. 0 d. -1 7. The java compiler processes __________ to create ___________. a. Java bytecode, Java source code b. Java bytecode, machine code c. Machine code, java source code d. Java source code, java bytecode 8. If your software compiles and executes without complaint but produces incorrect results, then your code contains what kind of error? a. Style error b. Compile-time error c. Logical error d. User error 9. Which of the following is an escape sequence? a. \r b. ++ c. // d. /t 10.Data conversion from one type to another can be done by which of the following? a. Promotion b. Casting c. Assignment conversion d. All of the above 11.True/false: The java compiler will read and interpret indentation as a substitute for braces. a. True b. False 12.Assume that the following lines of code are run consecutively. Choose the line in which casting takes place. a. int a = 4/3; b. double b = (double) a /2; c. a++; d. float c = (a+2)/5.0; 13.True/false: If atleast one of the operands of the binary operator ‘+’ is a String, then the operator will be considered String concatenation and the result will be a String. a. True b. False 14.Which of the following is an integrated development environment (IDE)? a. Web-CAT b. Junit c. JGrasp d. Checkstyle 15.Which of the following is a widening conversion? a. Float to int b. Int to short c. Short to byte d. Int to double 16.True/False: After the following lines of code have been executed, the value referenced by myString will be “war 3agl3”. String myString = “war eagle”; myString.replace(‘e’, ‘3’); a. True b. False 17.True/False: Once an array is declared to be a certain length, the number of elements the array can hold cannot be changed. a. True b. False 18.What reserved word can be used to end the execution of a loop? a. this b. continue c. final d. break 19.A __________ is a name for a memory location used to reference or hold a value of a particular data type. a. Reference b. Variable c. Scanner d. Array 20.What is printed to standard output based on the following lines of code? double x = 8.765309; DecimalFormat form = new DecimalFormat(“0.0#”); System.out.print(form.format(x)); a. 0.07 b. 8.76 c. 8.07 d. 8.77 21.What type of error will occur if a static method attempts to access an instance variable? a. Run-time error b. Junit error c. Compile-time error d. Logical error 22.Which of the following describes the concept of aliases in Java? a. Two or more primitive types that refer to the same String b. Two or more variables that refer to the same object c. Two or more classes that refer to the same String d. Two or more objects that refer to the same primitive type 23.Which part of a method must be modified in order for it to be overloaded? a. Parameters of the method b. Return type of the method c. Name of the method d. None of the above 24.Given an ArrayList called list with thirteen objects, which of the following would retrieve the thirteenth element from the list? a. list[12] b. list.get(12) c. list[13] d. list.get(13) 25.True/false: Variables declared inside of a method can be used throughout the class. a. True b. False 26.A java application has a class containing a ___________. a. Main method b. Mutator method c. Constructor d. All of the above 27.Two or more references that refer to the same object are called __________. a. Relatives b. Siblings c. Aliases d. Twins 28.True/False: The following line of code will modify both newStr and away. String newStr = away.replace(‘o’, ‘0’); a. True b. False 29.Which of the following should be avoided becauyse it violates encapsulation? a. Private method b. Public method c. Private instance variable d. Public instance variable 30.What is the value of myBoolean after the following lines of code have been executed? String str1 = new String(“COMP 1210”); String str2 = new String(“COMP 1210”); Boolean myBoolean = (str1 == str2); a. True b. False 31. In the statement: import; The ________ class is being imported from the _______ package a. java, io.File b., File c. File, d. io.File, java 32.What is the output of the following code? int num = 2; do{ System.out.print(num + “&”); } while (num < 0); a. 3& b. 2& c. 2&3& d. There is an infinite loop. 33.True/false: After the following lines of code, myInt is 13. int myNum = 3; int myInt = 5 * 2 + (myNum++); a. True b. False 34.Which of the following are access modifiers for instance variables and methods? a. public b. private c. protected d. All of the above 35.When a method is called, the values of the ___________ parameters are copied from the _________ parameters. a. Actual, encapsulated b. Encapsulated, restricted c. Formal, actual d. Actual, formal 36.Which of the following is true concerning the array myNumbers? int[] myNumbers = new int[10]; a. myNumbers[0] causes an ArrayIndexOutOfBoundsException b. myNumbers.size() evaluates to 10 c. myNumbers contains 10 null values d. myNumbers contains 10 elements all set to 0. 37.True/false: An ArrayList holds reference types as elements whereas an array can only hold primitive types as elements. a. True b. False 38.Assuming that x, y, and z are of type double, which of the following lines of code matches the equation below? √z x = |x+y| a. x = Math.abs(x+y) ^ math.sqrt(z); b. x = Math.pow(x+y, math.abs(Math.sqrt(z))); c. x = Math.pow(Math.abs(x + y), Math.sqrt(z)); d. x = Math.abs (x+y) ^ Math.sqrt(z); 39.What types of methods can be invoked through the class name (no object of the class is needed)? a. static b. public c. protected d. private 40.True/false: When using the assignment operator, the expression on the left side is evaluated before being stored in the variable on the right side. a. True b. False 41.Which of the following is not a primitive type? a. boolean b. int c. byte d. String 42.Relational operators work with _________ while logical operators work with __________. a. Primitive types, Boolean types b. Boolean types, string types c. Primitive types, reference types d. String types, primitive types 43.In loop statements, such as the while loop, a __________ statement when executed will skip the rest of the code in that iteration of the loop and then attempt the next iteration. a. Continue b. Skip c. Next d. Break 44. __________ define the meaning of programming statements, while _________ dictate how to form programing statements a. Syntax, semantics b. Syntax Languages c. Semantics, syntax d. None of the above 45.Which of the following lines of code properly convers the string “13” to an int? a. int x = String.toInt(“13”); b. int x = Integer.parse(“13”); c. int x = String.toInteger(“13”); d. int x = Integer.parseInt(“13”); 46._______ class diagrams show relationships among the classes in a program. a. XML b. UML c. MXL d. None of the above 47.What is the output of the following code segment? int x = 0; y = 12; double z = 2.7; while (z < y) { x += 1; z + = (x * 3) } a. 4, 20.7 b. 0, 5.7 c. 2, 11.7 d. 3, 20.7 48.What is the value of myNum after the following line of code is executed? double myNum = 3 + 17 / 4 * 2; a. 11.0 b. 11.5 c. 2.5 d. 2.0 49.When a _________ error occurs the program’s execution halts abnormally. a. Logical b. Style c. Run-time d. Compile-time 50.The _________ phase of development produces the source code for the software. a. Design b. Maintenance c. Construction d. Testing 51.True/false Instance methods can reference both instance and static methods. a. True b. False 52.A test case (or method) __________ indicates that a __________ was encountered during the execution of the test case (or method). a. Defect/bug b. Error/bug c. Bug/failure d. Failure/defect 53.When analyzing a program’s requirements, __________ usually correspond to objects and attributes and _______ typically represent methods. a. Verbs, adjectives b. Nouns, verbs c. Verbs, nouns d. Adjective verbs 54.Declaration of a reference variable does not create an object. a. True b. False 55.In which phase of software development are the tasks that the software must accomplish specified? a. Design b. Construction c. Testing d. Requirements Analysis 56.True/false Before creating an array, a programmer must import the Array package from the java.util class. a. True b. False 57.What is printed to standard output by the following code? Assume the necessary imports have been made. double myNum = 1238.67445; DecimalFormat df = new DecimalFormat(“###.000”); System.out.print(df.format(myNum)); a. 238.000 b. 1238.000 c. 1238.675 d. 1238.674 58.What two pieces of information are needed to declare a variable? a. Variable name and value b. Type and value c. Type and variable Name d. Access modifier and variable name 59.True/False: If a constructor is not declared in a class, then the class has a default parameterless constructor. a. True b. False 60.Which of the following is not a logical operator? a. ++ b. ! c. || d. && 61.Suppose myArray is an array of 20 integers. An attempt to access myArray[21] will throw a _________. a. IntegerOutOfBoundsException b. ArrayElementNotFoundException c. ArrayIndexOutOfBoundsException d. NullElementException 62.Java is a ____________ programming language a. Compiled b. High-level c. Object-oriented d. All of the above 63.Which of the following is not a valid java identifier? a. _myVar b. $total c. TEMP d. 2convert 64.Which of the following is the reserved word used to declare a field such that a derived class can reference the field without violating encapsulation? a. Preserved b. Private c. Public d. Protected 65.True/False: An interface can be instantiated. a. True b. False 66.The code below is an example of ______________. double myObj; double myNum = 4.2; myObj = myNum; a. Unboxing b. Casting c. Autoboxing d. Promotion 67.True/False Constructors are not inherited from the parent class. a. True b. False 68.In java, all classes are ultimately derived from the ________ class. a. String b. Item c. Default d. Object 69.Suppose you have an instance of the Random class called gen. Which of the following lines of code generates a random integer in the range 50 to 80 (inclusive) and assigns it to myNum? a. int myNum = gen.nextInt(81); b. int myNum = gen.nextInt(51) + 30; c. int myNum = gen.nextInt(31) + 50; d. int myNum = gen.nextInt(80) – 30; 70.The run-time type of the _________, rather than the declare type of the _______ is used to determine which version of a method to invoke. a. Object, reference b. Reference, object c. Subclass, super class d. None of the above 71.When analyzing a program’s requirements, _________ usually corresponds to potential objects and attributes and ___________ typically represent potential methods. a. Verbs, nouns b. Nouns, verbs c. Nouns, adjectives d. Adjectives, verbs 72.An interface, in its most common form, consists of constants and ___________ methods. a. Static b. Final c. Private d. Abstract 73.The natural ordering of objects should be defined by implementing the ________ interface. a. Arrangement b. Comparable c. Comparator d. Collections Answers 1. C 2. C 3. A 4. B 5. D 6. C 7. D 8. C 9. A 10.D 11.B 12.B 13.A 14.C 15.D 16.B 17.A 18.D 19.B 20.D 21.C 22.B 23.A 24.B 25.B 26.A 27.C 28.B 29.D 30.B 31.C 32.A 33.A 34.D 35.C 36.D 37.B 38.C 39.A 40.B 41.D 42.A 43.A 44.C 45.D 46.B 47.D 48.A 49.C 50.C 51.A 52.D 53.B 54.A 55.D 56.B 57.D 58.C 59.A 60.A 61.C 62.D 63.D 64.D 65.B 66.C 67.A 68.D 69.C 70.A 71.B 72.D 73.B


Buy Material

Are you sure you want to buy this material for

50 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Jennifer McGill UCSF Med School

"Selling my MCAT study guides and notes has been a great source of side revenue while I'm in school. Some months I'm making over $500! Plus, it makes me happy knowing that I'm helping future med students with their MCAT."

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.