Ap Computer Science Principles Big Idea 1

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/30

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

31 Terms

1
New cards

Which of the following algorithms display all integers between 1 and 20, inclusive, that are not divisible by 3 ?

Select two answers.

Step 1: Set x to 1. 
Step 2: If x is divisible by 3, then do nothing; otherwise display x.
Step 3: Increment x by 1. 
Step 4: Repeat steps 2 and 3 until x is greater than 20

and

Step 1: Set x to 0. 
Step 2: Increment x by 1. 
Step 3: If x is not divisible by 3, then display x
Step 4: Repeat steps 2 and 3 until x is 20.

2
New cards

Using the following pseudocode, answer the question below.

If a > b then 
   If a > c then
      Print “a is the largest”
   Else
      Print “c is the largest”
   EndIf
Else
   If b > c then
      Print “b is the largest”
   Else
      Print “c is the largest”
   EndIf
EndIf

What will be printed using the following values: a = 15, b = 5, c = 10?

a is the largest

3
New cards

Consider the following pseudocode.

i = 0
sum = 0
REPEAT UNTIL i = 4
   i = 1
   sum++
DISPLAY sum

What is the output?

Nothing - infinite loop.

4
New cards

Using the following pseudocode, answer the question below.

If grade < 60 then 
   Print “Not good!”
Else If grade < 70 then
   Print “Almost there!”
Else If grade < 80 then
   Print “Nice!”
Else If grade < 90 then
   Print “Very Nice!”
Else If grade <= 100 then
   Print “Perfect!”
EndIf

What will be printed if the grade is 85?

Very Nice!

5
New cards

The flowchart symbol for input or output is:

Parallelogram

6
New cards

Check which of the following are examples of computational thinking. Mark all that apply.

Planning what to do with friends on the weekend,  

Shopping for a bicycle, and Baking a cake

7
New cards

In computational thinking, identifying patterns within the parts that can be re-worked within a function is

Pattern recognition

8
New cards

In computational thinking, breaking complex tasks down into smaller simpler tasks is

Decomposition

9
New cards

Working with computational thinking must include all of these except 

Computers

10
New cards

Scenario: Consider operating a car as part of a computer program. Turning the key to start a car is a form of

Abstraction

11
New cards

Check which of the following are examples of computational thinking. Mark all that apply.

 

Choosing a college, RSVP'ing to a friend's party, and Shopping for a car


12
New cards

A student wrote the following code segment, which displays true if the list myList contains any duplicate values and displays false otherwise.

Image of a code segment.

The code segment compares pairs of list elements, setting containsDuplicates to true if any two elements are found to be equal in value. Which of the following best describes the behavior of how pairs of elements are compared?

The code segment iterates through myList, comparing each element to all subsequent elements in the list.

13
New cards

Directions: For the question or incomplete statement below, two of the suggested answers are correct. For this question, you must select both correct choices to earn credit. No partial credit will be earned if only one correct choice is selected. Select the two that are best in each case.

The procedure Smallest is intended to return the least value in the list numbers. The procedure does not work as intended.

Image of a code segment.

For which of the following values of theList will Smallest (theList) NOT return the intended value?

Select two answers.

[40,30,20,10] and [30,40,20,10]

14
New cards

DineOutHelper is a mobile application that people can use to select a restaurant for a group meal. Each user creates a profile with a unique username and a list of food allergies or dietary restrictions. Each user can then build a contact list of other users of the app.

 

A user who is organizing a meal with a group selects all the members of the group from the user's contact list. The application then recommends one or more nearby restaurants based on whether the restaurant can accommodate all of the group members' allergies and dietary restrictions.

Suppose that Alejandra is using DineOutHelper to organize a meal with Brandon and Cynthia.

 

Which of the following data is not provided by Alejandra but is necessary for DineOutHelper to recommend a restaurant for the group?

 

  1. Brandon's contact list

  2. Information about which restaurants Brandon and Cynthia have visited in the past

  3. Information about which food allergies and dietary restrictions can be accommodated at different restaurants near Alejandra

III only

15
New cards

A student is creating an application that allows customers to order food for delivery from a local restaurant. Which of the following is LEAST likely to be an input provided by a customer using the application?

The cost of a food item currently available for order

16
New cards

In the following procedure, assume that the parameter x is an integer.

Image of a code segment.

Which of the following best describes the behavior of the procedure?

It displays true if x is negative and displays nothing otherwise.

17
New cards

In the following procedure, the parameter numList is a list of numbers and the parameters j and k are integers.

Image of a code segment.

Which of the following is the most appropriate documentation to appear with the swapListElements procedure?

Returns a copy of numList with the elements at indices j and k interchanged. The values of j and k must both be between 1 and LENGTH (numList), inclusive.

18
New cards

Which of the following actions are generally helpful in program development?

  1. Consulting potential users of the program to identify their concerns

  2. Writing and testing small code segments before adding them to the program

  3. Collaborating with other individuals when developing a large program

I, II, and III

19
New cards

A homework assignment consists of 10 questions. The assignment is graded as follows.

Grades Table

Number of Correct Answers

Grade

9-10

check plus

7-8

check

Under 7

check minus

Let numCorrect represent the number of correct answers for a particular student. The following code segment is intended to display the appropriate grade based on numCorrect. The code segment does not work as intended in all cases.

Image of a code segment.

For which of the following values of numCorrect does the code segment NOT display the intended grade? Select two answers.

6,8

20
New cards

