Skip to main content

Java Programming Review Questions - 953 Verified Questions

Page 1


Java Programming Review Questions

Course Introduction

This course provides a comprehensive introduction to Java programming, covering fundamental concepts such as object-oriented programming, data types, control structures, methods, arrays, and exception handling. Students will learn how to design, write, compile, and debug Java applications, while also exploring topics like file input/output, graphical user interface development, and basic data structures. Through hands-on programming assignments and projects, students will develop problem-solving skills and gain practical experience in developing efficient, modular, and maintainable Java programs. The course is suitable for beginners and serves as a solid foundation for more advanced studies in software development.

Recommended Textbook

Starting Out with Java From Control Structures through Objects 6th Edition by Tony Gaddis

Available Study Resources on Quizplus

17 Chapters

953 Verified Questions

953 Flashcards

Source URL: https://quizplus.com/study-set/1747

2

Chapter 1: Introduction to Computers and Java

Available Study Resources on Quizplus for this Chatper

51 Verified Questions

51 Flashcards

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

Sample Questions

Q1) Without programmers, the users of computers would have no software, and without software, computers would not be able to do anything.

A)True

B)False

Answer: True

Q2) Because Java byte code is the same on all computers, compiled Java programs:

A) Must be re-compiled for each different machine it is run on B) Cannot run on Linux systems

C) Are non-existent

D) Are highly portable

Answer: D

Q3) Internally, the central processing unit (CPU) consists of two parts:

A) The control unit and the arithmetic and logic unit (ALU)

B) The control unit and main memory

C) The arithmetic and login unit (ALU) and main memory

D) The input and output devices

Answer: A

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

61 Verified Questions

61 Flashcards

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

Sample Questions

Q1) What is the result of the following expression? 10 + 5 * 3 - 20

A) -5

B) 5

C) 25

D) -50

Answer: B

Q2) To print "Hello, world" on the monitor, use the following Java statement

A) SystemOutPrintln("Hello, world");

B) System.out.println{"Hello, world"}

C) System.out.println("Hello, world");

D) Print "Hello, world";

Answer: C

Q3) Which of the following is not a primitive data type?

A) short

B) long

C) float

D) String

Answer: D

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

Chapter 3: Decision Structures

Available Study Resources on Quizplus for this Chatper

64 Verified Questions

64 Flashcards

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

Sample Questions

Q1) If str1 and str2 are both Strings, which of the following expressions will correctly determine whether they are equal?

(1)(str1 == str2)

(2) str1.equals(str2)

(3)(str1.compareTo(str2) == 0)

A) 1, 2, and 3 will all work

B) 1 and 2

C) 1 and 3

D) 2 and 3

Answer: D

Q2) A Boolean expression is one that is either:

A) true or False

B) x or y

C) Positive or negative

D) None of the above

Answer: A

Q3) In a switch statement, each of the case values must be unique.

A)True

B)False

Answer: True

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

Chapter 4: Loops and Files

Available Study Resources on Quizplus for this Chatper

57 Verified Questions

57 Flashcards

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

Sample Questions

Q1) A sentinel value _________ and signals that there are no more values to be entered.

A) is a different data type than the values being processed

B) is a special value that cannot be mistaken as a member of the list C) indicates the start of a list D) guards the list

Q2) The increment operator is:

A) ++

B) --

C) *=

D) -=

Q3) The do-while loop is a pre-test loop.

A)True

B)False

Q4) This is a control structure that causes a statement or group of statements to repeat.

A) Block

B) Loop

C) Prefix mode

D) Body

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

Chapter 5: Methods

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

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

Sample Questions

Q1) When you pass an argument to a method, be sure that the argument's data type is compatible with:

A) the parameter variable's data type

B) the method's return type

C) the version of Java currently being used

D) IEEE standards

Q2) Constants, variables, and the values of expressions may be passed as arguments to a method.

A)True

B)False

Q3) The lifetime of a method's local variable is:

A) the duration of the program

B) the duration of the class to which the method belongs

C) the duration of the method that called the local variable's method

D) only while the method is executing

Q4) Which of the following is NOT a part of the method header?

A) return type

B) method name

C) parentheses

D) semicolon

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

Chapter 6: A First Look at Classes

Available Study Resources on Quizplus for this Chatper

58 Verified Questions

58 Flashcards

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

Sample Questions

Q1) Quite often you have to use this statement to make a group of classes available to a program.

A) import

B) use

C) link

D) assume

Q2) What is stored by a reference variable?

A) A binary encoded decimal

B) A memory address

C) An object

D) A string

Q3) After the header, the body of the method appears inside a set of:

A) brackets, []

B) parentheses, ()

C) braces, {}

D) double quotes, ""

Q4) A class in not an object, but a description of an object.

A)True

B)False

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

Chapter 7: Arrays and the Arraylist Class

Available Study Resources on Quizplus for this Chatper

64 Verified Questions

64 Flashcards

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

Sample Questions

Q1) In memory, an array of String objects

A) consists of elements, each of which is a reference to a String object.

B) is always implemented as a ragged array.

C) consists of elements, each of which is a String object.

D) must be initialized when the array is declared.

Q2) If final int SIZE = 15 and int[] x = new int[SIZE], what would be the range of subscript values that could be used with x[]?

A) 1 through 15

B) 1 through 14

C) 0 through 14

D) 0 through 15

Q3) The sequential search algorithm:

A) requires the array to be ordered

B) must always be implemented as a method

C) uses a loop to sequentially step through an array, starting with the first element

D) will not execute, if the element is not in the array

Q4) Declaring an array reference variable does not create an array.

A)True

B)False

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

Chapter 8: A Second Look at Classes and Objects

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) If a class has a method named finalize, it is called automatically just before a data member that has been identified as final of the class is destroyed by the garbage collector.

A)True

B)False

Q2) Both instance fields and instance methods are associated with a specific instance of a class, and they cannot be used until an instance of the class is created.

A)True

B)False

Q3) If a class has a method named finalize, it is called automatically just before an instance of the class is destroyed by the garbage collector.

A)True

B)False

Q4) The whole-part relationship created by object aggregation is more often called:

A) a has a relationship

B) an inner class relationship

C) an extra class relationship

D) an inside class relationship

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

Chapter 9: Text Processing and More About Wrapper

Classes

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

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

Sample Questions

Q1) To convert the string, str = "285.74" to a double, use the following statement:

A) double x = str;

B) double x = Double.parseDouble(str);

C) double x = Double.Double(str);

D) double x = str,Double.parseDouble;

Q2) The term ________ commonly is used to refer to a string that is part of another string.

A) strand

B) substring

C) character fragment

D) nested string

Q3) This character is one that appears at the end, or right side, of a string, after the non-space characters:

A) Leading whitespace

B) Carriage return

C) Trailing whitespace

D) Line feed

Q4) StringBuilder objects are immutable.

A)True

B)False

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

Chapter 10: Inheritance

Available Study Resources on Quizplus for this Chatper

70 Verified Questions

70 Flashcards

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

Sample Questions

Q1) A subclass can directly access:

A) all members of the superclass

B) only public and private members of the superclass

C) only protected and private members of the superclass

D) only public and protected members of the superclass

Q2) Look at the following code and determine what the call to super will do. public class ClassB extends ClassA

{ Public ClassB()

{ Super(10); } }

A) This cannot be determined form the code shown.

B) It will call the constructor of ClassA that receives an integer as an argument.

C) It will call the method named super and pass the value 10 to it as an argument.

D) The method super will have to be defined before we can say what will happen.

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

Chapter 11: Exceptions and Advanced File IO

Available Study Resources on Quizplus for this Chatper

56 Verified Questions

56 Flashcards

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

Sample Questions

Q1) The numeric classes' "parse" methods all throw an exception of this type if the string being converted does not contain a convertible numeric value.

A) NumberFormatException

B) ParseIntError

C) ExceptionMessage

D) FileNotFoundException

Q2) What will be the result of the following code?

FileOutputStream fstream new FileOutputStream("Output.dat"); DataOutputStream outputFile = new DataOutputStream(fstream);

A) The outputFile variable will reference an object that is able to write text data only to the Output.dat file.

B) The outputFile variable will reference an object that is able to write binary data to the Output.dat file.

C) The outputFile variable will reference an object that is able to read binary data from the Output.dat file.

D) The outputFile variable will reference an object that is able to write to Output.dat as a random access file.

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

Chapter 12: A First Look at GUI Applications

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

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

Sample Questions

Q1) This layout manager arranges components in five regions.

A) GridLayout

B) BorderLayout

C) FlowLayout

D) RegionLayout

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

A) END_ON_CLOSE

B) JFrame.END_ON_CLOSE

