AP CSP Unit 7: Parameters, Returns, and Libraries

AP CSP Unit 7: Parameters, Returns, and Libraries

Assessment

Flashcard

Computers

9th - 12th Grade

Hard

Created by

Quizizz Content

FREE Resource

Student preview

quiz-placeholder

13 questions

Show all answers

1.

FLASHCARD QUESTION

Front

Which code segment results in "true" being returned if a number is even? Replace "MISSING CONDITION" with the correct code segment.
function isEven(num){
if(MISSING CONDITION){
return true;
} else {
return false;
}
}

Back

num % 2 == 0;

2.

FLASHCARD QUESTION

Front

Which function calls would provide the most helpful test of this function? Remember: With tests, you are attempting to figure out all the possible ways the function could be broken. function findMin(num1, num2){ if(num1 < num2){ return num1; } else { return num2; }}

Back

findMin(-1,1), findMin(1,-1), findMin(1,1)

3.

FLASHCARD QUESTION

Front

listAverage() returns the average number in a list. Which of these functions does this correctly?

Back

Media Image

4.

FLASHCARD QUESTION

Front

Which of the following is NOT true about procedural abstraction?
Procedural abstraction improves code readability,
Procedural abstraction manages complexity by allowing for code reuse,
Procedural abstraction improves the speed at which a program executes,
Procedural abstraction allows a solution to a large problem to be based on the solution of smaller subproblems.

Back

Procedural abstraction improves the speed at which a program executes

5.

FLASHCARD QUESTION

Front

This function finds the minimum number in a list. What should <MISSING CODE SEGMENT> be replaced with in order for this function to operate as expected?
function min(numList){
var min = numList[0];
for(var i=0; i<numList.length; i++){
if(numList[i] < min){
<MISSING CODE SEGMENT>
}
}
return min;
}

Back

min = numList[i];

6.

FLASHCARD QUESTION

Front

Using existing algorithms as building blocks for new algorithms has all the following benefits EXCEPT: reduces development time, reduces testing, simplifies debugging, removes procedural abstraction

Back

removes procedural abstraction

7.

FLASHCARD QUESTION

Front

What is one of the benefits of using a library in a program?

Back

simplifies creating a complex program

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?