Skip to main content

Java Programming for Beginners Exam Materials - 620 Verified Questions

Page 1


Java Programming for Beginners

Exam Materials

Course Introduction

Java Programming for Beginners introduces students to the fundamental concepts and skills needed to start programming in Java. The course covers key topics such as variables, data types, control structures, loops, functions, arrays, and object-oriented programming principles including classes and objects. Through hands-on exercises and simple projects, students will learn the basics of writing, testing, and debugging Java programs, enabling them to develop problem-solving abilities and a strong foundation for further study in software development. No prior programming experience is required, making it an ideal starting point for anyone new to computer programming.

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) The original name for Java was

A) *7.

B) Oak.

C) HotJava.

D) Elm.

Answer: B

Q2) Logical errors are mistakes that cause the program to produce erroneous results.

A)True

B)False

Answer: True

Q3) ________ is a cross between human language and a programming language.

A) The compiler

B) Pseudocode

C) The Java Virtual Machine

D) Java

Answer: B

Q4) Compiled byte code is also called source code.

A)True

B)False

Answer: False

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) What will be displayed after the following statements have been executed?

Int x = 15, y = 20, z = 32;

X += 12;

Y /= 6;

Z -= 14;

System.out.println("x = " + x +

", y = " + y + ", z = " + z);

A) x = 27, y = 3.333, z = 18

B) x = 27, y = 2, z = 18

C) x = 37, y = -14, z = 4

D) x = 27, y = 3, z = 18

Answer: D

Q2) When saving a Java source file, save it with an extension of A).java.

B) .javac.

C) .src.

D) .class.

Answer: A

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) After the header, the body of the method appears inside a set of A) braces, {}.

B) parentheses, ().

C) brackets, [].

D) double quotes, "" .

Answer: A

Q2) The scope of a local variable is

A) inside the parentheses of a method header.

B) the method in which they are defined.

C) inside the class, but not inside any method.

D) the entire class.

Answer: B

Q3) A class's responsibilities include

A) the things a class is responsible for knowing.

B) the things a class is responsible for doing.

C) both A and B

D) neither A nor B

Answer: C

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

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) What would be the value of discountRate after the following statements are executed?

Double discountRate; Char custType = 'B'; Switch (custType) { Case 'A':

DiscountRate = 0.08; Break; Case 'B':

DiscountRate = 0.06; Case 'C':

DiscountRate = 0.04; Default:

DiscountRate = 0.0; }

A) 0.08

B) 0.06

C) 0.04

D) 0.0

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

Page 6

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) The do-while loop is ideal in situations where you always want the loop to iterate at least once.

A)True

B)False

Q2) You can use this method to determine whether a file exists.

A) the File class's canOpen method

B) the Scanner class's exists method

C) the File class's exists method

D) the PrintWriter class's fileExists method

Q3) 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())

Q4) In a for loop, the control variable can only be incremented.

A)True

B)False

To view all questions and flashcards with answers, click on the resource link above. Page 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) The key word this is the name of a reference variable that an object can use to refer to itself.

A)True

B)False

Q2) 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

Q3) When an object is passed as an argument, it is actually a reference to the object that is passed.

A)True

B)False

Q4) 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.

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

8

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 the following code?

Final int ARRAY_SIZE = 5;

Float[] x = float[ARRAY_SIZE];

For(int i = 1; i <= ARRAY_SIZE; i++)

{ X[i] = 10.0;

}

A) A runtime error will occur.

B) All the values in the array will be initialized to 10.0.

C) All the values in the array, except the first, will be set to 10.0.

D) The code contains a syntax error and will not compile.

Q2) A sorting algorithm is used to locate a specific item in a larger collection of data.

A)True

B)False

Q3) The ________ method removes an item from an ArrayList at a specific index.

A) remove

B) pop

C) deleteAt

D) clear

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) The StringBuilder class's insert method allows you to insert into the calling object's string

A) a char array.

B) a primitive type.

C) a String object.

D) All of the above

Q2) The ________ method returns a copy of the calling String object, in which all leading and trailing whitespace characters have been deleted.

A) remove

B) trim

C) compress

D) concat

Q3) Trying to extract more tokens than exist from a StringTokenizer object will cause an error.

A)True

B)False

Q4) StringBuilder objects are not immutable.

A)True

B)False

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

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) In an inheritance relationship, the subclass constructor always executes before the superclass constructor.

A)True

B)False

Q2) When a method is declared with the ________ modifier, it cannot be overridden in a subclass.

A) final

B) super

C) void

D) public

Q3) Because every class directly or indirectly inherits from the Object class, every class inherits the Object class's members.

A)True

B)False

Q4) 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.

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) To write data to a binary file, you create objects from the following classes:

A) File and Scanner.

B) BinaryFileWriter and BinaryDataWriter.

C) FileOutputStream and DataOutputStream.

D) File and PrintWriter.

Q2) All of the exceptions that you will handle are instances of classes that extend this class.

A) IOException

B) Exception

C) Error

D) RunTimeException

Q3) To read data from a binary file, you create objects from the following classes:

A) File and Scanner.

B) File and PrintWriter.

C) BinaryFileReader and BinaryDataReader.

D) FileInputStream and DataInputStream .

Q4) When you deserialize an object using the readObject method, you must cast the return value to the desired class type.

A)True

B)False

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) A(n) ________ is an action that takes place within a program, such as the clicking of a button.

A) event

B) selection

C) incident

D) choice

Q2) This layout manager arranges components in rows.

A) RegionLayout

B) BorderLayout

C) FlowLayout

D) GridLayout

Q3) When this argument is passed to the JFrame class's setDefaultCloseOperation method, the application is hidden, but not closed.

A) JFrame.EXIT_ON_CLOSE

B) JFrame.HIDE_ON_CLOSE

C) JFrame.SUSPEND_ON_CLOSE

D) HIDE_ON_CLOSE

Q4) It is possible to write the main method directly into a GUI class.

A)True

B)False

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) If you call the JTextField component's setEditable method and pass false as the argument, then the text field becomes

A) unbound.

B) editable.

C) invisible.

D) read-only.

Q2) If you assign the same mnemonic to more than one component in a window, it works only for the first component that you assigned it to.

A)True

B)False

Q3) You assign a tool tip to a component with the ________ method, which is inherited from the JComponent class.

A) setToolTipText

B) setToolTip

C) addToolTip

D) getToolTipText

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

A)True

B)False

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) In addition to displaying standard components such as buttons and labels, Java allows you to draw which of the following?

A) ovals

B) rectangles

C) arcs

D) All of the above

Q2) This method draws a string as a graphic.

A) displayString

B) stringDraw

C) paintString

D) drawString

Q3) To run an applet, you create an HTML document with a(n) ________ tag.

A) script

B) applet

C) java

D) base

Q4) The mouse generates two types of events: mouse events and mouse motion events.

A)True

B)False

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) Even if a variable will not reference a component in the GUI, it is necessary to precede the declaration by the @FMXL annotation.

A)True

B)False

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

A) scene graph

B) class hierarchy

C) UML diagram

D) tree graph

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

A) isChecked

B) isPushed

C) isSelected

D) getIndex

Q4) You can write a JavaFX GUI application using nothing but Java code.

A)True

B)False

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) A problem can be solved recursively if it can be broken down into successive smaller problems that are identical to the overall problem.

A)True

B)False

Q2) The recursive case does not require recursion, so it stops the chain of recursive calls.

A)True

B)False

Q3) Whereas a recursive algorithm might result in faster execution time, the programmer might be able to design an iterative algorithm faster.

A)True

B)False

Q4) Recursion can be a powerful tool for solving repetitive problems and is an important topic in upper-level computer science courses.

A)True

B)False

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

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) What string lists the protocol that should be used to access a database, the name of the database, and potentially other items?

A) JDBC driver

B) Database URL

C) JDBC locator

D) Database specifier

Q2) Which Statement interface method should be used to execute an INSERT statement?

A) executeUpdate

B) executeStatement

C) executeQuery

D) executeSQL

Q3) In SQL, this character can be used as a wildcard to represent a single character.

A) %

B) $

C) _

D) *

Q4) In SQL, the equal to operator is ==, which is the same as Java.

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