πŸ“š

Β >Β 

πŸ’»Β 

Β >Β 

βž•

1.7 MC Answers and Review

5 min readβ€’june 18, 2024

Dalia Savy

Dalia Savy


AP Computer Science AΒ πŸ’»

130Β resources
See Units

Answers and Review for Multiple Choice Practice on Primitive Types

https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-yqOYWonqC1PO.png?alt=media&token=3ab6c475-322a-401e-a42e-d401487b94a1

Image courtesy of Β Android Authority

β›”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 1. Click here for the practice questions: AP Comp Sci A Unit 1 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 College Board 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 is not an example of hardware?
A. keyboard
B. operating system
C. monitor
D. chips
Answer: Hardware is physical and can be touched.
πŸ“„ Study AP Computer Science A, Unit 1.1: Unit 1 Overview

2. Programs and data are an example of which of the following:
A. CPU
B. hardware
C. ROM
D. software
Answer: This is the definition of software.
πŸ“„ Study AP Computer Science A, Unit 1.1: Unit 1 Overview

3.Β  Which of the following is not an example of a secondary memory device?
A. Tapes
B. writable CD
C. RAM
D. floppy disk
Answer: A secondary memory device is removable and provides long-term storage.

4. Which of the following is not a function of an operating system?
A. provides the user interface with the computer
B. control all machine activity
C. give results for logical expressions
D. manages resources including CPU and memory
Answer: This is the definition of an operating system.
πŸ“„ Study AP Computer Science A, Unit 1.1: Unit 1 Overview

5. Which of the following is not an example of a browser?
A. monitor
B. text
C. executable program
D. graphics
Answer: Browsers include text, graphics, videos, sounds, audio, and executable programs.

6. Which kind of error is found by running the program and observing its behavior?
A. run-time error
B. compile-time error
C. logic error
D. syntax error
Answer: A logic error causes a program to take any action that the programmer did not intend, it can only be found by testing the program.

7. Assume that a and b have been defined and initialized as int values. The expression ! ( ! (a != b) && (b > 7) is equivalent to which of the following?
A. (a == b) || (b <= 7)
B. (a != b) && (b <= 7)
C. (a != b) || (b < 7)
D. (a != b) || (b <= 7)
Answer: ! = not, || = or, && = and
πŸ“„ Study AP Computer Science A, Unit 1.3: Expressions and Assignment Statements

8. Assume that the array has been defined & initialized as follows:
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-KPCMsbg6mhpf.png?alt=media&token=3b3329cf-0156-4e4e-923a-ca4218a0c244
Answer: The answer is B.
πŸ“„ Study AP Computer Science A, Unit 1.4: Compound Assignment Operators

9. Which of the following replacements for /* missing code */ will cause the code segment to print only the values 1 3 5?
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-tHmF6XbzzIge.png?alt=media&token=320ccf98-d728-4b42-874b-ebb90e606894
A. I only
B. I and III only
C. I and II only
D. I, II, and III
Answer: x not equal to 6 will not work, the others will.
πŸ“„ Study AP Computer Science A, Unit 1.5: Casting and Ranges of Variables

10. Assume that x & y are declared and initialized as int values. Consider the following expression below. Which of the following is equivalent to the given expression?
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-Le1BZADvOwnU.png?alt=media&token=ac2e4b41-9ce8-4f0e-8112-23caae15d47b
Answer: The answer is C. ! = not, || = or, && = and
πŸ“„ Study AP Computer Science A, Unit 1.3: Expressions and Assignment Statements

11. Given the following code segment, what are the values of var1 & var2 after the loop finishes?
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-OHUzz8vNHoDK.png?alt=media&token=17f14e8f-8220-4ebc-a6b0-e622d646829f
A. var1=3, var2=-1
B. var1=0, var2=2
C. var1=1, var2=1
D. var1=2, var2=0
Answer: counting loop, increase var1 and decrease var2 until var2=0
πŸ“„ Study AP Computer Science A, Unit 1.5: Casting and Ranges of Variables

12. Given the following code segment, which of the following is this equivalent to?Β 
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-QjcYFaapHEyq.png?alt=media&token=73f6258c-3abc-47d7-8a91-967269241330
A. if (x < 0) x=0; else x=-1
B. if (x > 0) x=-x; else x=0;
C. if (x > 0) x=0;
D. x=0;
Answer: The code segment changes the value to 0 every time.
  • If x equaled 15 initially, the first line would make x equal -15 and the second line would change x to zero because it had been changed by the first line to a negative number.
  • If x equaled 0 initially, none of the if statements would be true so x would remain zero.
  • If x equaled -15 initially, the first line wouldn't be true so it wouldn't run. The second line would see that x is negative so it would change x to zero.
πŸ“„ Study AP Computer Science A, Unit 1.3: Expressions and Assignment Statements

13. Which of the following expressions is equivalent to ! (c || d)
A. (!c) && (!d)
B. (c||d)
C. (c && d)
D. (!c) || (!d)
Answer: This question tests your knowledge of the Modus Tollens rule.
πŸ“„ Study AP Computer Science A, Unit 1.3: Expressions and Assignment Statements

14. Given the following code segment, what are the values of a and b after the loop finishes?Β 
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-XeC7NCvPVMRj.png?alt=media&token=a31bf327-1f47-4a12-bfed-3ab75d056ff9
A. a=0, b=13
B. a=13, b=0
C. a=6, b=7
D. a=6, b=0
Answer: i is a counter loop, and the 3 columns change 6 times
πŸ“„ Study AP Computer Science A, Unit 1.5: Casting and Ranges of Variables

15. What data type should be used to represent the average grade for a course?
A. Boolean
B. int
C. string
D. double
Answer: Double represents a real, or decimal value.

What can we help you do now?
πŸ”Study for Unit 2
🦘Jump to AP Comp Sci A Unit 2 Multiple Choice Questions
🀝Connect with other students studying AP Comp Sci 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.