Skip to main content

AP Computer Science A Midterm Exam - 953 Verified Questions

Page 1


AP Computer Science A

Midterm Exam

Course Introduction

AP Computer Science A is a college-level course designed to introduce students to the fundamentals of computer science with an emphasis on programming in Java. The course covers core topics such as algorithm development, data structures, object-oriented programming, and problem-solving techniques. Students gain hands-on experience by writing, analyzing, and debugging Java code, preparing them for the AP exam as well as further studies in computational fields. The curriculum emphasizes both the conceptual understanding and practical application of computer science principles, fostering logical thinking and analytical skills essential for modern technology careers.

Recommended Textbook

Starting Out with Java From Control Structures through Objects 6th Edition by Tony Gaddis

Available Study Resources on Quizplus

17 Chapters

953 Verified Questions

953 Flashcards

Source URL: https://quizplus.com/study-set/1747 Page 2

Chapter 1: Introduction to Computers and Java

Available Study Resources on Quizplus for this Chatper

51 Verified Questions

51 Flashcards

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

Sample Questions

Q1) RAM is usually:

A) A static type of memory, used for permanent storage

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

C) Secondary storage

D) An input/output device

Answer: B

Q2) ________ refers to the physical components that a computer is made of.

A) Device

B) System

C) Hardware

D) Software

Answer: C

Q3) This is a cross between human language and a programming language.

A) Pseudocode

B) Java

C) The Java Virtual Machine

D) The compiler

Answer: A

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

3

Chapter 2: Java Fundamentals

Available Study Resources on Quizplus for this Chatper

61 Verified Questions

61 Flashcards

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

Sample Questions

Q1) What will be displayed as a result of executing the following code? public class test { Public static void main(String[] args) {

Int value1 = 9; System.out.println(value1);

Int value2 = 45; System.out.println(value2); System.out.println(value3);

Value = 16;

94516

C) 9 45 16

D) Nothing, this is an error

Answer: D

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

Chapter 3: Decision Structures

Available Study Resources on Quizplus for this Chatper

64 Verified Questions

64 Flashcards

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

Sample Questions

Q1) The System.out.printf method formats a string and displays it in the console window.

A)True

B)False

Answer: True

Q2) This is an international coding system that is extensive enough to represent all the characters of all the world's alphabets:

A) ASCII

B) Unicode

C) Java

D) None of the above

Answer: B

Q3) Because the || operator performs short-circuit evaluation, your boolean expression will generally be evaluated faster if the subexpression that is most likely to be true is on the left.

A)True

B)False

Answer: True

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

Chapter 4: Loops and Files

Available Study Resources on Quizplus for this Chatper

57 Verified Questions

57 Flashcards

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

Sample Questions

Q1) In all but rare cases, loops must contain within themselves

A) arithmetic statements

B) if statements

C) a way to terminate

D) nested loops

Q2) This type of loop is ideal in situations where the exact number of iterations is known.

A) while loop

B) do-while loop

C) for loop

D) if statement

Q3) If you are using a block of statements, don't forget to enclose all of the statements in a set of:

A) Braces

B) Double quotes

C) Semicolons

D) Parentheses

Q4) The do-while loop must be terminated with a semicolon.

A)True

B)False

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

Chapter 5: Methods

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

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

Sample Questions

Q1) Values that are sent into a method are called:

A) variables

B) arguments

C) literals

D) types

Q2) Methods are commonly used to break a problem into small manageable pieces.

A)True

B)False

Q3) A value-returning method can return a reference to a non-primitive type.

A)True

B)False

Q4) No statement outside the method in which a parameter variable is declared can access the parameter by its name.

A)True

B)False

Q5) The lifetime of a method's local variable is:

A) the duration of the program

B) the duration of the class to which the method belongs

C) the duration of the method that called the local variable's method

D) only while the method is executing

7

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

Chapter 6: A First Look at Classes

Available Study Resources on Quizplus for this Chatper

58 Verified Questions

58 Flashcards

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

Sample Questions

Q1) Look at the following statement. import java.util.Scanner; This is an example of

A) a wildcard import

B) an explicit import

