AP Computer Science Review Game

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Manefuto
M
Manefuto
Community Contributor
Quizzes Created: 1 | Total Attempts: 846
| Attempts: 846 | Questions: 39
Please wait...
Question 1 / 39
0 %
0/100
Score 0/100
1. In Java, every statement must end with this symbol. [Appears on Quiz 1]

Explanation

In Java, every statement must end with a semicolon (;). This is because the semicolon is used as a delimiter to mark the end of a statement. It is a crucial part of the Java syntax and is required to ensure that the code is properly structured and can be compiled without any errors.

Submit
Please wait...
About This Quiz
AP Computer Science Review Game - Quiz

Questions to help prepare for the midterm exam in AP Computer Science.

Personalize your quiz and earn a certificate with your name on it!
2. Which statement best describes a computer program? [Found in Quiz 1]

Explanation

A computer program is a sequence of instructions and decisions that the computer carries out. This means that a program consists of a series of steps or commands that tell the computer what tasks to perform and how to perform them. It can include conditional statements that allow the program to make decisions based on certain conditions. This definition highlights the fact that a program is not limited to performing only one simple task, nor is it simply a sequence of comments. Instead, it encompasses a range of instructions and decisions that enable the computer to execute complex tasks.

Submit
3. What term is used to refer to a sequence of characters enclosed in quotation marks? [Appears on Quiz 1]

Explanation

A sequence of characters enclosed in quotation marks is referred to as a string. Strings are commonly used to represent text in programming languages. They can include letters, numbers, symbols, and spaces. Strings are often used for storing and manipulating textual data in computer programs.

Submit
4. What is a term used to describe an error detected by the compiler that is a violation of the programming language rules? [Appears on Quiz 1]

Explanation

A syntax error is a term used to describe an error detected by the compiler that is a violation of the programming language rules. This means that the code written does not follow the proper syntax or grammar of the programming language being used. Syntax errors are typically caught by the compiler during the compilation process and need to be fixed before the code can be executed.

Submit
5. The input to a method is called a(n) _______________. [Appears in Quiz 2]

Explanation

In programming, a method is a block of code that performs a specific task. The input that is passed to a method is called a parameter. Parameters allow us to pass values or data into a method, which can then be used by the method to perform its task. They act as placeholders for the actual values that will be provided when the method is called. Therefore, the correct answer to the question is "parameter".

Submit
6. When the body of a loop contains another loop, the loops are __________.

Explanation

When the body of a loop contains another loop, the loops are referred to as "nested." This means that one loop is enclosed within another loop, creating a hierarchical structure. The outer loop controls the execution of the inner loop, and the inner loop is executed multiple times for each iteration of the outer loop. This nesting allows for more complex and intricate control flow in programming, as different levels of loops can be used to handle different tasks or conditions.

Submit
7. What term is used to refer to a sequence of steps for solving a problem that is unambiguous, executable, and terminating? [Appears on Quiz 1]

Explanation

An algorithm is a term used to refer to a sequence of steps for solving a problem that is unambiguous, executable, and terminating. It is a well-defined and systematic approach to problem-solving, providing a clear set of instructions to achieve a specific outcome. Algorithms are commonly used in computer science and mathematics to solve complex problems efficiently and effectively. They play a crucial role in various fields, including programming, data analysis, and artificial intelligence.

Submit
8. Which of the following statements about methods is correct? [Appears in Quiz 2]

Explanation

A method is a sequence of instructions that accesses the data of an object. This means that a method is a set of code that performs a specific task or action on the data associated with an object. It allows us to manipulate and interact with the data within an object by performing operations or calculations. Methods are an essential part of object-oriented programming as they encapsulate the behavior or functionality of an object.

Submit
9. You should provide documentation comments for ___. [Appears on Quiz 3]

Explanation

Documentation comments should be provided for every class, every method, every parameter, and every return value. This is important because documentation comments serve as a form of documentation for the code, providing information about the purpose, behavior, and usage of the classes, methods, parameters, and return values. This documentation can be helpful for other developers who may need to understand or use the code in the future, as well as for the original developer who may need to refer back to the code at a later time.

Submit
10. The output of a method is called its __________ value. [Appears in Quiz 2]

