JavaScript Question 16 (1 point) How many times will the while loop that follows
ID: 3910734 • Letter: J
Question
JavaScript
Question 16 (1 point)
How many times will the while loop that follows be executed?
var months = 5;
var i = 1;
while (i < months) {
futureValue = futureValue * (1 + monthlyInterestRate);
i = i+1;
}
Question 16 options:
0
4
5
6
Save
Question 17 (1 point)
The type of loop that provides for varying the value of an index (or counter) is a
Question 17 options:
while loop
for loop
do-while loop
all of the above
Save
Question 18 (1 point)
What will futureValue contain after the for loop has been executed one time?
var years = 10;
var annualRate = 10;
var futureValue = 1000;
annualRate = annualRate / 100;
for ( i = 1; i <= years; i++ ) {
futureValue += futureValue * annualRate;
}
Question 18 options:
1000
1100
11000
1010
Save
Question 19 (1 point)
What is displayed in the alert dialog box after the following code is executed?
var items = 3;
for (var i = 1; i <= items; i++) {
var result = 1;
for (var j = i; j >= 1; j--) {
result *= j;
}
alert("The factorial of " + i + " = " + result);
}
Question 19 options:
The factorial of 1 = 1
The factorial of 2 = 4
The factorial of 3 = 6
The factorial of 4 = 24
Save
Question 20 (1 point)
What is the value of scores[3] after the following code is executed?
var scores = [70, 20, 35, 15];
scores[3] = scores[0] + scores[2];
Question 20 options:
15
105
2
120
Save
Question 21 (1 point)
What is displayed in the alert dialog box after the following code is executed?
var scores = [70, 20, 35, 15];
scores[scores.length] = 40;
alert("The scores array: " + scores);
Question 21 options:
The scores array: 70,20,35,15,40
The scores array: 40
The scores array: 70 20 35 40
The scores array:
0
4
5
6
Explanation / Answer
Question 16
Ans)4
___________
Question 17
Ans)all of the above
___________
Question 18
Ans)1100
___________
Question 19
Ans)The factorial of 1 = 1
___________
Question 20
Ans)105
___________
Question 21
Ans)The scores array: 70,20,35,15,40
___________
________Thank You
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.