Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 7 pages
Exam (elaborations)

CodeHS - Module 7: Basic Data Structures || 100% ACCURATE Q&A!!

Document preview thumbnail
Preview 2 out of 7 pages

7.1.4 List of Places to Travel correct answers function start(){ var travelList = ["England" , "Greenland" , "India" , "Pakistan"]; println(travelList[2]); } 7.1.5 List of Prime Numbers correct answers function start(){ var numList = ["2" , "3" , "5" , "7" , "11"]; println(numList[0]); println(numList[2]); println(numList[4]); } 7.2.4 Top Movies correct answers function start(){ var moviesList = ["Easy A" , "Mean Girls" , "Interstellar" , "She's The Man"]; println(moviesList[0]); moviesList[0] = "Star Wars"; println(moviesList[0]); } 7.3.4 Empty Array (Push/Pop) correct answers function start(){ var arr = []; (3); ("hello"); (false); println(arr[0]); println(arr[1]); println(arr[2]); var last = (); var last2 = (); println(arr[0]); println(arr[1]); println(arr[2]); } 7.4.7 Product of List correct answers function start(){ var arr = [1, 8, 3, 4, 2, 9]; var product = 1; for(var i = 0; i h; i++){ var cur = arr[i]; product *= cur; } println(product); } 7.4.8 Print Flight Itinerary correct answers function start(){ var arr = ["Paris" , "Dallas" , "Austin" , "Anchorage" , "New York"];

Content preview

CodeHS - Module 7: Basic Data Structures || 100%
ACCURATE Q&A!!
7.1.4 List of Places to Travel correct answers function start(){
var travelList = ["England" , "Greenland" , "India" , "Pakistan"];
println(travelList[2]);
}

7.1.5 List of Prime Numbers correct answers function start(){
var numList = ["2" , "3" , "5" , "7" , "11"];
println(numList[0]);
println(numList[2]);
println(numList[4]);
}

7.2.4 Top Movies correct answers function start(){
var moviesList = ["Easy A" , "Mean Girls" , "Interstellar" , "She's The Man"];
println(moviesList[0]);
moviesList[0] = "Star Wars";
println(moviesList[0]);
}

7.3.4 Empty Array (Push/Pop) correct answers function start(){
var arr = [];
arr.push(3);
arr.push("hello");
arr.push(false);
println(arr[0]);
println(arr[1]);
println(arr[2]);
var last = arr.pop();
var last2 = arr.pop();
println(arr[0]);
println(arr[1]);
println(arr[2]);
}

7.4.7 Product of List correct answers function start(){
var arr = [1, 8, 3, 4, 2, 9];
var product = 1;
for(var i = 0; i < arr.length; i++){
var cur = arr[i];
product *= cur;
}
println(product);
}

7.4.8 Print Flight Itinerary correct answers function start(){
var arr = ["Paris" , "Dallas" , "Austin" , "Anchorage" , "New York"];

, for(var i = 0; i < arr.length; i++){
var cur = arr[i];
print(cur);
if(i < arr.length - 1){
print("->");
}
}
}

7.4.9 Double List correct answers function start(){
var arr = [10, 20, 30, 40];
var double = doubleList(arr);
println(double);
}
function doubleList(arr){
var result = [];
for(var i = 0; i < arr.length; i++){
result.push(arr[i]);
result.push(arr[i]);
}
return(result);
}

7.4.10 Evens Only List correct answers function start(){
var arr = [1, 2, 3, 4, 5, 6];
var evens = onlyEvens(arr);
println(evens);
}
function onlyEvens(arr){
var result = [];
for(var i = 0; i < arr.length; i++){
var cur = arr[i];
if(cur % 2 == 0){
result.push(arr[i]);
}
}
return(result);
}

7.4.11 In a World Without Arrays! correct answers function start(){

var num1 = 15;
oddOrEven(num1);
var num2 = 32;
oddOrEven(num2);
var num3 = 19;
oddOrEven(num3);
var num4 = 11;
oddOrEven(num4);
var num5 = 28;

Document information

Uploaded on
May 19, 2025
Number of pages
7
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$12.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

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.
ProPerfomer
3.8
(84)
Sold
443
Followers
322
Items
8859
Last sold
2 months ago




Why students choose Stuvia

Created by fellow students, verified by reviews

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

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight 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 smashed it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions