Programming and Problem Solving Exam Review - 620 Verified Questions

Page 1


Programming and Problem Solving Exam Review

Course Introduction

Programming and Problem Solving introduces students to the fundamental concepts of computer programming as a tool for solving real-world problems. The course covers the basics of algorithm design, logical reasoning, and structured programming using a modern programming language. Students will learn to break down complex problems, implement solutions using variables, control structures, functions, and data types, and develop clear, efficient code. Emphasis is placed on systematic problem-solving strategies, debugging techniques, and the iterative process of software development, preparing students for more advanced computer science coursework.

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) Application software refers to

A) the programs that make the computer useful to the user.

B) the operating system.

C) key words.

D) pseudocode.

Answer: A

Q2) One of the design tools used by programmers when creating a model of the program is

A) ALU.

B) pseudocode.

C) byte code.

D) syntax.

Answer: B

Q3) An object typically hides it data, but allows outside code to access A) the pseudocode.

B) the methods that operate on the data.

C) private data members.

D) the data files.

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) Character literals are enclosed in ________, and string literals are enclosed in

A) single quotes, double quotes

B) double quotes, single quotes

C) single quotes, single quotes

D) double quotes, double quotes

Answer: A

Q2) What will be the displayed when the following code is executed?

Final int x = 22, y = 4;

Y += x;

System.out.println("x = " + x + ", y = " + y);

A) x = 22, y = 26

B) x = 22, y = 4

C) x = 22, y = 88

D) Nothing. There is an error in the code.

Answer: D

Q3) Both character literals and string literals can be assigned to a char variable.

A)True

B)False

Answer: False

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 method that gets a value from a class's field but does not change it is known as a mutator method.

A)True

B)False

Answer: False

Q2) When a local variable in an instance method has the same name as an instance field, the instance field hides the local variable.

A)True

B)False

Answer: False

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

A)True

B)False

Answer: True

Q4) After the header, the body of the method appears inside a set of A) braces, {}.

B) parentheses, ().

C) brackets, [].

D) double quotes, "" .

Answer: A

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) What will be the value of bonus after the following code is executed?

Int bonus, sales = 10000;

If (sales < 5000)

Bonus = 200;

Else if (sales < 7500)

Bonus = 500;

Else if (sales < 10000)

Bonus = 750;

Else if (sales < 20000)

Bonus = 1000;

Else

Bonus = 1250;

A) 750

B) 1250

C) 500

D) 1000

Q2) A local variable's scope always ends at the closing brace of the block of code in which it is declared.

A)True

B)False

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) How many times will the following for loop be executed? For (int count = 10; count <= 21; count++) System.out.println("Java is great!");

A) 0

B) 12

C) 10

D) 11

Q2) What will be the values of x and y as a result of the following code?

Int x = 25, y = 8; X += y++;

A) x = 34, y = 9

B) x = 25, y = 8

C) x = 33, y = 8

D) x = 33, y = 9

Q3) When the continue statement is encountered in a loop, all the statements in the body of the loop that appear after it are ignored, and the loop prepares for the next iteration.

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) Look at the following declaration: Enum Tree { OAK, MAPLE, PINE }

What is the fully-qualified name of the PINE enum constant?

A) enum.PINE

B) PINE

C) Tree.PINE

D) enum.Tree.PINE

Q2) A static field is created by placing the key word static

A) after the access specifier and field's data type.

B) after the access specifier and before the field's data type.

C) after the field name.

D) in brackets, before the field's data type.

Q3) Of the following, which would be considered the no-arg constructor for the Rectangle class?

A) public Rectangle(int len, int width)

B) public Rectangle(double len, double width)

C) public Rectangle()

D) All of the above

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 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) The Java compiler does not display an error message when it processes a statement that uses an invalid subscript.

A)True

B)False

Q3) Objects in an array are accessed with subscripts, just like any other data type in an array.

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) The String class's regionMatches method performs a case-insensitive comparison.

A)True

B)False

Q2) Which of the following import statements is required to use the Character wrapper class?

A) import java.String

B) import java.lang.Char

C) import java.Char

D) No import statement is needed

