Programming Logic and Design Final Exam Questions - 620 Verified Questions

Page 1


Programming Logic and Design

Final Exam Questions

Course Introduction

Programming Logic and Design introduces students to the fundamental concepts of computer programming, focusing on the development of logical thinking and problem-solving skills essential for software development. The course emphasizes structured programming techniques, such as the use of flowcharts, pseudocode, algorithms, and control structures like selection, iteration, and sequence. Students will learn how to analyze problems, break them into manageable steps, and design solutions that can be implemented in any programming language. By mastering these concepts, students build a strong foundation to understand how programs work and how to design efficient, error-free code.

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) A characteristic of ________ is that only an object's methods are able to directly access and make the changes to the object's data.

A) classes

B) procedures

C) data hiding

D) component reusability

Answer: C

Q2) ________ are used to indicate the end of a Java statement.

A) Periods

B) Asterisks

C) Semicolons

D) Colons

Answer: C

Q3) The two primary methods of programming in use today are A) procedural and object-oriented.

B) hardware and software.

C) practical and theoretical.

D) desktop and mobile.

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

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) The Java API provides a class named Math, which contains numerous methods that are useful for performing complex mathematical operations.

A)True

B)False

Answer: True

Q3) What will be the value of z as a result of executing the following code?

Int x = 5, y = 28; Float z;

Z = (float) (y / x);

A) 5.6

B) 3.0

C) 5.0

D) 5.60

Answer: C

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

Q2) The key word new

A) creates a new class.

B) creates a new Java byte code file.

C) creates an object in memory.

D) creates a new variable in memory.

Answer: C

Q3) The public access specifier for a field indicates that the field may not be accessed by statements outside the class.

A)True

B)False

Answer: False

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) A flag may have the values

A) defined or undefined.

B) of any range of numbers.

C) true or false.

D) of any Unicode character.

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

Double x = 45678.259; DecimalFormat formatter = new DecimalFormat("#,##0.0"); JOptionPane.showMessageDialog(null,formatter.format(x));

A) 45,678.26

B) 45,678.3

C) 45,678.259

D) 45678.259

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.

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) Before entering a loop to compute a running total, the program should first

A) set the accumulator variable to an initial value, usually zero.

B) set all variables to zero.

C) read all the values into main memory.

D) know exactly how many values there are to total.

Q2) A ________ is a value that signals when the end of a list of values has been reached.

A) terminal

B) sentinel

C) token

D) delimiter

Q3) The do-while loop is ideal in situations where you always want the loop to iterate at least once.

A)True

B)False

Q4) If a loop does not contain within itself a way to terminate, it is called

A) a for loop.

B) an infinite loop.

C) a while loop.

D) a do-while loop.

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) You can use the enum key word to

A) create your own data type.

B) specify the values that belong to that type.

C) Both A and B

D) Neither A nor B

Q2) The only limitation that static methods have is

A) they must be declared outside of the class.

B) they cannot refer to nonstatic members of the class.

C) they can only be called from static members of the class.

D) they can refer to only nonstatic members of the class.

Q3) The names of the enum constants in an enumerated data type must be enclosed in quotation marks.

A)True

B)False

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

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

40 Verified Questions

40 Flashcards

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

Sample Questions

Q1) You use this method to determine the number of items stored in an ArrayList object.

A) items

B) listLength

C) size

D) volume

Q2) What does the following statement do?

Double[] array1 = new double[10];

A) declares array1 to be a reference to an array of double values

B) will allow valid subscripts in the range of 0 through 9

C) creates an instance of an array of 10 double values

D) All of the above

Q3) Java provides a mechanism known as ________, which makes it possible to write a method that takes a variable number of arguments.

A) variable-length argument lists

B) dynamic parameter lists

C) unary-signature templates

D) polymorphic byte codes

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) If a string has more than one character used as a delimiter, we must write a loop to determine the tokens, one for each delimiter character.

A)True

B)False

Q2) What will be the value of position after the following code is executed?

Int position;

String str = "The cow jumped over the moon."; Position = str.lastIndexOf("ov", 14);

A) 14

B) 1

C) 0

D) -1

Q3) When working with the String and StringBuilder class's getChars method, the character at the start position is included in the substring, but the character at the end position is not included.

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 object-oriented programming, ________ allows you to extend the capabilities of a class by creating another class that is a specialized version of it.

A) prototyping

B) code reusability

C) inheritance

D) data hiding

Q2) In a class hierarchy,

A) the more general classes are toward the right of the tree and the more specialized classes are toward the left.

B) the more general classes are toward the left of the tree and the more specialized classes are toward the right.

C) the more general classes are toward the bottom of the tree and the more specialized classes are toward the top.

D) the more general classes are toward the top of the tree and the more specialized classes are toward the bottom.

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) What will be the result of the following statements?

FileInputStream fstream = new FileInputStream("Input.dat"); DataInputStream inFile = new DataInputStream(fstream);

A) The inFile variable will reference an object that is able to read random access data from the Input.dat file.

B) The inFile variable will reference an object that is able to read text data from the Input.dat file.

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

D) The inFile variable will reference an object that is able to write binary data to the Input.dat file.

Q2) If the data.dat file does not exist, what will happen when the following statement is executed?

RandomAccessFile randomFile = new RandomAccessFile("data.dat", "rw");

A) An IOExcepton will be thrown.

B) The file data.dat will be created.

C) A FileNotFoundException will be thrown.

D) A compiler error will occur.

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) If button1 references a JButton object, which of the following statements will make its background blue?

A) button1.makeBackground(Color.BLUE);

B) button1.setBackground(Color.BLUE);

C) button1.makeBackground(BLUE);

D) button1.set.Background(BLUE);

Q2) This method of the JOptionPane class is used to display a confirm dialog box.

A) showConfirmDialog

B) showConfirmationDialog

C) showConDialog

D) showCDialog

Q3) In GUI terminology, a container that can be displayed as a window is known as a A) buffer.

B) message dialog.

C) Swing package. D) frame.

Q4) By default, a window is hidden from view when the close button is clicked, but the application is not terminated.

A)True

B)False

13

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

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 indices for a list or combo box start at 1, not 0.

A)True

B)False

Q2) What will be the result of the following code if the user simply clicks OK? JPanel panel = new JPanel(); Color selectedColor; SelectedColor = JColorChooser.showDialog(null, "Select a Color", Color.BLUE); Panel.setForeground(selectedColor);

A) The foreground color will remain unchanged.

B) The foreground color will be set to blue.

C) The foreground color will be set to black.

D) The foreground color will be set to white.

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

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) The mouse generates two types of events: mouse events and mouse motion events.

A)True

B)False

Q2) The names of the AWT classes are the same as those of the Swing classes, except the AWT class names do not start with this letter.

A) J

B) X

C) S

D) A

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

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

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) This Scene Builder panel allows you to work with a component's properties, layout, and code.

A) Library Panel

B) Hierarchy Panel

C) Inspector Panel

D) Content Panel

Q2) You can use this component to display images in an application's GUI.

A) Label

B) ImageView

C) AnchorPane

D) ComboBox

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

Q4) In JavaFX, the components that are in a GUI are organized as a UML diagram.

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

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) Any problem that can be solved recursively can also be solved iteratively, with a loop.

A)True

B)False

Q4) A method that calls itself is a ________ method.

A) recursive

B) redundant

C) binary

D) derived

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

Q2) If you wish to sort the results of an SQL query, you can use the ________ clause.

A) SORT BY

B) ALIGN ROW

C) ORDER BY

D) ASCEND

Q3) SQL statements that are stored in the DBMS are called resident queries.

A)True

B)False

Q4) What term refers to data that describes other data?

A) Pseudo-data

B) Micro data

C) Abstract data

D) Meta data

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