Accounting /Project Stem / Edhesive CSP - Unit 2 Flashcards

Project Stem / Edhesive CSP - Unit 2 Flashcards

Accounting20 CardsCreated 3 months ago

This deck contains 20 flashcards covering key concepts from Unit 2 of the Project Stem / Edhesive CSP course. Topics include pseudocode, Boolean operators, algorithms, and more.

What would be the final value of the variable third once the following program is complete?
first ← 2
second ← 3
third ← first second
second ← third - first
first ← first + second + third
third ← second
first

48

Tap or swipe ↕ to flip
Swipe ←→Navigate
SSpeak
FFocus
1/20

Key Terms

Term
Definition

What would be the final value of the variable third once the following program is complete?
first ← 2
second ← 3
third ← first second
second ← third - first
first ← first + second + third
third ← second
first

48

Consider the block of code below:

I'm too lazy to type it but yk

What would be the most appropriate substitute for the missing Boolean Operator if the intention is to display "True" for only values of x between, but not equal to values of 0 and 10?

AND

Which of the following CollegeBoard AP Computer Science Principles Pseudocode commands is used to record something typed by a user of the program so that it can be used in the program?

INPUT ()

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

Group 2

The volume of a rectangular prism is calculated by multiplying its length (l), width (w) and height (h). What could be substituted into the section of the code below marked < missing code > that would accurately calculate the volume based on the user input of l, w and h?

l w h

Moore's Law describes the rate at which the number of transistors on a single chip doubles over time. Which of the following assumptions CANNOT be inferred as a direct consequence of this rate of doubling?

Five years from now, web pages will require less memory (RAM) than today's web pages.

Related Flashcard Decks

Study Tips

  • Press F to enter focus mode for distraction-free studying
  • Review cards regularly to improve retention
  • Try to recall the answer before flipping the card
  • Share this deck with friends to study together
TermDefinition

What would be the final value of the variable third once the following program is complete?
first ← 2
second ← 3
third ← first second
second ← third - first
first ← first + second + third
third ← second
first

48

Consider the block of code below:

I'm too lazy to type it but yk

What would be the most appropriate substitute for the missing Boolean Operator if the intention is to display "True" for only values of x between, but not equal to values of 0 and 10?

AND

Which of the following CollegeBoard AP Computer Science Principles Pseudocode commands is used to record something typed by a user of the program so that it can be used in the program?

INPUT ()

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

Group 2

The volume of a rectangular prism is calculated by multiplying its length (l), width (w) and height (h). What could be substituted into the section of the code below marked < missing code > that would accurately calculate the volume based on the user input of l, w and h?

l w h

Moore's Law describes the rate at which the number of transistors on a single chip doubles over time. Which of the following assumptions CANNOT be inferred as a direct consequence of this rate of doubling?

Five years from now, web pages will require less memory (RAM) than today's web pages.

Consider the following code segment that allows a customer to request their preferred beverage and size of beverage (ounces).

What is displayed if the user enters "16" and then "coffee" when the program runs?

Short coffee

Consider the following code segment:

If the variables onTime and absent both have the value false, what is displayed as a result of running the code segment?

Better late than never.

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 following is invoked:

What is displayed if the elevator is currently on the 7th floor (level = 7) and the person on the elevator presses a button labeled "up 3 floors" which causes the variable floors to be set to 3. What will be displayed when the code above runs?

Level 8 Level 9 Cannot go up. Level 9

A particular problem is currently not able to be practically solved by using an algorithm. Which of the following statements about the problem could possibly be true?
No algorithm has yet been developed which would solve this problem, but it is possible one may be developed in the future.
An algorithm has been developed which would solve this problem but technology is not yet available which would compute this algorithm fast enough to be practicable.
It is impossible to develop an algorithm which would solve this problem.

I, II, and III

Consider the following code segment:

Which of the following best describes the result of running the code segment?

Nothing is displayed; the program results in an infinite loop.

Consider the following code segment:

What values, when inputted by the user, of A, B, and C will cause the code to display "Invalid Input"?

A = -5, B = 0, C = 0

The following question uses a robot and a grid of squares. The robot is represented as a triangle, which is initially in the bottom left square of the grid and facing right.

Consider the following code segment, which moves the robot on the grid:

Which of the following shows the location of the robot after running the code segment?

In the middle facing down

Consider the code below.

Which of the following best describes the conditions which must be satisfied by the user-inputted values of x and y if the program is to display Right Right when run?

x must be 0 and y must be a positive number

In the program below, x is an integer between 5 and 10 inclusive.

What is the maximum possible value of answer after running the program?

20

Frankie is considering whether to use a binary or linear search in her program to find a value in a sorted list. When she tests the algorithms on selection of short lists of fixed-length lists she finds that the binary search is faster on average than the linear search. Another programmer suggests she tests both algorithms on a selection of lists which are 10 times as long as her original test lists. Which of the following best describes the likely results of this test?

The binary search will still be faster on average than the linear search, and the difference in run times between the two searches will be significantly more than 10 times greater than for the shorter lists.

Sally notices that she has the same set of 10 blocks in her code in multiple places. She decides to create a new block (procedure) in Scratch so that she can simply replace those 10 blocks with one procedure. Which of the following gives the best ways in which this could be beneficial to Sally when she debugs and reasons through her program? Select two answers.

If there is an error in the procedure, she can fix the error in the procedure without having to search through her code for each place the procedure is used.

The procedure can make the code section more abstract, so she doesn't have to think through all 10 blocks each time she comes across them in her code.

The incomplete code displayed below is for a simple "Guess the Number" game in which the user inputs values and is displayed statements about the relationship of their input to a randomly chosen secret number until they correctly input that number.

The condition for the first IF block in the code is missing. Based on the intended purpose of the code, which of the following blocks would be most appropriate as the missing condition?

secret number < guess

Consider the following block of code:

Which two of the following values are more likely to be displayed than the other two values listed when the this block of code is run?
Select two answers.

12

14

Which of the following algorithms require both selection and iteration?
Select two answers:

An algorithm that, given a list of integers, displays the number of even integers in the list.

An algorithm that, given a list of integers, displays the number of even integers in the list.