Advanced Java Programming Final Exam Questions - 1208 Verified Questions

Page 1


Advanced Java Programming Final

Exam Questions

Course Introduction

Advanced Java Programming explores sophisticated concepts and features of the Java programming language beyond the fundamentals. This course covers topics such as multithreading, networking, Java Database Connectivity (JDBC), graphical user interfaces with JavaFX or Swing, and design patterns. Students will learn how to build efficient, scalable, and robust applications by leveraging Javas advanced capabilities. Through hands-on projects and real-world scenarios, participants will gain experience with enterprise-level tools, frameworks such as Spring, and best practices for software development, preparing them for higher-level programming tasks in academic or professional settings.

Recommended Textbook

Java Programming 7th Edition by Joyce Farrell

Available Study Resources on Quizplus

17 Chapters

1208 Verified Questions

1208 Flashcards

Source URL: https://quizplus.com/study-set/1207 Page 2

Chapter 1: Creating Java Programs

Available Study Resources on Quizplus for this Chatper

68 Verified Questions

68 Flashcards

Source URL: https://quizplus.com/quiz/23890

Sample Questions

Q1) Using the void keyword in the main() method header indicates that a value will be returned by the main() method is called.

A)True

B)False

Answer: False

Q2) Many help sources and documentation are available for Java programmers. List and describe three possible sources of Java documentation and sources that are available for use.

Answer: Java textbook

Java web site - www.oracle.com/technetwork/java/index.html

Java application programming interface (Java API) - contains information about how to use prewritten Java classes, with lists of methods

FAQs of the Java web site

Java Development Kit (JDK) - provides tools that can be downloaded for free Java tutorials - http://docs.oracle.com/javase/tutorial/ - lessons organized by subject

Q3) In programming, named computer memory locations are called ____________________ because they hold values that might vary.

Answer: variables

To view all questions and flashcards with answers, click on the resource link above.

Chapter 2: Using Data

Available Study Resources on Quizplus for this Chatper

74 Verified Questions

74 Flashcards

Source URL: https://quizplus.com/quiz/23891

Sample Questions

Q1) Java consistently specifies their size and format

A)operand

B)cast operator

C)assignment

D)operator precedence

E)garbage

F)primitive

G)float

H)boolean

I)escape sequence

Answer: F

Q2) Describe three ways in which a constant differs from a variable.

Answer: Constants are preceded by the keyword final in a declaration statement. Constants can be assigned a value once only and the value cannot be changed. Constants conventionally have identifiers in all uppercase letters, distinguishing them from other forms.

Q3) A(n) ____________________ operator compares two items and the result has a Boolean value.

Answer: relational comparison

To view all questions and flashcards with answers, click on the resource link above. Page 4

Chapter 3: Using Methods, Classes, and Objects

Available Study Resources on Quizplus for this Chatper

68 Verified Questions

68 Flashcards

Source URL: https://quizplus.com/quiz/23892

Sample Questions

Q1) To execute a method, you ____________________ it from another method. Answer: invoke call

Q2) Methods used with object instantiations are called ____ methods. A) accessor B) internal C) static D) instance

Answer: D

Q3) A(n) ____________________ is a number appended to a field, typically an ID number or account number.

Answer: check-digit

Q4) When talking about inheritance, why do programmers use the phrase "is a"?

Answer: Expressing an is-a relationship is correct only when you refer to the object and the class in the proper order. You can say, "My oak desk with the scratch on top is a Desk and my goldfish named Moby is a Fish." You don't define a Desk by saying, "A Desk is an oak desk with a scratch on top," or explain what a Fish is by saying, "A Fish is a goldfish named Moby," because both a Desk and a Fish are much more general

To view all questions and flashcards with answers, click on the resource link above.

Page 5

Chapter 4: More Object Concepts

Available Study Resources on Quizplus for this Chatper

67 Verified Questions

67 Flashcards

Source URL: https://quizplus.com/quiz/23893

Sample Questions

Q1) When you ____________________ methods, you risk creating an ambiguous situation-one in which the compiler cannot determine which method to use.

Q2) If an integer is passed to a method with a double parameter, the double is promoted to an integer.

A)True

B)False

Q3) The ____ statement notifies the program that you will be using the data and method names that are part of the imported class or package.

A) use

B) package

C) class

D) import

Q4) Describe how a programmer can make a variable in or out of scope.

Q5) Declare a GregorianCalendar object named year. Use the GregorianCalendar class and the get() method to display the current year in a println statement.

Q6) Describe and provide an example of overloading.

Q7) What are the four types of nested classes?

Q8) When you pass a(n) ____________________, you pass a memory address.

Page 6

To view all questions and flashcards with answers, click on the resource link above.

Chapter 5: Making Decisions

Available Study Resources on Quizplus for this Chatper

70 Verified Questions

70 Flashcards

Source URL: https://quizplus.com/quiz/23894

Sample Questions

Q1) The compiler does not take indentation into account when compiling code, but consistent indentation can help readers understand a program's ____.

A) machine language

B) class

C) decision

D) logic

Q2) What is wrong with the following statement? How could you correct it? if(payRate < 5.85 && payRate > 60) System.out.println("Error in pay rate");

Q3) In Boolean expressions, when you want to execute more than one statement based on the results of the expression, you place statements within a block. What is a block and why is it important in decision statements? Why are curly braces crucial when blocking an if statement?

Q4) ____________________ is a tool that helps programmers plan a program's logic by writing plain English statements.

Q5) Range checking and the switch statement are tools programmers can use for effective decision making.

A)True B)False

To view all questions and flashcards with answers, click on the resource link above. Page 7

Chapter 6: Looping

Available Study Resources on Quizplus for this Chatper

72 Verified Questions

72 Flashcards

Source URL: https://quizplus.com/quiz/23895

Sample Questions

Q1) How many times will outputLabel be called? for(customer = 1; customer <= 20; ++customer)

For(color = 1; color <= 3; ++color)

OutputLabel();

A) 0

B) 3

C) 20

D) 60

Q2) counterLoop = 1; while(counterLoop < 10); { System.out.println("Enter a new value"); counterLoop = counterLoop + 1; }

What is the problem in the above while loop? How would you correct the problem?

Q3) A ____ is a structure that allows repeated execution of a block of statements. A) body B) Boolean expression C) loop D) loop control

To view all questions and flashcards with answers, click on the resource link above. Page 8

Chapter 7: Characters, Strings, and the Stringbuilder

Available Study Resources on Quizplus for this Chatper

73 Verified Questions

73 Flashcards

Source URL: https://quizplus.com/quiz/23896

Sample Questions

Q1) Which of the following correctly declares and initializes a String object?

A) new String = Hello

B) String greeting == "Hello";

C) String greeting = "Hello";

D) String new = "Hello"

Q2) A memory block

A)parseDouble()

B)toLowerCase()

C)substring()

D)String variable

E)append()

F)buffer

G)setLength()

H)indexOf()

I)insert()

Q3) Methods that return information about an object are called accessor methods.

A)True

B)False

Q4) What is a wrapper and why would you use it?

Q5) Why would you use the append() method? Provide an example.

9

To view all questions and flashcards with answers, click on the resource link above.

Chapter 8: Arrays

Available Study Resources on Quizplus for this Chatper

74 Verified Questions

74 Flashcards

Source URL: https://quizplus.com/quiz/23897

Sample Questions

Q1) Using just one statement, declare and create an array that will reserve memory locations for 10 scores values that are type double.

Q2) When using an array with all elements used, why would a programmer use a loop control variable from 0 to one less than the size of the array? Give an example.

Q3) Why is the length field a good option when writing a loop that manipulates an array? What programming error is common when attempting to use length as an array method?

Q4) A ____ array is one with the same number of elements as another, and for which the values in corresponding elements are related.

A) cloned

B) parallel

C) property

D) two-dimensional

Q5) When any primitive type is passed to a method, the ____________________ is passed.

Q6) A(n) ____________________ is a named list of data items that all have the same type.

Q7) Why would you use spacing when initializing parallel arrays?

Page 10

To view all questions and flashcards with answers, click on the resource link above.

Chapter 9: Advanced Array Concepts

Available Study Resources on Quizplus for this Chatper

74 Verified Questions

74 Flashcards

Source URL: https://quizplus.com/quiz/23898

Sample Questions

