# 2.11 MC Answers and Review

130 resources
See Units

## Answers and Review for Multiple Choice Practice on Using Objects 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? 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? 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? 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? 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.*; ?
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

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

🔍Study for Unit 3
🤝Connect with other students studying AP Computer Science A with Hours
Browse Study Guides By Unit
Unit 1 – Primitive Types
🖥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 Reviews
{"ft_lang_label":"__label__en","ft_lang_prob":0.857931,"math_prob":0.658716,"size":4248,"snap":"2023-14-2023-23","text_gpt3_token_len":1115,"char_repetition_ratio":0.12558907,"word_repetition_ratio":0.03354839,"special_character_ratio":0.2641243,"punctuation_ratio":0.18607068,"nsfw_num_words":1,"has_unicode_error":false,"math_prob_llama3":0.9870881,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12],"im_url_duplicate_count":[null,1,null,1,null,1,null,1,null,1,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-03-24T02:33:41Z\",\"WARC-Record-ID\":\"<urn:uuid:33493196-bc6c-4e05-a337-89ebaed4e0fd>\",\"Content-Length\":\"266404\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:b22a1c3b-50e8-436c-8454-b827f0c617a0>\",\"WARC-Concurrent-To\":\"<urn:uuid:4ad56813-0419-4af3-9d9e-83d358b8e1ca>\",\"WARC-IP-Address\":\"34.98.103.221\",\"WARC-Target-URI\":\"https://library.fiveable.me/ap-comp-sci-a/unit-2/mc-answers-review/study-guide/E9AHb7OjFBsLB3tjqtIi\",\"WARC-Payload-Digest\":\"sha1:24GUENWE4ZQ6MNNUJ72GW3KMK2O5A7M5\",\"WARC-Block-Digest\":\"sha1:KESJZSFEHUHCL5PXJRYUDBTP2WZ5RYTC\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-14/CC-MAIN-2023-14_segments_1679296945242.64_warc_CC-MAIN-20230324020038-20230324050038-00501.warc.gz\"}"}