Skip to main content

Application Development with Java Exam Solutions - 1208 Verified Questions

Page 1


Application Development with Java Exam Solutions

Course Introduction

This course provides students with a comprehensive introduction to application development using Java. Emphasizing object-oriented programming principles, students will learn to design, implement, test, and deploy Java applications. Topics include Java syntax, data structures, graphical user interfaces, event-driven programming, exception handling, file I/O, and multithreading. By engaging in hands-on projects and practical exercises, students will gain the skills necessary to build robust and scalable software solutions for real-world scenarios.

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) ____ refers to the hiding of data and methods within an object.

A) Instance

B) Inheritance

C) Passed

D) Encapsulation

Answer: D

Q2) Series of characters that will appear in output exactly as entered

A)literal string

B)high-level programming languages

C)dialog box

D)syntax

E)whitespace

F)compiler

G)attributes

H)Machine language

I)Java virtual machine (JVM)

Answer: A

Q3) A(n) ____________________ error occurs when the syntax of the program is correct and the program compiles but produces incorrect results when you execute it.

Answer: logic

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

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) In Java, you use variables of type ____ to store integers, or whole numbers. A) num

B) double C) var

D) int

Answer: D

Q2) public class YourGrade { public static void main(String[] args) { int projectPoints = 89; System.out.print("Your grade for this class is "); System.out.print(projectPoints); System.out.println("%"); } }

Given the above code, what will be the output at the command prompt?

Answer: Output will be as follows: Your grade for this class is 89% A blank line will follow the output.

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) A(n) ____________________ is a number appended to a field, typically an ID number or account number.

Answer: check-digit

Q2) What happens to a value returned from a method?

Answer: If a method returns a value, then when you call the method, you normally use the returned value, although you are not required to do so. For example, when you invoke the predictRaise() method, you might want to assign the returned value (also called the method's value) to a double variable named myNewSalary, as in the following statement: myNewSalary = predictRaise(mySalary);. The predictRaise() method returns a double, so it is appropriate to assign the method's returned value to a double variable.

Q3) When creating a method that requires multiple parameters, why would a programmer need to understand a method's signature, and why must a method call match the called method's signature?

Answer: The line of code to call the method would appear as follows: practiceWithCalls();

Q4) An application's main() method must have a void return type.

A)True

B)False

Answer: True

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) A disadvantage of Java is the large memory requirements to store a separate copy of each variable and method for each instantiation of a class.

A)True

B)False

Q2) When you write your own constructors, you cannot write versions that receive parameters.

A)True

B)False

Q3) As long as you do not make any ambiguous method calls, a program that contains a potentially ambiguous situation will execute correctly.

A)True

B)False

Q4) ____ involves using one term to indicate diverse meanings, or writing multiple methods with the same name but with different parameter lists.

A) Referencing

B) Overloading

C) Nesting

D) Signing

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

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) Explain the difference between a single-alternative if structure and a dual-alternative if structure. When would it be necessary to use a dual-alternative if structure?

Q2) A ____ consists of written steps in diagram form, as a series of shapes connected by arrows.

A) pseudocode chart

B) flowchart

C) sequence structure

D) decision structure

Q3) Create an if else statement that will check if the maxValue variable is equal to 100. If true, create a println statement that will output "Max reached". If false, create a println statement to output "Keep trying".

Q4) Describe how a sequence structure works.

Q5) Why would a programmer execute more than one statement that depends on the evaluation of a Boolean expression, and how could he or she do it in Java?

Q6) You are never required to use a switch structure; you can always achieve the same results with nested ____________________ statements.

Q7) Why would a programmer use an AND operator when using nested if statements?

Page 7

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

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) Loop control variables can be evaluated at the start or the end of the loop. Describe both pretest loops and posttest loops. How do do while loops execute?

Q2) Part of the Thread class in the java.lang package

A)prefix ++

B)block

C)definite loop

D)loop control variable

E)binary operators

F)loop fusion

G)decrementing

H)for loop

I)sleep() method

Q3) Shortcut operators are a programmer's only choice when incrementing or accumulating a variable's value.

A)True

B)False

Q4) How could a programmer identify and escape from an infinite loop?

Q5) How does a for loop work?

Q6) Why would a programmer use curly braces in the body of a do while loop?

Page 8

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

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) The ____ method takes a String argument and returns its double value.

A) parseString()

B) parseInt()

C) parseDouble()

D) returnDouble()

Q2) The String class ____ method evaluates the contents of two String objects to determine if they are equivalent.

A) equals()

B) toString()

C) charAt()

D) replace()

Q3) String firstCompare = "Oak Maple Pine"

String secondCompare = "spruce maple elm" firstCompare.regionMatches(false, 4, secondCompare, 7, 5)

Using the above code, what will be the Boolean value after execution of the regionMatches statement? Explain how the Strings are compared using the regionMatches() method.

Q4) What is the purpose of the replace() method? Provide an example.

Q5) What is the purpose of the substring() method and how do you use it?

Q6) Explain what is needed to declare a String variable and provide an example.

Page 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) When working with arrays, why is it beneficial to use a loop with a declared symbolic constant equal to the size of the array?

Q2) double[] studentScores; double studentScores[]; Are both of the above statements valid for declaring an array variable? Why or why not?

Q3) When you want to determine whether a variable holds one of many valid values, one option is to use a do while loop to compare the variable to a series of valid values. A)True B)False

Q4) In Java, the size of an array ____ declared immediately following the array name. A) can be B) is always C) is never D) should be

Q5) Describe a situation in which storing just one value at a time in memory does not meet your needs.

