| preferred AP College board partner for AP classes
easy Solved by 6 students
Array Processing Function Analysis
< Prev
Next >

Consider the following code segment:

function processData(data)
{
 let result = [];
 for (let i = 0; i < data.length; i++)
 {
 if (data[i] > 0)
 {
 result.push(data[i] * 2);
 }
 }
 return result;
}

What is the function of this code segment?

A

Removes negative values from the original array

B

Doubles all values in the original array

C

Counts the number of positive values in the array

D

Creates a new array with positive values doubled

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1soniahalepota200511 0m 10s 90
#2tianbo.shen11 0m 20s 80
#3my.emma.mei11 0m 47s 53
#4devanshs90512 0m 43s 47
#5proundpimfhao01 0m 00s -10
#6Sushantpr.250601 0m 07s -17
#7spiritgen0201 0m 15s -25
#8batonoltanr01 0m 55s -65
Items per page:
10
1 – 8 of 8
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: [email protected]|Privacy Policy