Q1) Using the ArrayList add() method, write the statement to insert "July" in the first position of the months ArrayList. Describe what would happen if the position number is invalid for the ArrayList.

Q2) A two-dimensional array that has rows of different lengths

A)ragged array

B)bubble sort

C)static methods

D)two-dimensional array

E)add() method

F)Enumerated data type

G)set() method

H)multidimensional array

I)java.util

Q3) double[][] empSales = new double[5][]; The above statement declares a(n) ____ array.

A) insertion

B) sort

C) ragged

D) boolean

Q4) What is sorting and how are objects organized as a result of being sorted?

Page 11

To view all questions and flashcards with answers, click on the resource link above.

Chapter 10: Introduction to Inheritance

Available Study Resources on Quizplus for this Chatper

70 Verified Questions

70 Flashcards

Source URL: https://quizplus.com/quiz/23899

Sample Questions

Q1) You can use the ____ modifier with methods when you don't want the method to be overridden.

A) override

B) access

C) final

D) end

Q2) Create a class named Employee with a name and a salary. Make a class named Manager that inherits from Employee with an instance field named department. Supply a toString() method that prints the manager's name, department, and salary. Make another class named Director that inherits from Manager with an instance field named stipendAmount. Supply the toString() method for Director that prints all of its instance variables. Also, write a program named myOutput that instantiates an object of each of the classes and invokes the toString() method of each of the objects.

Q3) A class diagram consists of a rectangle divided into three sections.

A)True

B)False

Q4) An advantage to making a method ____________________ is that the compiler knows there will be only one version of the method.

Q5) What are the parts of a class diagram and how would you use them?

To view all questions and flashcards with answers, click on the resource link above. Page 12

Chapter 11: Advanced Inheritance Concepts

Available Study Resources on Quizplus for this Chatper

70 Verified Questions

70 Flashcards

Source URL: https://quizplus.com/quiz/23900

Sample Questions

Q1) Java's Object class contains a public method named ____ that returns an integer representing the hash code.

A) length()

B) hashCode()

C) hcode()

D) toString()

Q2) ____ compress the data they store, which reduces the size of archived class files.

A) Dynamic method bindings

B) JAR files

C) Type-import-on-demand declarations

D) Interfaces

Q3) When you create classes for others to use, why would you not want to provide the users with your source code in the files with .java extensions?

Q4) What are the three ways in which you can compare abstract classes and interfaces?

Q5) In other programming languages, such as C++, abstract classes are known as ____________________ classes.

Q6) What is an abstract class? Give an example and explain how it works.

To view all questions and flashcards with answers, click on the resource link above. Page 13

Chapter 12: Exception Handling

Available Study Resources on Quizplus for this Chatper

65 Verified Questions

65 Flashcards

Source URL: https://quizplus.com/quiz/23901

Sample Questions

Q1) The parent class of Error is ____.

A) Object

B) Exception

C) RuntimeError

D) RuntimeException

Q2) If a method throws an exception that it will not catch but that will be caught by a different method, you must also use the keyword ____ followed by an Exception type in the method header.

A) finally

B) try

C) catch

D) throws

Q3) The memory location known as the ____________________ is where the computer stores the list of method locations to which the system must return.

Q4) When you catch an Exception object, you can call ____________________ to display a list of methods in the call stack so you can determine the location of the statement that caused the exception.

Q5) What advantages does object-oriented exception handling provide?

Q6) What things might a programmer do to cause a potential exception in a program?

Page 14

To view all questions and flashcards with answers, click on the resource link above.

Chapter 13: File Input and Output

Available Study Resources on Quizplus for this Chatper

74 Verified Questions

74 Flashcards

Source URL: https://quizplus.com/quiz/23902

Sample Questions

Q1) Functions as a pipeline or channel between a Java program and an input device

A)batch processing

B)root

C)buffer

D)flushing

E)stream

F)System.getProperty("line.separator")

G)data file

H)close the files

I)BufferedWriter

Q2) Briefly describe the Path class in Java.

Q3) A ____ is a group of characters that has some meaning.

A) record

B) file

C) byte

D) field

Q4) InputStream is a child of FileInputStream.

A)True

B)False

Q5) Briefly describe the ByteBuffer class.

Page 15

To view all questions and flashcards with answers, click on the resource link above.