C) unconditional import

D) conditional import

Q2) A class's responsibilities include:

A) the things a class is responsible for doing

B) the things a class is responsible for knowing

C) both A and B

D) neither A nor B

Q3) What is stored by a reference variable?

A) A binary encoded decimal

B) A memory address

C) An object

D) A string

Q4) The term "default constructor" is applied to the first constructor written by the author of a class.

A)True

B)False

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

64 Verified Questions

64 Flashcards

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

Sample Questions

Q1) Which of the following is a valid declaration for a ragged array?

A) int[] ragged = new int[5];

B) int[][] ragged = new int[5][6];

C) int[][] ragged = new int[5][];

D) int[][] ragged = new int[][5];

Q2) Declaring an array reference variable does not create an array.

A)True

B)False

Q3) What will be the results of the following code? final int ARRAY_SIZE = 5;

Double[] x = new double[ARRAY_SIZE];

For(int i = 1; i <= ARRAY_SIZE; i++)

{

X[i] = 10.0;

}

A) All the values in the array are initialized to 10.0

B) All the values, except the first, are set to 10.0

C) An error will occur when the program runs.

D) There will be a compilation error

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

9

Chapter 8: A Second Look at Classes and Objects

Available Study Resources on Quizplus for this Chatper

50 Verified Questions

50 Flashcards

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

Sample Questions

Q1) Assuming the following declaration exists: enum Tree { OAK, MAPLE, PINE } What will the following code display? System.out.println(Tree.OAK);

A) Tree.OAK

B) 0

C) 1

D) OAK

E) Nothing. This statement will cause an error.

Q2) A static field is created by placing:

A) the key word static after the field name

B) the key word static after the access specifier and before the field's data type

C) the key word static after the access specifier and field's data type

D) it in a static field block

Q3) When a field is declared static, there will be:

A) a copy of the field in each class object

B) only one copy of the field in memory

C) a copy of the field for each static method in the class

D) only two copies of the field in memory

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

Chapter 9: Text Processing and More About Wrapper

Classes

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

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

Sample Questions

Q1) You must call a method to get the value of a wrapper class object. A)True B)False

Q2) Look at the following code. Integer myNumber; MyNumber = 5;

Which of the following is TRUE about the second statement?

A) It results in an error because you cannot assign a primitive type to a wrapper class object.

B) The statement performs autoboxing.

C) The statement performs unboxing.

D) The statement performs autowrapping.

Q3) Which of the following statements will print the maximum value a double variable may have?

A) System.out.println(MAX_VALUE);

B) System.out.println(double.MAX_VALUE);

C) System.out.println(Double.MAX_VALUE);

D) System.out.println(Double.MAXIMUM_VALUE);

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 11

Chapter 10: Inheritance

Available Study Resources on Quizplus for this Chatper

70 Verified Questions

70 Flashcards

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

Sample Questions

Q1) If a class contains an abstract method:

A) you must create an instance of the class

B) the method will have only a header, but not a body, and end with a semicolon

C) the method cannot be overridden in subclasses

D) All of the above.

Q2) When an interface variable references an object, you can use the interface variable to call any and all of the methods in the class implementing the interface.

A)True

B)False

Q3) Every class is either directly or indirectly derived from the Object class. A)True

B)False

Q4) A protected member of a class may be directly accessed by:

A) methods of the same class

B) methods of a subclass

C) methods in the same package

D) All of the above

Q5) All methods in an abstract class must also be declared abstract.

A)True

B)False

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

Chapter 11: Exceptions and Advanced File IO

Available Study Resources on Quizplus for this Chatper

56 Verified Questions

56 Flashcards

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

Sample Questions

Q1) To write data to a binary file you create objects from the following classes:

A) File and PrintWriter

B) File and Scanner

C) FileOutputStream and DataOutputStream

D) BinaryFileWriter and BinaryDataWriter

Q2) In a catch statement, what does the following code do? System.out.println(e.getMessage());

A) It prints the stack trace.

B) It prints the error message for an exception.

C) It prints the code that caused the exception.

D) It overrides the toString method.

Q3) All of the exceptions that you will handle are instances of classes that extend this class.

