πŸ“š

Β >Β 

πŸ’»Β 

Β >Β 

πŸ“±

2.11 MC Answers and Review

4 min readβ€’june 18, 2024


AP Computer Science AΒ πŸ’»

130Β resources
See Units

Answers and Review for Multiple Choice Practice on Using Objects

https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-ShtwEzYtKh5V.png?alt=media&token=522ddb22-fac5-4c7a-aae8-9209a2877bed

This content, covered in key topic 2.6, reviews what each escape character prints.

β›”STOP!β›” Before you look at the answers make sure you gave this practice quiz a try so you can assess your understanding of the concepts covered in unit 2. Click here for the practice questions: AP Computer Science A Unit 2 Multiple Choice Questions.
Facts about the test: The AP Computer Science A exam has 40 multiple choice questions and you will be given 90 minutes to complete the section. That means it should take you around 34 minutes to complete 15 questions.

*The following questions were not written by CollegeBoard and although they cover information outlined in the AP Computer Science A Course and Exam Description the formatting on the exam may be different.


1. Which of the following would evaluate to the number 1?
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-wxpeYyvixpwa.png?alt=media&token=e941bb36-ca73-4f02-b060-b930b4a33ee5
A. x / y
B. y / x
C. a % b
D. (a + x) / x
Answer: % is remainder, which will be an integer value when a and b are divided

2. Consider String a below. Which of the following would create a new String with the value, "ram"? String a = new String ("Java Program");
A. String b=string (a)
B. String b = a.substring(9);
C. String b= a.substring (a)
D. String b = a.substring (12)
Answer: This creates a substring of the original string a, starting at the 9th character

3.Β  What special type of data is identified by the fact that it has methods, unlike primitive data?
A. objects
B. methods
C. variables
D. constants
Answer: Another giveaway that this is not primitive data is that variables of this type begin with a capital letter.
πŸ“„ Study AP Computer Science A, Unit 2.0: Unit 2 Overview

4. Consider the code segment attached. What is the result displayed?
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-Shl7vkUi9Ers.png?alt=media&token=836f9514-d9cc-4934-bb85-e8e14c03ec3c
A. 3
B. 5
C. 8
D. 125
Answer: Will result in the location of "t", which is 5

5. What is the value of z stored after the following code is run?
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-q6DI9QdF11Xn.png?alt=media&token=c05df0b0-0068-422b-a13f-2f4a33b1a2dc
A. 6
B. 6.0
C. 6.00
D. 6.00001
Answer: Double will include one decimal place, even when the value is exact

6. The output of the program code below will not always be the same. What is the range of numbers that could be printed?
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-m2HsUT2N3rG9.png?alt=media&token=f208bb2e-5df9-448e-8d41-dc4c07bdd445
A. 0-4
B. 0-6
C. 1-5
D. 1-6
Answer: Random will give between 0-1, the word length will be 4.

7. Which of the following is the correct import necessary to create a Scanner?
A. create.Scanner;
B. import Java-scanner;
C. import.Scanner;
D. import.util.java.Scanner;
Answer: Import from the utility library

8. What will be the result of 2 % 6?
A. 0
B. 2
C. 3
D. 4
Answer: Remainder when 2 is divided by 6.

9. Which of the following would be the most appropriate variable to store a bank account balance?
A. double bankBalance;
B. decimal money;
C. int balance;
D. long money;
Answer: Double will give decimal for cents
πŸ“„ Study AP Computer Science A, Unit 2.9: Using the Math Class

10. Which operator is known as the assignment statement?
A. =
B. ==
C. -->
D. <--
Answer: The assignment operator is the equal sign

11. What is the disadvantage of the import statement: import java.util.*; ?
A. there is no disadvantage
B. the file would import all code in java.util, which would make the file bigger
C. it would only import the code that has * with it
D. this doesn't exist, so it would give an error

12. Which of the following is overloading?
A. When one constructor is defined in a class
B. When a constructor takes more than one parameter
C. When a constructor takes one parameter
D. When more than one constructor is defined in a class
Answer: This is just the definition of overloading.
πŸ“„ Study AP Computer Science A, Unit 2.2: Creating and Storing Objects (Initialization)

13. Which of the following is valid syntax for creating and initializing a World object?
A. World w = null;
B. World w = new.World;
C. World w = new.World();
D. World w = World();
Answer: w defined as new, and object of World

14. Which of the following is the correct signature for a no-argument constructor?
A. public World()
B. public World
C. public World(int width)
D. public World(int width, int height)
Answer: () must be included but empty
πŸ“„ Study AP Computer Science A, Unit 2.2: Creating and Storing Objects (Initialization)

15. In new World (150, 200), what are 150 and 200?
A. formal parameters
B. actual parameters
C. objects
D. classes
Answer: An actual parameter (argument) is the value passed into the constructor.
πŸ“„ Study AP Computer Science A, Unit 2.4: Calling a Void Method With Parameters

What can we help you do now?
πŸ”Study for Unit 3
🦘Jump to AP Computer Science A Unit 3 Multiple Choice Questions
🀝Connect with other students studying AP Computer Science A with Hours
Browse Study Guides By Unit
βž•Unit 1 – Primitive Types
πŸ“±Unit 2 – Using Objects
πŸ–₯Unit 3 – Boolean Expressions & if Statements
πŸ•ΉUnit 4 – Iteration
βš™οΈUnit 5 – Writing Classes
⌚️Unit 6 – Array
πŸ’ΎUnit 7 – ArrayList
πŸ’»Unit 8 – 2D Array
πŸ–²Unit 9 – Inheritance
πŸ–±Unit 10 – Recursion
🧐Exam Skills

Fiveable
Fiveable
Home
Stay Connected

Β© 2024 Fiveable Inc. All rights reserved.


Β© 2024 Fiveable Inc. All rights reserved.