Explanation

The output of a method is commonly referred to as its "return" value. This is because when a method is called, it performs a series of operations and then returns a value back to the caller. This value can be used for further processing or stored in a variable. The "return" keyword is used in the method to specify the value that should be returned.

Submit
11. What translates high-level descriptions into machine code? [Appears on Quiz 1]

Explanation

A compiler translates high-level descriptions, written in a programming language, into machine code. This process involves converting the entire code into a binary format that can be directly executed by the computer's processor. Unlike an interpreter, which translates and executes the code line by line, a compiler generates an executable file that can be run independently. Linkers, assemblers, and interpreters are also involved in the compilation process, but the compiler is responsible for the main translation of high-level code into machine code.

Submit
12. What is the result of a % b when variables a and b are declared as follows: int a = 9; int b = 5;? [Appears in Chap 2 & 4 HW3]

Explanation

The result of a % b when a = 9 and b = 5 is 4. The % operator in programming is called the modulus operator, which returns the remainder of the division between two numbers. In this case, 9 divided by 5 equals 1 with a remainder of 4, so the result is 4.

Submit
13. What is the term that means to put strings together to form a longer string? [Appears in Chap 2 & 4 HW3]

Explanation

Concatenation refers to the process of combining or joining strings together to form a longer string. It involves taking two or more separate strings and merging them into a single string. This can be done using various programming languages and string manipulation techniques.

Submit
14. What is the term that means to explicitly convert a value to a different type? [unseen Wiley Chap 4 question]

Explanation

The term "cast" refers to explicitly converting a value to a different type. It is a process where a value of one data type is converted into another data type. This is often done when the programmer wants to perform operations or assignments that require different data types. By using the cast operator, the programmer can specify the desired data type for the value, allowing it to be converted accordingly.

Submit
15. Which statement about identifiers is correct? [Appears on Quiz 1]

Explanation

This statement is correct because identifiers in programming languages can indeed be made up of letters, digits, and the underscore (_) character. This allows for a wide range of possibilities when naming variables, functions, or other elements in a program.

Submit
16. What is an object? [Appears in Quiz 2]

Explanation

An object is an entity in a program that can be manipulated by calling methods. In object-oriented programming, objects are instances of classes and they have their own set of properties and behaviors defined by the class. Objects allow for the organization and encapsulation of data and functionality, making it easier to manage and manipulate complex systems. By calling methods on an object, we can perform operations and modify its state. This definition accurately describes the concept of an object in programming.

Submit
17. A _____________ is a collection of classes with a related purpose. [Appears in Quiz 2]

Explanation

A package is a collection of classes with a related purpose. In Java, packages are used to organize and group related classes together. They provide a way to manage the code and make it more modular and reusable. By placing related classes in the same package, it becomes easier to locate and use them in the code. Packages also help in avoiding naming conflicts by providing a unique namespace for classes.

Submit
18. Which statement accesses the first element of an array of strings named sData.

Explanation

The correct answer is "String s = sData[0];". This statement uses square brackets to access the first element of the array named sData. The index inside the square brackets is 0, which represents the first element in the array.

Submit
19. What is the output of the following program segment?    int num = 5;    while (num >= 0)    {          num -= 2;     }    System.out.print(num); [Not seen before]

Explanation

The program segment starts with the variable "num" initialized to 5. The while loop continues as long as "num" is greater than or equal to 0. Inside the loop, "num" is decremented by 2. Since 5 is greater than 0, the loop runs and "num" becomes 3. Then, "num" becomes 1, and finally -1. When the loop condition is checked again, -1 is not greater than or equal to 0, so the loop terminates. The final value of "num" is -1, which is printed as the output.

Submit
20. The name of the constructor is always the same as the name of the __. [Appears in Quiz 3]

Explanation

The name of the constructor is always the same as the name of the class. This is because the constructor is a special method that is used to initialize objects of a class. It is called automatically when an object is created, and it has the same name as the class it belongs to. This allows the constructor to be easily identified and called when creating new instances of the class.

Submit
21. Which statement is true about a Java program? [Appeasr on Exam 1]

Explanation