A) RunTimeException

B) IOException

C) Error

D) Exception

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

A)True

B)False

Page 13

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

Chapter 12: A First Look at GUI Applications

Available Study Resources on Quizplus for this Chatper

60 Verified Questions

60 Flashcards

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

Sample Questions

Q1) To use the ActionListener interface, as well as other event listener interfaces, you must have the following import statement in your code:

A) import java.swing; B) import java.awt;

C) import java.awt.*;

D) import java.awt.event.*;

Q2) The FlowLayout manager does not allow the programmer to align components. A)True

B)False

Q3) When you write an action listener class for a JButton component, it must:

A) have a method named buttonClicked

B) implement the ActionLIstener interface

C) have a method named actionPerformed which must take an argument of the ActionEvent type

D) both B and C

Q4) The ability to display splash screens was introduced in Java 6. A)True

B)False

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

14

Chapter 13: Advanced GUI Applications

Available Study Resources on Quizplus for this Chatper

58 Verified Questions

58 Flashcards

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

Sample Questions

Q1) You can create a label with an image, or with both an image and text.

A)True

B)False

Q2) A tool tip is:

A) a guide provided by the Help menu as to which tool to use for various programming techniques

B) another name for the Tool Bar

C) used to make programming easier

D) text that is displayed in a small box when the user holds the mouse cursor over a component

Q3) When creating images, the argument passed to the image parameter in the JLabel constructor can be an ImageIcon object, or any object that implements the Icon interface.

A)True

B)False

Q4) Java provides this component for creating lists:

A) JColumn

B) JList

C) JPanel

D) JFrame

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

Chapter 14: Applets and More

Available Study Resources on Quizplus for this Chatper

54 Verified Questions

54 Flashcards

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

Sample Questions

Q1) The delay parameter in the Timer constructor is the amount of time between action events, measured in microseconds.

A)True

B)False

Q2) What does the HTML tag &lt;hr /&gt; cause to happen?

A) A header routine is created.

B) A horizontal line will be displayed.

C) A default header reference will be linked to.

D) The window will be blanked out before the remainder of the text is displayed.

Q3) Applets are important because the can be used to:

A) extend the capabilities of a web page

B) process large data files

C) run other programs on the user's system

D) convert machine language into HTML

Q4) Which of the following sound file formats does Java not support?

A) .wav

B) .au

C) .mid

D) Java supports all of the above.

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

Chapter 15: Creating GUI Applications With Javafx and Scene Builder

Available Study Resources on Quizplus for this Chatper

40 Verified Questions

40 Flashcards

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

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

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

A) Label

B) ImageView

C) AnchorPane

D) ComboBox

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

Chapter 16: Recursion

Available Study Resources on Quizplus for this Chatper

42 Verified Questions

42 Flashcards

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

Sample Questions

Q1) Recursion can be a powerful tool for solving:

A) basic problems

B) repetitive problems

C) object-oriented problems

D) binary problems

Q2) Look at the following pseudocode algorithm: Algorithm Test3(int a, int b)

If (a < b)

Return 5

Else if ( a == b)

Return -5;

Else

Return (a + Test3(a - 1, b)

End Test3

What is the base case for the algorithm?

A) a < b

B) a == b

C) Both A and B

D) neither A nor B

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

Chapter 17: Databases

Available Study Resources on Quizplus for this Chatper

48 Verified Questions

48 Flashcards

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

Sample Questions

Q1) Of the following column names, which one is most likely a primary key column?

A) Price

B) Description

C) ItemNumber

D) Quantity

Q2) The data that is stored in a row is divided into:

A) sections

B) tables

C) bytes

D) columns

Q3) The DBMS works directly with the data, and sends the results of operations:

A) back to the application

B) along the encrypted data path

C) to the unified data component

D) back to the Web server

Q4) By default, ResultSet objects allows you to move the cursor:

A) backward only

B) vertically

C) forward only

D) horizontally

Page 19

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

Turn static files into dynamic content formats.

Create a flipbook
AP Computer Science A Midterm Exam - 953 Verified Questions by Quizplus - Issuu