Project Stem / Edhesive CSP - Unit 2 Flashcards
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
Key Terms
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
Term | Definition |
---|---|
What would be the final value of the variable third once the following program is complete? | 48 |
Consider the block of code below: | 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). | Short coffee |
Consider the following 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: | 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? | I, II, and III |
Consider the following code segment: | Nothing is displayed; the program results in an infinite loop. |
Consider the following code segment: | 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. | In the middle facing down |
Consider the code below. | x must be 0 and y must be a positive number |
In the program below, x is an integer between 5 and 10 inclusive. | 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 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. | secret number < guess |
Consider the following block of code: | 12 |
Which of the following algorithms require both selection and iteration? | An algorithm that, given a list of integers, displays the number of even integers in the list. |