Java is case sensitive, meaning that it distinguishes between uppercase and lowercase letters in its syntax. This means that when writing code in Java, the programmer must use the correct capitalization for keywords, variable names, and method names. For example, "System.out.println" is different from "system.out.println". This is an important aspect of the Java language and must be taken into consideration when writing and executing Java programs.

Submit
22. Which of the following code fragments will compile without error? [unseen Wiley Chap 4 question]

Explanation

The code fragment "double balance = 13.75; int dollars = (int) balance;" will compile without error. This is because the variable "balance" is declared as a double and assigned the value 13.75, which is a valid double value. The value of "balance" is then cast to an int and assigned to the variable "dollars". This casting is allowed because it is an explicit cast from a larger data type (double) to a smaller data type (int).

Submit
23. What contains the instructions to initialize the instance variables of an object? [Appears in Chap 3 HW5]

Explanation

A constructor contains the instructions to initialize the instance variables of an object. It is a special method that is automatically called when an object is created. The constructor is responsible for setting the initial values of the object's instance variables, ensuring that the object is properly initialized and ready for use.

Submit
24. Which operator constructs object instances? [Appeasr on Exam 1]

Explanation

The "new" operator is used in Java to construct object instances. It is followed by the name of the class and parentheses, which can include arguments if necessary. When "new" is used, memory is allocated for the object and the constructor of the class is called to initialize the object. This allows us to create new instances of a class and use them in our program.

Submit
25. What is the type of an object? [Appears in Quiz 2]

Explanation

The correct answer is "class" because an object is an instance of a class. In object-oriented programming, a class is a blueprint for creating objects. Objects are created from classes and they have their own unique set of properties and behaviors defined by the class. Therefore, the type of an object is determined by its class.

Submit
26. What type of loop is executed at least once?

Explanation

The do-while loop is executed at least once because the condition is checked at the end of the loop. This means that the code block within the loop will always be executed at least once before the condition is evaluated.

Submit
27. In Java, what reserved word is used to identify constants? [unseen Wiley Chap 4 question]

Explanation

The reserved word "final" is used in Java to identify constants. In Java, a constant is a variable whose value cannot be changed once it has been assigned. By using the "final" keyword, we can declare a variable as a constant, indicating that its value should remain constant throughout the program.

Submit
28. In the statement below, amount is referred to as the ____ parameter. public void deposit(double amount) [Appears on Quiz 3]

Explanation

In the given statement, the parameter "amount" is referred to as the explicit parameter because it is explicitly stated in the method signature.

Submit
29. Which method inserts an element in the middle of an array list, increasing its size?

Explanation

The add method is used to insert an element in the middle of an array list and it also increases the size of the array list. This method allows you to specify the index at which you want to insert the element, and it will shift the existing elements to accommodate the new element. By using the add method, you can effectively insert an element in the middle of the array list and ensure that the size of the list is appropriately increased.

