

Introduction to Computer Science Test
Questions
Course Introduction
Introduction to Computer Science provides an overview of the fundamental concepts and principles underlying the field of computing. The course covers essential topics such as algorithms, programming languages, data structures, software development, computer hardware, networks, and the basics of cybersecurity. Students will gain practical experience through hands-on programming exercises, often using widely-used languages such as Python or Java. Emphasis is placed on problem-solving, logical thinking, and understanding how computers process and store information. This foundational course prepares students for further study in computer science and related disciplines.
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) Each byte is assigned a unique number known as an address.
A)True
B)False
Answer: True
Q2) Colons are used to indicate the end of a Java statement.
A)True
B)False
Answer: False
Q3) Which of the following is not part of the programming process?
A) design/model
B) debugging/correcting errors
C) testing
D) All the above are parts of the programming process.
Answer: D
Q4) 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) What is the result of the following expression?
10 + 5 * 3 - 20
A) -5
B) -50
C) 5
D) 25
Answer: C
Q2) If you wish to use the System.out.printf method to print a string argument, use the ________ format specifier.
A) %d
B) %b
C) %f
D) %s
Answer: D
Q3) The System.out.printf method allows you to format output in a variety of ways.
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) Shadowing is the term used to describe where the field name is hidden by the name of a local or parameter variable.
A)True
B)False
Answer: True
Q2) Another term for an object of a class is a(n)
A) access specifier.
B) instance.
C) member.
D) method.
Answer: B
Q3) What is the following statement an example of? import java.util.*;
A) an explicit import statement
B) an unconditional import statement
C) a wildcard import statement
D) a conditional import statement
Answer: C
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 displayed when the following code is executed?
Int y = 10; If (y == 10 {
Int x = 30; X += y; System.out.println(x); }
A) 40
B) 30
C) 20
D) The code contains an error and will not compile.
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
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) When working with the PrintWriter class, which of the following import statements should you have near the top of your program?
A) import javax.swing.*;
B) import javac.io.*;
C) import java.io.*;
D) import java.file.*;
Q2) When the break 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
Q3) 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.
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.
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) 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
Q2) If you write a toString method for a class, Java will automatically call the method any time you concatenate an object of the class with a string.
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) ________ is the term for the relationship created by object aggregation.
A) "Has a"
B) Inner class
C) "Is a"
D) One-to-many
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) If numbers is a two-dimensional array, which of the following would give the number of columns in row r?
A) numbers.length
B) numbers.length[r]
C) numbers[r].length
D) numbers[r].length[r]
Q2) What does <String> specify in the following statement? ArrayList<String> nameList = new ArrayList<String>();
A) It specifies that String objects may not be stored in the ArrayList object.
B) It specifies that everything stored in the ArrayList object will be converted to a String object.
C) It specifies that only String objects may be stored in the ArrayList object.
D) It specifies that the ArrayList will be converted into a String array.
Q3) You can use the ________ method to replace an item at a specific location in an ArrayList.
A) set
B) remove
C) replace
D) add
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) What will be displayed after the following statements are executed? StringBuilder strb = New StringBuilder("We have lived in Chicago, Trenton, and Atlanta."); Strb.replace(17, 24, "Tampa"); System.out.println(strb);
A) We have lived in Tampa, Trenton, and Atlanta.
B) We have lived in Chicago, Trenton, and Tampa.
C) We have lived in Chicago, Tampaon, and Atlanta.
D) We have lived in Chicago, Tampa, and Atlanta.
Q2) Trying to extract more tokens than exist from a StringTokenizer object will cause an error.
A)True
B)False
Q3) 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
Q4) You cannot assign a value to a wrapper class object. 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 ________, inheritance is shown with a line that has an open arrowhead at one end that points to the superclass.
A) pseudocode
B) UML diagrams
C) CRC cards
D) hierarchy charts
Q2) When a subclass overrides a superclass method, only the subclass's version of the method can be called with a subclass object.
A)True
B)False
Q3) If ClassC is derived from ClassB, which is derived from ClassA, this would be an example of
A) a chain of inheritance.
B) linear inheritance.
C) multiple interfaces.
D) cascading classes.
To view all questions and flashcards with answers, click on the resource link above.

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) If a program does not handle an unchecked exception, what is the result?
A) The program must handle the exception.
B) The program is halted and the default exception handler handles the exception.
C) The exception is ignored.
D) A compiler error will occur.
Q2) An exception object's default error message can be retrieved using this method.
A) getMessage
B) getDefaultMessage
C) getDefaultErrorMessage
D) getErrorMessage
Q3) 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.
Q4) The throw statement informs the compiler that a method throws one or more exception.
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) Because the System.out.println method sends its output to the console, diagnostic messages can be displayed without interfering with the application's GUI windows.
A)True
B)False
Q2) 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);
Q3) Even if you write an event listener, it will not execute unless it has been registered with the correct component.
A)True
B)False
Q4) This layout manager arranges components in rows.
A) RegionLayout
B) BorderLayout
C) FlowLayout
D) GridLayout
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) 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
Q2) The appearance of a particular system's GUI is known as its A) art style.
B) user interface.
C) look and feel.
D) system aesthetics.
Q3) To give a combo box a text field, you must call the setEditable method and pass false as an argument.
A)True
B)False
Q4) 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 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
Q2) HTML has sophisticated abilities such as performing math calculations and interacting with the user.
A)True
B)False
Q3) If you need to load a sound file to be played multiple times, you should use this object.
A) Album
B) Track
C) SoundByte
D) AudioClip
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) In JavaFX, this component is commonly used as a GUI's root node.
A) List
B) AnchorPane
C) Button
D) ComboBox
Q2) This is a markup language that describes the components in a JavaFX scene graph.
A) SGML
B) HTML
C) XML
D) FXML
Q3) This is a name that identifies a component in the FXML file and will also become a variable name that you can use later in the Java code that you will write to run the application.
A) fx:id
B) fx_id
C) FXID
D) fx.URL
Q4) In JavaFX, the components that are in a GUI are organized as a UML diagram.
A)True
B)False

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

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) 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
Q2) Without a base case, a recursive method will call itself only once and stop.
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 Towers of Hanoi is a mathematical game that is often used in computer science textbooks to illustrate the power of recursion.
A)True
B)False
Q5) Recursion is never absolutely required to solve a problem.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above.

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) You use this statement in SQL to insert a new row into a table.
A) UPDATE
B) ADD
C) NEW
D) INSERT
Q2) In SQL, this character can be used as a wildcard to represent a single character.
A) %
B) $
C) _
D) *
Q3) What is the default concurrency level of a ResultSet object?
A) Public
B) Updatable
C) Private
D) Read-only
Q4) SQL does not provide functions for performing calculations.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above.
Page 18