Q3) StringBuilder objects are not immutable.

A)True

B)False

Q4) The ________ class is the wrapper class for the char data type.

A) StringBuilder

B) Integer

C) Character

D) String

Q5) You cannot assign a value to a wrapper class object.

A)True

B)False

10

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) If a subclass constructor does not explicitly call a superclass constructor,

A) the superclass's fields will be set to the default values for their data types.

B) Java will automatically call the superclass's default constructor immediately after the code in the subclass's constructor executes.

C) it must include the code necessary to initialize the superclass fields.

D) Java will automatically call the superclass's default constructor just before the code in the subclass's constructor executes.

Q2) When a class implements an interface, an inheritance relationship known as ________ is established.

A) implemented heritage

B) interface inheritance

C) realized inheritance

D) abstract inheritance

Q3) All methods specified by an interface are

A) private.

B) public.

C) protected.

D) static.

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

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) When you deserialize an object using the readObject method, you must cast the return value to the desired class type.

A)True

B)False

Q2) If a random access file contains a stream of characters, which of the following statements would move the file pointer to the starting byte of the fifth character in the file?

A) file.seek(4);

B) file.seek(8);

C) file.seek(10);

D) file.seek(5);

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

Q4) The throws clause causes an exception to be thrown.

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) When a component is added to a region in the BorderLayout manager,

A) the component is stretched so it fills up the entire region.

B) the component retains its original size.

C) the region is resized to fit the component.

D) the region and the component are resized to fit the frame.

Q2) In a Swing application, you create a frame from this class.

A) JFrame

B) JPanel

C) JLabel

D) JButton

Q3) The ActionListener interface is in this package.

A) java.awt.event

B) javax.swing.event

C) java.lang.event

D) java.action.event

Q4) A GUI program automatically stops executing when the end of the main method is reached.

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) A ________ is a collection of commands organized in one or more drop-down menus.

A) menu system

B) command list

C) main menu

D) drop-down list

Q2) If nameList is an instance of a JList component, which of the following statements would display 4 rows in nameList.

A) nameList.setDisplayRowCount(4);

B) nameList.setShowRowCount(4);

C) nameList.setVisibleRowCount(4);

D) nameList.setRowCount(4);

Q3) When using a slider, by default, tick marks are not displayed, and setting their spacing does not cause them to be displayed.

A)True

B)False

Q4) To add a component to a scroll pane, you must pass a reference to the component as an argument to the JScrollPane constructor.

A)True

B)False

14

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

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) An application can use this object to execute code automatically at regular time intervals.

A) Clock

B) Regulator

C) Meter

D) Timer

Q2) There is no static main method needed to create an instance of the applet class because the browser creates an instance of the class automatically.

A)True

B)False

Q3) To make a Web page, you create a text file that contains HTML instructions, which are known as ________, as well as the text that should be displayed on the Web page.

A) markups

B) hypertext

C) labels

D) tags

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) Which of the following is true concerning the sample controller skeleton provided by Scene Builder?

A) It has all of the necessary import statements.

B) It has private field declarations for all of the components that have an fx:id.

C) You just need to change the name of the class, and write the code for the event listener methods.

D) All of the above

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

Q3) This is a markup language that describes the components in a JavaFX scene graph.

A) SGML

B) HTML

C) XML

D) FXML

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

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

Q3) Like a loop, a recursive method must have which of the following?

A) a statement that increments the control variable

B) a control variable initialized to a starting value

C) some way to control the number of times it repeats

D) All of the above

Q4) The recursive binary search algorithm is a good example of repeatedly breaking a problem down into smaller pieces until it is solved.

A)True

B)False

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) Which of the following shows how a single quote is represented as part of a string in SQL?

A) _'

B) "'"

C) /'

D) ''

Q2) SQL does not provide functions for performing calculations.

A)True

B)False

Q3) In SQL, you use this statement to delete one or more rows from a table.

A) DELETE

B) DROP ROW

C) REMOVE

D) PURGE

Q4) This type of SQL statement is used to retrieve the rows from a table.

A) GET

B) SELECT

C) READ

D) RETRIEVE

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
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.