100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

CSP Unit 7 Parameters, Return, and Libraries Assessment Exam Questions With Revised Answers

Rating
-
Sold
-
Pages
6
Grade
A+
Uploaded on
04-09-2024
Written in
2024/2025

©THEBRIGHTSTARS 2024 CSP Unit 7 Parameters, Return, and Libraries Assessment Exam Questions With Revised Answers 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; } } - answernum % 2 == 0; Here is the API for a robot library. // moves the robot forward function moveForward(); // turns the robot to the left function rotateLeft(); // turns the robot to the right function rotateRight()

Show more Read less
Institution
CSP
Course
CSP









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
CSP
Course
CSP

Document information

Uploaded on
September 4, 2024
Number of pages
6
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

©THEBRIGHTSTARS 2024



CSP Unit 7 Parameters, Return, and
Libraries Assessment Exam Questions With
Revised Answers


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;
}

} - answer✔✔num % 2 == 0;
Here is the API for a robot library.


// moves the robot forward
function moveForward();


// turns the robot to the left
function rotateLeft();


// turns the robot to the right
function rotateRight();

, ©THEBRIGHTSTARS 2024



// checks if a robot can move in any direction
// direction {string} - the direction to be checked
// return {Boolean} - true if the robot can move in that direction, otherwise returns false
function canMove(direction);


Which code segment will guarantee that the robot makes it to the gray square without hitting a
wall or a barrier (black square)? - answer✔✔function solveMaze(){
moveForward();
moveForward();
rotateRight();
while(canMove("forward")){
moveForward();
}
rotateLeft();
moveForward();
}
What will be printed to the console after this program runs?


var numbers = [2, 5, 3, 1, 6]


function changeNums(numList, addNum, subtractNum){
for(var i=0; i<numList.length; i++){
if(numList[i] % 3 == 0){
numList[i] = numList[i] + addNum;
} else {
numList[i] = numList[i] - subtractNum;

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Brightstars Havard School
View profile
Follow You need to be logged in order to follow users or courses
Sold
188
Member since
1 year
Number of followers
7
Documents
11829
Last sold
2 days ago
VERIFIED EXAMS AND STUDY GUIDES.

Here, you will find Study Notes, Exam answer packs 100% Guarenteed success.

3.4

30 reviews

5
10
4
4
3
8
2
3
1
5

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions