Computer Science I Test Preparation - 620 Verified Questions

Page 1


Computer Science I Test Preparation

Course Introduction

Computer Science I is an introductory course that covers the fundamentals of computer science, including problem-solving techniques, algorithm development, and the basics of programming using high-level languages such as Python or Java. Students will learn foundational concepts such as variables, data types, control structures, functions, and simple data structures like arrays and lists. Emphasis is placed on developing logical thinking, debugging strategies, and good programming practices, providing a solid base for further study in computer science.

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) Logical errors are mistakes that cause the program to produce erroneous results.

A)True

B)False

Answer: True

Q2) A solid-state drive has no moving parts and operates faster than a traditional disk drive.

A)True

B)False

Answer: True

Q3) RAM is usually

A) an input/output device.

B) a volatile type of memory, used only for temporary storage.

C) secondary storage.

D) a static type of memory, used for permanent storage.

Answer: B

Q4) Java source files end with the .class extension.

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

Q2) The primitive data types only allow a(n) ________ to hold a single value.

A) class

B) literal

C) object

D) variable

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

Q2) The term "no-arg constructor" is applied to any constructor that does not accept arguments.

A)True

B)False

Answer: True

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

Q4) The java.lang package is automatically imported into all Java programs.

A)True

B)False

Answer: True

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 local variable's scope always ends at the closing brace of the block of code in which it is declared.

A)True B)False

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.

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

Int x, y = 15;

X = y--;

A) 14

B) 16

C) 0

D) 15

Q3) Assuming that inputFile references a Scanner object that was used to open a file, which of the following statements will read an int from the file?

A) int number = inputFile.next();

B) int number = inputFile.integer();

C) int number = inputFile.readInt();

D) int number = inputFile.nextInt();

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) Enumerated types have this method, which returns the position of an enum constant in the declaration list.

A) position

B) location

C) ordinal

D) index

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

A)True

B)False

Q3) To get the name of a calling enum constant,

A) simply use the enum constant in the statement.

B) use the ordinal method.

C) use the displayName method.

D) use the toString method.

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) The String[] args parameter in the main method header allows the program to receive arguments from the operating system command line.

A)True

B)False

Q2) Java does not limit the number of dimensions that an array may have.

A)True

B)False

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

A)True

B)False

Q4) The sequential search algorithm

A) returns 1 if the value being search for is found, otherwise it returns -1.

B) requires the array to be in ascending ordered.

C) uses a loop to sequentially step through an array, starting with the first element.

D) All of the above

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

Q2) Which of the following are used as delimiters if the StringTokenizer class's constructor is called and a reference to a String object is passed as the only argument?

A) space

B) tab

C) newline

D) All of the above.

Q3) Which of the following statements converts a double variable named tax to a string and stores the value in the String object variable named str?

A) String str = Double.toString(tax);

B) String str = double(tax);

C) String str = double.toString(tax);

D) String str = tax.Double.toString(str);

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) This shows the inheritance relationships among classes in a manner that is similar to a family tree.

A) UML diagram

B) CRC card

C) flowchart

D) class hierarchy

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) When one object is a specialized version of another object, there is this type of relationship between them.

A) "is a"

B) "contains a"

C) "has a"

D) "consists of"

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

Q2) Look at the following code:

FileInputStream fstream = new FileInputStream("info.dat"); DataInputStream inputFile = new DataInputStream(fstream);

This code could also be written as

A) DataInputStream inputFile = new DataInputStream(new FileInputStream("info.dat"));

B) DataInputStream inputFile = new DataInputStream("info.txt");

C) FileInputStream inputFile = new FileInputStream(new DataInputStream("info.dat"));

D) FileInputStream fstream = new DataInputStream("info.txt");

Q3) In a try statement, the try clause must appear first, followed by all of the catch clauses, followed by the optional finally clause.

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) It is possible to write the main method directly into a GUI class.

A)True

B)False

Q2) What does JFC stand for?

A) Java Frame Class

B) Java Fundamental Core

C) Java Fundamental Classes

D) Java Foundation Classes.

Q3) When an application is not performing correctly, programmers sometimes write statements that display ________ into the application.

A) JVM stack indicators

B) translated byte codes

C) diagnostic messages

D) analytic data output

Q4) Event listeners must

A) exit the application once it has handled the event.

B) not receive any arguments.

C) be included in private inner classes.

D) implement an interface.

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) The default selection mode for a JList component is

A) single selection mode.

B) multiple interval selection mode.

C) multiple selection mode.

D) single interval selection mode.

Q2) The indices for a list or combo box start at 1, not 0.

A)True

B)False

Q3) What is returned by the JList class's getSelectedIndex method?

A) the index of the selected item

B) -1 if no item is selected

C) Both A and B

D) None of the above

Q4) Which of the following statements adds the JList object referenced by namesList to the JScrollPane object referenced by namesListScrollPane?

A) JScrollPane namesListScrollPane = new JScrollPane(namesList);

B) namesList.addScrollPane(namesListScrollPane);

C) namesList.add(namesListScrollPane);

D) namesListScrollPane.add(namesList);

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) An applet class inherits from this class.

A) JWindow

B) JViewport

C) JFrame

D) JApplet

Q3) A mouse motion listener class must implement the MouseMotionListener interface, which is in this package.

A) javax.swing

B) java.awt.event

C) java.awt

D) java.lang

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 section of the Inspector Panel allows you to register the controller class and event listeners with the GUI.

A) Code

B) Properties

C) Layout

D) Content

Q2) Once you have created a GUI with Scene Builder, and saved it to an FXML file, you need to write a Java class that performs which of the following?

A) loads the FXML file

B) builds the scene graph in memory

C) displays the GUI

D) All of the above

Q3) This is an action that takes place within a program, such as the clicking of a button.

A) response

B) input

C) event

D) incident

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

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) Without a base case, a recursive method will call itself only once and stop.

A)True

B)False

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

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) In SQL, this is the not-equal-to operator.

A) !=

B) NOT

C) ||

D) <>

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

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

Q4) No two rows in a table can have the same value in the primary key column.

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