In a science experiment, result X is expected to occur 25% of the time and result Y is expected to occur the remaining 75% of the time. The following code segment is intended to simulate the experiment if there are 100 trials.

Image of a code segment.

A programmer runs the code segment, and the following message is displayed.

Result X occurred 24 times and result Y occurred 70 times.

The result shows that 94 trials were counted, rather than the intended 100 trials. Which of the following changes to the code segment will ensure a correct simulation of the experiment?

Replacing line 9 with ELSE

21
New cards

RunRoutr is a fitness tracking application for smartphones that creates suggested running routes so that users can run with each other. Upon downloading the application, each user creates a username, a personal profile, and a contact list of friends who also use the application. The application uses the smartphone's GPS unit to track a user's location, running speed, and distance traveled. Users can use the application to review information and statistics about their previous runs.

 

At the beginning of a run, users indicate the distance they want to run from their current location, and the application suggests a running route. Once a user accepts a suggested route, the application shares the suggested route with other compatible users in the area so that they can run together. Users are considered compatible if they are on each other's contact lists or if they typically run at similar speeds.

 

A basic RunRoutr account is free, but it displays advertisements that are targeted to individual users based on data collected by the application. For example, if a user's running route begins or ends near a particular store, the application may display an advertisement for that store. Users have the ability to pay a monthly fee for a premium account, which removes advertisements from the application.

 

Which of the following data must be collected from a user's smartphone in order for RunRoutr to suggest a running route?

The user's geographic position

22
New cards

In the following code segment, score and penalty are initially positive integers. The code segment is intended to reduce the value of score by penalty. However, if doing so would cause score to be negative, score should be assigned the value 0 .

For example, if score is 20 and penalty is 5, the code segment should set score to 15. If score is 20 and penalty is 30 , score should be set to 0 .

The code segment does not work as intended.

Image of a code segment.

Which of the following changes can be made so that the code segment works as intended?

Interchanging lines 3 and 7

23
New cards

The following procedure is intended to return true if the list of numbers myList contains only positive numbers and is intended to return false otherwise. The procedure does not work as intended.

Image of a code segment.

For which of the following contents of myList does the procedure NOT return the intended result?

[-1, 0, 1]

24
New cards

A company that develops educational software wants to assemble a collaborative team of developers from a variety of professional and cultural backgrounds. Which of the following is NOT considered a benefit of assembling such a team?

Collaboration that includes diverse backgrounds and perspectives can eliminate the need for software testing.

25
New cards

In the following procedure, the parameters x and y are integers.

Image of a code segment.

Which of the following is the most appropriate documentation to appear with the calculate procedure?

 

Displays the value of (x+y)/x .

The value of the parameter x must not be 0 .

26
New cards

RunRoutr is a fitness tracking application for smartphones that creates suggested running routes so that users can run with each other. Upon downloading the application, each user creates a username, a personal profile, and a contact list of friends who also use the application. The application uses the smartphone's GPS unit to track a user's location, running speed, and distance traveled. Users can use the application to review information and statistics about their previous runs.

At the beginning of a run, users indicate the distance they want to run from their current location, and the application suggests a running route. Once a user accepts a suggested route, the application shares the suggested route with other compatible users in the area so that they can run together. Users are considered compatible if they are on each other's contact lists or if they typically run at similar speeds.

A basic RunRoutr account is free, but it displays advertisements that are targeted to individual users based on data collected by the application. For example, if a user's running route begins or ends near a particular store, the application may display an advertisement for that store. Users have the ability to pay a monthly fee for a premium account, which removes advertisements from the application.

Adrianna uses RunRoutr to suggest a running route. All compatible users near Adrianna receive a notification that shows her running route. Which of the following data is not obtained using data collected from Adrianna's smartphone but necessary for RunRoutr to share Adrianna's running route?

The current locations of other RunRoutr users

27
New cards

In the following procedure, the parameter max is a positive integer.

PROCEDURE printNums (max)
Image of a code segment.

 

Which of the following is the most appropriate documentation to appear with the printNums procedure?

Prints all positive odd integers that are less than or equal to max.

28
New cards

DineOutHelper is a mobile application that people can use to select a restaurant for a group meal. Each user creates a profile with a unique username and a list of food allergies or dietary restrictions. Each user can then build a contact list of other users of the app.

 

A user who is organizing a meal with a group selects all the members of the group from the user's contact list. The application then recommends one or more nearby restaurants based on whether the restaurant can accommodate all of the group members' allergies and dietary restrictions.

Suppose that Alejandra is using DineOutHelper to organize a meal with Brandon and Cynthia.

 

Which of the following data are needed for DineOutHelper to recommend a restaurant for the group?

 

  1. Each group member's list of food allergies or dietary restrictions

  2. Alejandra's geographic location

  3. The usernames of the people on Brandon and Cynthia's contact lists

I and II only

29
New cards

Directions: The question or incomplete statement below is followed by four suggested answers or completions. Select the one that is best in each case.

Which of the following best describes one of the benefits of using an iterative and incremental process of program development?

It helps programmers identify errors as components are added to a working program.

30
New cards

Consider the following code segment.

Image of a code segment.

Which of the following best describes the behavior of the code segment?

The code segment displays the value of 2(5³ )by initializing result to 2 and then multiplying result by 5 a total of three times.

31
New cards

Three students in different locations are collaborating on the development of an application. Which of the following strategies is LEAST likely to facilitate collaboration among the students?

Having all three students write code independently and then having one student combine the code into a program.