Chapter 14: Introduction to Swing Components

Available Study Resources on Quizplus for this Chatper

74 Verified Questions

74 Flashcards

Source URL: https://quizplus.com/quiz/23903

Sample Questions

Q1) Within an event-driven program, a component on which an event is generated is the ____ of the event.

A) handler

B) driver

C) listener

D) source

Q2) A(n) ____________________ consists of a label positioned beside a square; you can click the square to display or remove a check mark.

Q3) A(n) ____________________ is the default appearance and behavior of any user interface.

Q4) An object that is interested in an event is called a source.

A)True

B)False

Q5) Assume you have declared a JFrame named welcomeFrame. Write the statement to set the welcomeFrame object's size to 300 pixels horizontally by 110 pixels vertically. Create a second statement to set the JFrame's title to display the text "My Sized Frame".

Q6) Describe the FlowLayout manager.

Q7) Write the statement to clear out a JTextField named myText.

Page 16

To view all questions and flashcards with answers, click on the resource link above.

Chapter 15: Advanced Gui Topics

Available Study Resources on Quizplus for this Chatper

69 Verified Questions

69 Flashcards

Source URL: https://quizplus.com/quiz/23904

Sample Questions

Q1) How do you find the red, green, and blue components of a color?

Q2) When you create a simple scroll pane using the constructor that takes no arguments, horizontal and vertical scroll bars appear only if they are needed.

A)True

B)False

Q3) To force the display of a scroll bar, you can use class variables defined in the ScrollPaneConstants class. What are they?

Q4) Layout managers are interface classes that align components to prevent crowding or overlapping.

A)True

B)False

Q5) When you type "A", two ____ key codes are generated: Shift and "a".

A) action

B) virtual

C) event

D) default

Q6) What are the four methods defined in the Component class for adding event listeners?

Q7) How would you arrange columns into equal rows and columns? Provide an example.

Page 17

To view all questions and flashcards with answers, click on the resource link above.

Chapter 16: Graphics

Available Study Resources on Quizplus for this Chatper

74 Verified Questions

74 Flashcards

Source URL: https://quizplus.com/quiz/23905

Sample Questions

Q1) Both Rectangle2D.Float and Rectangle2D.Double can be created using four arguments representing the x-coordinate, y-coordinate, width, and height.

A)True

B)False

Q2) To create a rectangle with rounded corners, the drawRoundRect() method is used. Describe the six arguments that are required to create rounded rectangles.

Q3) To create an arc object named halfArc that looks like the top half of a circle, you could use the ____ statement to produce identical results to the following statement: halfArc.drawArc(x, y, w, h, 0, 180);.

A) halfArc.drawArc(x, y, w, h, 180, 0);

B) halfArc.drawArc(x, y, w, h, 180, -180);

C) halfArc.drawArc(x, y, w, h, -180, 180);

D) fillArc.drawArc(x, y, w, h, 180, -180);

Q4) In the drawPolygon() method, what are the three arguments and what values do they represent?

Q5) What are the constructors for the Dimension class?

Q6) Why would a programmer use the repaint() method?

Q7) What activities does the process of drawing with Java 2D objects include?

Page 18

To view all questions and flashcards with answers, click on the resource link above.

Chapter 17: Applets, Images, and Sound

Available Study Resources on Quizplus for this Chatper

72 Verified Questions

72 Flashcards

Source URL: https://quizplus.com/quiz/23906

Sample Questions

Q1) Use the ____ applet method to perform initialization tasks, such as setting variables to initial values or placing applet components on the screen.

A) initialize()

B) begin()

C) init()

D) start()

Q2) &lt;html&gt; &lt;/object&gt; &lt;/html&gt;

Using the HTML code above, write the statement to run a JApplet named JHello. The applet will be 450 pixels wide by 150 pixels tall.

Q3) In order to play sounds more than once, or to stop and start sounds, the sound must be loaded into an AudioClip object. Write the statement to load the AudioClip named myClip with the sound file myTune.au, which is located in the audio folder.

Q4) Write the statement to retrieve and play the myTune.au sound file that will be stored in the same place as the applet.

To view all questions and flashcards with answers, click on the resource link above.

Turn static files into dynamic content formats.

Create a flipbook