AP Computer Science Principles Unit 2 Review Open

AP Computer Science Principles Unit 2 Review Open

Assessment

Quiz

Computers

9th - 12th Grade

Hard

Created by

Myra Deister

Used 68+ times

FREE Resource

Student preview

quiz-placeholder

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Consider the above code segment that is designed to print all numbers from a list of integer values, called grades, that are between 90 and 100, inclusive.


Which of the following modifications can be made to the code to allow it to also print numbers from a variety of different ranges of values (e.g., 70 to 80, 85 to 95, 1 to 50, etc.)?

userPassword = "swordfish"

"swordfish"

userPassword != "swordfish"

userPassword ← INPUT

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

A large office building has an elevator that carries occupants between any of the building's 10 floors. The basement is referred to as "Level 0" while the topmost floor is "Level 9." The software for the elevator uses a variable, called level, to track the floor number of the elevator's current position. When a person presses a button requesting the elevator to rise to a higher floor, the above code is executed.


What is displayed if the elevator is currently on the 7th floor (level = 7) and the person on the elevator presses a button that says to go up 3 floors (floors = 3)?

Level 7 Level 8 Level 9

Level 8 Level 9 Cannot go up. Level 9

Level 8 Level 9 Level 10

Cannot go up.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Consider the above code segments designed to find the area of a triangle (A = 1/2 bh).


Which of the following statements about the above programs is true?

Both programs will work as intended, but Program B is more readable.

Program A will work as intended, but Program B will not work as intended.

Program B will work as intended, but Program A will not work as intended.

Neither program will work as intended.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Given the above code segment, what would be displayed if age were initialized with a value of 18?

group 1

group 2

group 1 group 2

Nothing will be displayed

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following would be the most appropriate name for a variable?

variable1

t

amountOfTimeRemainingInTheGame

time_left

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

While developing a program, you find a similar project that someone has created and posted online. It contains a number of elements (e.g., images, music, code segments, etc.) that you would like to integrate into your own project. Under what conditions may you reuse these elements in your work?

You may never reuse someone else’s work.

You may reuse any elements that are posted publicly online as long as credit is given to their creator.

You may only reuse elements for which the original owner has granted a license to reuse, such as the Creative Commons Share Alike license.

You may always reuse anything that is posted publicly or privately online.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Consider the above code.


Assuming that before this code is run, x = 1. What would be displayed at the end?

210

16

8

1

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?