Submit
30.
  1. Rewrite the following traditional for loop header as an enhanced for loop, assuming that  ArrayList<String> names has been initialized.
     for (int i = 0; i < names.size(); i++)    {       // process name    }

Explanation

The correct answer is "for (String s : names)". In an enhanced for loop, the loop variable is declared as the type of the elements in the collection followed by a colon, and then the name of the collection. In this case, the loop variable is "String s" and the collection is "names", which is an ArrayList of Strings. This loop will iterate over each element in the names ArrayList and assign it to the variable "s", allowing for easy processing of each name.

Submit
31. A local variable is a variable declared in the... [Appears on Quiz 3]

Explanation

A local variable is a variable that is declared within the body of a method. It is only accessible within the scope of that method and cannot be accessed by other methods or classes. Local variables are typically used to store temporary data or intermediate results within a method.

Submit
32. Index values of an array list named qInfo range from ______ to ________.

Explanation

The index values of an array list named qInfo range from 0 to qInfo.size() - 1. This is because the index of the first element in an array list is 0, and the index of the last element is the size of the array list minus 1. Therefore, the valid index values for qInfo would be 0, 1, 2, ..., qInfo.size() - 1.

Submit
33. What is the output from                                int n = 12;       System.out.print(goFigure(n));       System.out.print(" " + n); where the method goFigure is defined as follows:            public double goFigure(int n)       {          n = n % 7;           return (double)(12 / n);        } [Not seen before]

Explanation

(double)(12 / 5) results in 2.0 [12 / 5.0 would allow for a result of 2,.4]
and n remains unchanged because it is passed to goFigure by value and the scope changes which n variable it is looking at.

Submit
34. With a __________________ array, keep a companion variable to track how many elements are used.

Explanation

In this context, the term "partially filled" suggests that the array contains some elements, but not all of its elements have been assigned a value. To keep track of the number of elements that have been used, a companion variable is used. This variable helps in determining the actual size or length of the array and allows for efficient memory allocation and manipulation.

Submit
35. Which of the following statements displays 1234? I.    System.out.print(12 * 100 + 34); II.   System.out.print("12" + 34); III.  System.out.print(12 + "34"); [Not seen before]

Explanation

not-available-via-ai

Submit
36. You access array elements with an integer index, using the _____ operator.

Explanation

You access array elements with an integer index, using the get operator.

Submit
37. A method is invoked on what type of parameter? [Appears on Quiz 3]

Explanation

When a method is invoked, the implicit parameter refers to the object on which the method is called. It is also known as the calling object or the target object. The implicit parameter is automatically passed to the method when it is called and allows the method to access the properties and behaviors of the object. In other words, the implicit parameter specifies the object that the method is being called on.

Submit
38. There are 3 items specified in when a method is called.  Provide the order of those three items: __________________ [Appeasr on Exam 1]

Explanation

The order of the three items specified when a method is called is as follows: first, the object on which the method is being called, then the name of the method itself, and finally any parameters that the method requires. This order is important because it allows the program to identify the specific object and method that need to be executed, and to pass any necessary data to the method through the parameters.

Submit
39. A method header consists of these parts: __________________________ [Appears on Quiz 3]

Explanation

The method header consists of an access specifier, which determines the visibility of the method, a return type, which specifies the type of value that the method returns (if any), a method name, which is the identifier for the method, and a list of parameters (if any), which are the variables that the method accepts as input. These parts together define the signature of the method and allow other parts of the program to call and use the method correctly.

Submit
View My Results

Quiz Review Timeline (Updated): Mar 22, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 22, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • May 08, 2019
    Quiz Created by
    Manefuto
Cancel
  • All
    All (39)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
In Java, every statement must end with this symbol....
Which statement best describes a computer program? [Found in Quiz 1]
What term is used to refer to a sequence of characters enclosed in...
What is a term used to describe an error detected by the compiler that...
The input to a method is called a(n) _______________....
When the body of a loop contains another loop, the loops are...
What term is used to refer to a sequence of steps for solving a...
Which of the following statements about methods is correct?...
You should provide documentation comments for ___. [Appears on Quiz 3]
The output of a method is called its __________ value....
What translates high-level descriptions into machine code?...
What is the result of a % b when variables a and b are declared as...
What is the term that means to put strings together to form a longer...
What is the term that means to explicitly convert a value to a...
Which statement about identifiers is correct? [Appears on Quiz 1]
What is an object? [Appears in Quiz 2]
A _____________ is a collection of classes with a related purpose....
Which statement accesses the first element of an array of strings...
What is the output of the following program segment?...
The name of the constructor is always the same as the name of the __....
Which statement is true about a Java program? [Appeasr on Exam 1]
Which of the following code fragments will compile without error?...
What contains the instructions to initialize the instance variables of...
Which operator constructs object instances? [Appeasr on Exam 1]
What is the type of an object? [Appears in Quiz 2]
What type of loop is executed at least once?
In Java, what reserved word is used to identify constants?...
In the statement below, amount is referred to as the ____ parameter....
Which method inserts an element in the middle of an array list,...
Rewrite the following traditional for loop header as an enhanced for...
A local variable is a variable declared in the... [Appears on Quiz 3]
Index values of an array list named qInfo range from ______ to...
What is the output from...
With a __________________ array, keep a companion variable to track...
Which of the following statements displays 1234?...
You access array elements with an integer index, using the _____...
A method is invoked on what type of parameter? [Appears on Quiz 3]
There are 3 items specified in when a method is called.  Provide...
A method header consists of these parts: __________________________...
Alert!

Advertisement