Skip to main content

Problem Solving with Java Exam Practice Tests - 620 Verified Questions

Page 1


Problem Solving with Java Exam Practice Tests

Course Introduction

Problem Solving with Java is a foundational course designed to introduce students to the principles of computational thinking and algorithmic problem solving using the Java programming language. The course covers fundamental concepts such as data types, control structures, methods, arrays, and object-oriented programming. Through a combination of theoretical instruction and practical, hands-on exercises, students learn to break down complex problems, design efficient solutions, and implement them in Java. Emphasis is placed on developing logical reasoning, debugging skills, and writing clear, maintainable code, preparing students for further study in computer science and software development.

Recommended Textbook

Starting Out with Java Early Objects 5th Edition by Tony Gaddis

Available Study Resources on Quizplus

16 Chapters

620 Verified Questions

620 Flashcards

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

Chapter 1: Introduction to Computers and Java

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) Byte code instructions are

A) machine code instructions.

B) syntax errors.

C) read and interpreted by the JVM.

D) another name for source code.

Answer: C

Q2) A procedure is a set of programming language statements that, together, perform a specific task.

A)True

B)False

Answer: True

Q3) The data contained in an object is known as A) methods.

B) attributes.

C) classes.

D) fields.

Answer: B

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

Page 3

Chapter 2: Java Fundamentals

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) A Java program must have at least one A) comment.

B) System.out.println(); statement.

C) class definition.

D) variable declaration.

Answer: C

Q2) Which of the following is not a rule that must be followed when naming identifiers?

A) After the first character, you may use the letters a-z, A-Z, an underscore, a dollar sign, or digits 0-9.

B) Identifiers can contain spaces.

C) Uppercase and lowercase characters are distinct.

D) The first character must be one of the letters a-z, A-Z, an underscore or a dollar sign.

Answer: B

Q3) A variable's scope is the part of the program that has access to the variable.

A)True

B)False

Answer: True

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

Chapter 3: A First Look at Classes and Objects

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) A constructor is a method that

A) returns an object of the class.

B) never receives any arguments.

C) performs initialization or setup operations.

D) removes the object from memory.

Answer: C

Q2) The java.lang package is automatically imported into all Java programs.

A)True

B)False

Answer: True

Q3) A method

A) may have zero or more parameter variables.

B) never has parameter variables.

C) must have at least two parameter variables.

D) may have only one parameter variables.

Answer: A

Q4) An access specifier indicates how the class may be accessed.

A)True

B)False

Answer: True

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

Chapter 4: Decision Structures

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) Which of the following strings could be passed to the DecimalFormat constructor to display 12.78 as 012.8?

A) "###.#"

B) "000.0"

C) "##0.0%"

D) "$#0.00"

Q2) The ________ statement is used to create a decision structure, which allows a program to have more than one path of execution.

A) block

B) if

C) null

D) flag

Q3) When testing for character values, the switch statement does not test for the case of the character.

A)True

B)False

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

Chapter 5: Loops and Files

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) Assume that inputFile references a Scanner object that was used to open a file. Which of the following while loops shows the correct way to read data from the file until the end of the file is reached?

A) while (inputFile.nextLine == " ")

B) while (inputFile != null)

C) while (!inputFile.EOF)

D) while (inputFile.hasNext())

Q2) In all but rare cases, loops must contain within themselves

A) nested loops.

B) a way to terminate.

C) arithmetic operators.

D) if statements.

Q3) A loop that executes as long as a particular condition exists is called a(n) ________ loop.

A) infinite

B) count-controlled

C) conditional

D) relational

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

7

Chapter 6: A Second Look at Classes and Objects

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) CRC stands for

A) Class, Recyclability, Collaborations.

B) Class, Redundancy, Collections.

C) Class, Responsibilities, Collaborations.

D) Code, Reuse, Constancy.

Q2) You can declare an enumerated data type inside of a method.

A)True

B)False

Q3) When you make a copy of the aggregate object and of the objects it references,

A) you are performing a shallow copy.

B) you are performing a nested copy.

C) you are performing a deep copy.

D) a compiler error will occur.

Q4) An instance of a class does not have to exist in order for values to be stored in a class's static fields.

A)True

B)False

Q5) An enumerated data type is actually a special type of class.

A)True

B)False

8

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

Chapter 7: Arrays and the ArrayList Class

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) What will be the result of executing the following code?

Int[] x = {0, 1, 2, 3, 4, 5};

A) An array of 6 values, all initialized to 0 and referenced by the variable x, will be created.

B) An array of 6 values, ranging from 0 through 5 and referenced by the variable x, will be created.

C) The variable x will contain the values 0 through 5.

D) A compiler error will occur.

Q2) The binary search algorithm

A) is less efficient than the sequential search algorithm.

B) will cut the portion of the array being searched in half each it fails to locate the search value.

C) will have a maximum number of comparisons equal to the number of elements in the array.

D) will have an average number of comparisons that is half the number of elements in the array.

Q3) Java does not limit the number of dimensions that an array may have.

A)True

B)False

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

Page 9

Chapter 8: Text Processing and Wrapper Classes

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) A wrapper class is a class that is "wrapped around" a primitive data type and allows you to create objects instead of variables.

A)True

B)False

Q2) Which of the following statements is not true about the following code?

StringBuilder strb = New StringBuilder("Total number of parts: "); Strb.insert(23, 32);

A) The starting position for the insert is 23.

B) strb is a StringBuilder type object.

C) The ending position for the insert is 32.

D) The literal number 32 will be inserted into the string.

Q3) Which of the following import statements is required to use the StringTokenizer class?

A) import java.util.Scanner

B) import java.text.DecimalFormat; C) import java.util.StringTokenizer; D) import javax.swing.JOptionPane;

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

Chapter 9: Inheritance

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) All fields declared in an interface

A) have protected access.

B) must be initialized in the class implementing the interface.

C) have private access.

D) are treated as final and static.

Q2) All methods specified by an interface are

A) private.

B) public.

C) protected.

D) static.

Q3) Which of the following statements correctly specifies two interfaces?

A) public class ClassA implements [Interface1, Interface2]

B) public class ClassA implements (Interface1, Interface2)

C) public class ClassA implements Interface1 | Interface2

D) public class ClassA implements Interface1, Interface2

Q4) In an inheritance relationship, the subclass constructor always executes before the superclass constructor.

A)True

B)False

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

Chapter 10: Exceptions and Advanced File I/O

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) The call stack is an internal list of all the methods that are currently executing.

A)True

B)False

Q2) In order for an object to be serialized, the class must implement this interface.

A) Serial

B) Serializable

C) ObjectOutputStream

D) Writable

Q3) An exception object's default error message can be retrieved using this method.

A) getMessage

B) getDefaultMessage

C) getDefaultErrorMessage

D) getErrorMessage

Q4) When an exception is thrown,

A) it must always be handled by the method that throws it.

B) it must be handled by the program or by the default exception handler.

C) it may be ignored.

D) the program terminates even if the exception is handled.

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

Chapter 11: GUI Applications Part 1

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) When used as an exit code, this value traditionally indicates that the program ended successfully.

A) -1

B) null

C) 0

D) 1

Q2) Very few of the Swing components are coupled with peers, so they are called ________ components.

A) peerless

B) fixed

C) singular

D) lightweight

Q3) To end an application, you pass this as the argument to the JFrame class's setDefaultCloseOperation method.

A) JFrame.CLOSE_NOT_HIDE

B) JFrame.END_ON_CLOSE

C) END_ON_CLOSE

D) JFrame.EXIT_ON_CLOSE

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

Chapter 12: GUI Applications Part 2

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) The JList and JTextArea components do not automatically display scroll bars.

A)True

B)False

Q2) What does the following statement do?

JTextArea textField = JTextArea(message, 25, 15);

A) It creates a text area with 25 rows and 15 columns that will initially display the text "message."

B) It creates a text area with 25 columns and 15 rows that will initially display the text stored in the String object referenced by message.

C) It creates a text area with 25 columns and 15 rows that will initially display the text stored in the JTextArea object referenced by textField.

D) It creates a text area with 25 rows and 15 columns that will initially display the text stored in the String object referenced by message.

Q3) The Dimension class is part of the ________ package.

A) java.awt.menu

B) javax.swing.event

C) javax.swing

D) java.awt

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

Chapter 13: Applets and More

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) If you want to make sure that an applet is compatible with all Java-enabled browsers, use AWT components instead of Swing.

A)True

B)False

Q2) For all Swing components except JApplet and JFrame, you should override this method to get a reference to the component's Graphics object.

A) paintComponent

B) paint

C) paintBase

D) repaint

Q3) An applet does not have to be on a Web server in order to be executed.

A)True

B)False

Q4) An HTML document is usually saved with this file name extension.

A) .xml

B) .html

C) .asp

D) .cfm

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

Chapter 14: Creating GUI Applications with JavaFX

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) A window in a GUI commonly consists of several ________ that present data to the user and/or allow interaction with the application.

A) modules

B) components

C) elements

D) buttons

Q2) In the controller class, you can use the CheckBox's ________ method to determine whether the CheckBox is selected or not.

A) getIndex

B) isActive

C) isChecked

D) isSelected

Q3) Because only one RadioButton in a toggle group can be selected at any given time, the buttons are said to be this.

A) static components

B) singularly bound

C) all inclusive

D) mutually exclusive

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

Chapter 15: Recursion

Available Study Resources on Quizplus for this Chatper

20 Verified Questions

20 Flashcards

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

Sample Questions

Q1) In the ________, we must always reduce the problem to a smaller version of the original problem.

A) base case

B) partition case

C) lessening case

D) recursive case

Q2) A recursive method can have no more than one base case.

A)True

B)False

Q3) This occurs when method A calls method B, which in turn calls method A.

A) dynamic recursion

B) linear recursion

C) direct recursion

D) indirect recursion

Q4) A method is called from the main method for the first time. It then calls itself seven times. What is the depth of recursion?

A) 1

B) 7

C) 8

D) 6

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

Chapter 16: Databases

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) A qualified column name takes the following form:

A) ColumnName.TableName

B) TableName.ColumnName

C) RowName.TableName

D) DatabaseURL.ColumnName

Q2) What will happen if you try to store duplicate data in a primary key column?

A) The column is duplicated.

B) An error will occur.

C) The duplicate data will have concurrency issues.

D) The primary key column will not display the duplicate data.

Q3) In an entity relationship diagram, the primary keys are denoted with A) (PK).

B) (1).

C) (KEY).

D) (PRIME).

Q4) In SQL, the REFERENCES qualifier ensures referential integrity between tables. A)True

B)False

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

Turn static files into dynamic content formats.

Create a flipbook
Problem Solving with Java Exam Practice Tests - 620 Verified Questions by Quizplus - Issuu