

Introduction to Computer Science
Mock Exam
Course Introduction
Introduction to Computer Science provides a comprehensive overview of the fundamental concepts and principles underlying the field of computing. Students are introduced to problem-solving techniques, algorithm development, and the basics of programming using a modern language. The course explores essential topics such as data structures, computer hardware and software, operating systems, and the societal impact of computing. By engaging in hands-on projects and practical exercises, learners gain foundational skills that form the basis for advanced 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) Encapsulation refers to the combining of data and code into a single object.
A)True
B)False
Answer: True
Q2) This is a set of programming language statements that, together, perform a specific task.
A) pseudocode
B) compiler
C) object
D) procedure
Answer: D
Q3) A runtime error is usually the result of
A) a logical error.
B) a syntax error.
C) a compilation error.
D) bad data.
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) This is a value that is written into the code of a program.
A) Literal
B) Assignment statement
C) Operator
D) Variable
Answer: A
Q3) Unlike a console program, a program that uses JOptionPane does not automatically stop executing when the end of the main method is reached.
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) Class objects normally have ________ that perform useful operations on their data, but primitive variables do not.
A) fields
B) relationships
C) methods
D) instances.
Answer: C
Q2) What does the following UML diagram entry mean? + setHeight(h : double) : void
A) a public method with a parameter of data type double that does not return a value
B) a private field called Height that is a double data type
C) a private method with no parameters that returns a double data type
D) a public field called Height that is a double data type
Answer: A
Q3) A group of related classes is called a(n)
A) archive.
B) package.
C) collection.
D) attachment.
Answer: B
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?
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
Q2) 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.
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) In a for loop, the control variable can only be incremented.
A)True
B)False
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) The for loop is a posttest loop that has built-in expressions for initializing, testing, and updating.
A)True
B)False
Q4) Which of the following statements opens a file named MyFile.txt and allows you to read data from it?
A) Scanner inputFile = new Scanner("MyFile.txt");
B) File file = new File("MyFile.txt"); Scanner inputFile = new Scanner(file);
C) File file = new File("MyFile.txt");
D) PrintWriter inputFile = new PrintWriter("MyFile.txt");
Page 7
To view all questions and flashcards with answers, click on the resource link above.

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) A method's signature consists of
A) the method name and the parameter list.
B) the return type, the method name, and the parameter list.
C) the size of the method in memory.
D) the return type and the method name.
Q2) An enumerated data type is actually a special type of class.
A)True
B)False
Q3) 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
Q4) You may use this to compare two enum data values.
A) the ordinal method
B) the ==, >, and < operators
C) the equals and compareTo methods
D) the moreThan, lessThan, and equalsTo methods
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) An ArrayList object automatically expands in size to accommodate the items stored in it.
A)True
B)False
Q3) You can use this ArrayList class method to insert an item at a specific location in an ArrayList.
A) set
B) store
C) add
D) insert
Q4) A sorting algorithm is a technique for scanning through an array and rearranging its contents in some specific order.
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 ________ method accepts a value of any primitive data type as its argument and returns a string representation of the value.
A) trim
B) getChar
C) toString
D) valueOf
Q2) In the ________ file format, when the data in a spreadsheet is exported, each row is written to a line, and the values in the cells are separated by commas.
A) comma separated value
B) extensible markup language
C) excel binary
D) data interchange
Q3) Any ________ argument passed to the Character class's toLowerCase method or toUpperCase method is returned as it is.
A) nonletter
B) char
C) string
D) static
To view all questions and flashcards with answers, click on the resource link above.
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) 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
Q2) 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
Q3) In Java, a reference variable is ________ because it can reference objects of types different from its own, as long as those types are related to its type through inheritance.
A) static
B) dynamic
C) polymorphic
D) public
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) 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) 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.
To view all questions and flashcards with answers, click on the resource link above.
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) A mutually exclusive relationship is created between radio buttons only when they are added to a ButtonGroup object.
A)True
B)False
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) When used as an exit code, this value traditionally indicates that the program ended successfully.
A) -1
B) null
C) 0
D) 1

Page 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) If null is passed as an argument to the JFileChooser class's showOpenDialog method,
A) the dialog box will be created in memory, but it will not be displayed.
B) the dialog box will be displayed in the lower-right corner of the screen.
C) the dialog box will be displayed in the upper-left corner of the screen.
D) the dialog box will be displayed in the center of the screen.
Q2) When an item in a Jlist object is selected, it generates a(n)
A) list selection event.
B) click event.
C) action listener event.
D) list listener event.
Q3) You can create a label with an image or text, but you cannot create a label with both an image and text.
A)True
B)False
Q4) 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.
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) These are Java programs that are usually part of a Web site.
A) classes
B) applications
C) applets
D) Web services
Q2) Applets are important because they can be used to extend the capabilities of a stand-alone Java application.
A)True
B)False
Q3) 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
Q4) Once you create a mouse listener class, you can register it with a component using this method, which is inherited from the Component class.
A) addMouseListener
B) getMouseListenerEvent
C) initMouseListener
D) addMouseListenerEvent
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) The ________ is responsible for handling events that occur while the JavaFX application is running.
A) abstract class
B) main application class
C) controller class
D) super class
Q2) In addition to accepting input from the keyboard, GUIs typically accept input from a mouse, or a touch screen.
A)True
B)False
Q3) 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
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) 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
Q2) 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
Q3) A recursive method can have no more than one base case.
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.
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) What does JDBC stand for?
A) Java data binary collection
B) Java database connectivity
C) Java database collection
D) Java data basic computation
Q2) SQL stands for
A) structured query language.
B) standard equivalent language.
C) semiconductor qualified language.
D) simple equation library.
Q3) No two rows in a table can have the same value in the primary key column.
A)True
B)False
Q4) Which of the following shows how a single quote is represented as part of a string in SQL?
A) _'
B) "'"
C) /'
D) ''
To view all questions and flashcards with answers, click on the resource link above. Page 18