Q6) How can you use the enhanced for loop?

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

Page 10

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) import javax.swing.*; class FindPoints

{ public static void main(String[] args)

{ int[][] points = {{ 10, 20, 30}, {20, 40, 60}, {40, 60, 80}}; String prompt; int class; int level; prompt = JOptionPane.showInputDialog(null, "Class: "); class = Integer.parseInt(prompt); prompt = JOptionPane.showInputDialog(null,

Q2) When working with two-dimensional arrays, the length field holds the number of rows in an array and each row has a length field that holds the number of columns in the row.

A)True

B)False

Q3) What are some of the advantages of the ArrayList class over the Arrays class?

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

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) Inherits from a base class

A)information hiding

B)inheritance

C)super()

D)superclass

E)instanceof

F)virtual method call

G)inlining

H)class diagram

I)derived class

Q2) Makes a program run faster

A)information hiding

B)inheritance

C)super()

D)superclass

E)instanceof F)virtual method call

G)inlining

H)class diagram

I)derived class

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) The Object class contains a(n) ____________________ method that takes a single argument, which must be the same type as the type of the invoking object.

Q2) Give an example of how you can create an interface to have a class implement behavior from more than one parent.

Q3) public interface FindTheError

{ void firstMethod(int anIntNum)

{ System.out.println("Did you find the error?"); } }

What is the problem with the above interface? How would you correct the interface?

Q4) Which of the following statements creates an array of three Animal references?

A) Animal[] ref = new Animal(3);

B) Animal[] new = ref Animal[3];

C) Animal[] animalRef = new Animal[3];

D) Animal[] ref = extend Animal[3];

Q5) 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) What is a finally block and how would a programmer use it?

Q2) When a program contains multiple catch blocks, how are they handled?

Q3) Object-oriented techniques to manage errors

A)Throwable

B)Exception(String message)

C)exception handling

D)syntactic salt

E)mission critical

F)Exception(Throwable cause)

G)fault-tolerant

H)assert statement

I)try block

Q4) Since variables declared within a try or catch block are local to that block, the variable goes out of scope when the try or catch block ends.

A)True

B)False

Q5) If you create an object using Java's BigDecimal class, and then perform a division that results in a non-terminating decimal division such as 1/3, but specify that an exact result is needed, a(n) ____________________ is thrown.

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

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) The String class ____ method accepts an argument that identifies the field delimiter and returns an array of Strings.

A) tokens()

B) divide()

C) tokenize()

D) split()

Q2) Writes text to an output stream, buffering the characters

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

Q3) A(n) ____________________ object is an avenue for reading and writing a file.

Q4) Briefly describe the Path class in Java.

Q5) A(n) ____________________ is a collection of fields that contain data about an entity.

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

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) Each Swing component is a descendant of a JComponent.

A)True

B)False

Q2) You can call a JFrame's setDefaultCloseOperation() method and use ____ as an argument to keep the JFrame visible and continue running the program.

A) JFrame.EXIT_ON_CLOSE

B) WindowConstants.DISPOSE_ON_CLOSE

C) WindowConstants.DO_NOTHING_ON_CLOSE

D) WindowConstants.HIDE_ON_CLOSE

Q3) You define the text to be displayed in a tool tip by using the setToolTipText() method and passing an appropriate ____ to it.

A) Integer

B) Date

C) String

D) Boolean

Q4) What are some of the decisions you must make when extending a JFrame?

Q5) Swing components are UI elements such as dialog boxes and buttons. You can usually recognize their names because they begin with the letter

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

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) The default size of a component

A)GridBagLayout

B)JScrollPane

C)JPanel

D)glass pane

E)GridLayout

F)action key

G)Color class

H)MouseEvent

I)preferred size

Q2) The parent class for all event objects is named ____, which descends from the Object class.

A) EventObject

B) Event

C) ParentEvent

D) AWTEvent

Q3) Write the statement to create a Color object named myGray with red, green, and blue values of 100 each.

Q4) Describe the difference between an ActionEvent and a MouseEvent.

Q5) What is an adapter class?

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) You can designate a Graphics color by calling the drawString() method.

A)True

B)False

Q2) BasicStroke myLine = new BasicStroke(12.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND);

The above statement creates a BasicStroke object and makes it the current stroke. Describe the three arguments that are used in this statement, and then describe the purpose of each.

Q3) A rectangle is drawn with the following statement: tool.drawRect(50, 50, 100, 60); An oval is drawn with the following statement: tool.drawOval(50, 50, 100, 60);

Describe the resulting output, and describe how the four arguments are used to draw the objects.

Q4) Write the statement to create a Rectangle2D.Float object named myRect at 20, 20 with a width of 80 and height of 50.

Q5) Write the statement to create an Arc2D.Float object named myArc at 20, 143, with a width of 50 and a height of 43; with a starting degree of 50, 140 degrees traveled; and using the class variable Arc2D.PIE.

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

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) Invoking the ____ method after adding one or more JComponents to an applet ensures that the Components draw themselves on the screen.

A) draw()

B) paint()

C) repaint()

D) validate()

Q2) To compile an applet into bytecode, use the ____ command.

A) appletview

B) viewapp

C) javac

D) java

Q3) <html> </object> </html>

In the blank line provided, write the code to run a JApplet named JGreeting that will be 370 pixels wide by 110 pixels tall.

Q4) Describe the two methods for running an applet.

Q5) Briefly describe the image formats that Java supports.

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

Turn static files into dynamic content formats.

Create a flipbook
Application Development with Java Exam Solutions - 1208 Verified Questions by Quizplus - Issuu