C) JFrame.EXIT_ON_CLOSE

D) JFrame.CLOSE_NOT_HIDE

Q3) Which of the following statements is NOT true?

A) Radio buttons are round and check boxes are square.

B) Radio buttons are often grouped together and are mutually exclusive; Check boxes are not.

C) Radio buttons and check boxes both implement the ActionListener interface.

D) They are all true.

Q4) The ability to display splash screens was introduced in Java 6.

A)True

B)False

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

Chapter 13: Advanced GUI Applications

Available Study Resources on Quizplus for this Chatper

58 Verified Questions

58 Flashcards

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

Sample Questions

Q1) Which of the following is NOT a class used in constructing a menu system?

A) JMenuItem

B) JCheckBoxMenuItem

C) JButton

D) JRadioButtonMenuItem

Q2) What will happen when the following statement is executed?

X.setEditable(False);

A) The boolean variable x will be set to False.

B) The text field x will be made read-only.

C) The text field x will be editable.

D) The boolean variable x will be editable.

Q3) A text field that can be changed by code in the application, but cannot be edited by the user is known as what?

A) Write-only

B) Static

C) Read-only

D) Formal

Q4) Both AWT classes and Swing classes ultimately inherit from the Component class.

A)True

B)False

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

Chapter 14: Applets and More

Available Study Resources on Quizplus for this Chatper

54 Verified Questions

54 Flashcards

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

Sample Questions

Q1) If a frame component is 300 pixels wide and 200 pixels high, the upper, right-hand corner has (X, Y) coordinates of:

A) (0, 0)

B) (300, 0)

C) (200, 300)

D) (299, 0)

Q2) Which of the following will load the applet, TestApplet?

A) <applet code="TestApplet.class" width=200 height=50> </applet>

B) <applet code=TestApplet.class width=200 height=50> </applet>

C) <load code="TestApplet.class" width=200 height=50> </load>

D) <load code=TestApplet.class w=200 h=50> </load>

Q3) Some browsers do not directly support the Swing classes of applets.

A)True

B)False

Q4) In an HTML document, the tags:

A) instruct the Web browser how to format the text

B) instruct the Web browser where to place images

C) instruct the Web browser what to do when the user clicks on a link

D) all of the above

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

Chapter 15: Creating GUI Applications With Javafx and Scene Builder

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) A ________ is a tree-like, hierarchical data structure that contains nodes.

A) scene graph

B) class hierarchy

C) UML diagram

D) tree graph

Q2) The Scene Builder ________ provides a list of JavaFX components that you can use in an application.

A) Inspector Panel

B) Menu Bar

C) Content Panel

D) Library Panel

Q3) This is a graphical window or a system of graphical windows presented by an application for interaction with the user.

A) Graphical user interface (GUI)

B) Human-computer interface (HCI)

C) Man-machine interface (MMI)

D) Object-oriented user interface (OOUI)

Q4) Like RadioButtons, CheckBoxes may be selected or deselected at run time.

A)True

B)False

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

Chapter 16: Recursion

Available Study Resources on Quizplus for this Chatper

42 Verified Questions

42 Flashcards

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

Sample Questions

Q1) Like ________, a recursive method must have some way to control the number of times it repeats.

A) a loop

B) any method

C) a class constructor

D) an event

Q2) Like a loop, a recursive method must have:

A) a counter

B) some way to control the number of times it repeats itself

C) a return statement

D) a predetermined number of times it will execute before terminating

Q3) Recursive algorithms are usually less efficient than:

A) iterative algorithms

B) quantum algorithms

C) pseudocode algorithms

D) none of the above

Q4) Recursive algorithms are usually less efficient than iterative algorithms.

A)True

B)False

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

Chapter 17: Databases

Available Study Resources on Quizplus for this Chatper

48 Verified Questions

48 Flashcards

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

Sample Questions

Q1) Which of one the following SQL data types would be the best choice for storing financial data?

A) INT

B) REAL

C) DOUBLE

D) VARCHAR

Q2) No two rows in a table can have the same value in the primary key column

A)True

B)False

Q3) What does JDBC stand for?

A) Java data binary collection

B) Java database connectivity

C) Java database collection

D) Java data basic computation

Q4) The DBMS works directly with the data, and sends the results of operations:

A) back to the application

B) along the encrypted data path

C) to the unified data component

D) back to the Web server

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
Java Programming Review Questions - 953 Verified Questions by Quizplus - Issuu