Instructions

  • 1. Your final score will reflect your grasp of the concepts—approach each question with precision.
  • 2. Thoroughly review each solution before proceeding to ensure full understanding.
  • 3. Final results will be available after submission to provide insights into areas for further improvement.
  • 4. Maintain academic integrity—plagiarism undermines learning and professional growth.
  • 5. Once submitted, responses are final, so ensure you’re confident in your answers.
  • 6. These challenges are designed to test practical knowledge; apply your skills as you would in real-world scenarios.

All Problems

Question

Action

What is the correct syntax for a for loop in JavaScript?

View

What is the output of the following code?

View

What does the i++ do in the for loop?

View

How many times will the following loop run?

View

What is the value of i after the following loop?

View

Which of the following is true about a for loop?

View

How can you stop a for loop from continuing?

View

What will be the output of the following code?

View

What is an infinite loop?

View

What will the following code do?

View

What is the correct syntax for a for loop in JavaScript?

for i in 10
for (i = 0; i < 10; i++)
for (i < 10; i++)
for (i = 0, i < 10, i++)

What is the output of the following code?

for (let i = 0; i < 3; i++) { console.log(i); }

0 1
1 2 3
0 1 2
1 2

What does the i++ do in the for loop?

It decreases i by 1
It multiplies i by 2
It increases i by 1
It leaves i unchanged

How many times will the following loop run?

for (let i = 0; i <= 5; i++) { console.log(i); }

4
5
6
7

What is the value of i after the following loop?

for (let i = 0; i < 5; i++) { console.log(i); }

4
5
6
Undefined

Which of the following is true about a for loop?

It must always start from 0
It requires an initializer, condition, and increment expression
It cannot run in reverse
It always increments by 1

How can you stop a for loop from continuing?

continue
break
exit
stop

What will be the output of the following code?

for (let i = 0; i < 5; i++) { if (i === 3) break; console.log(i); }

0 1 2
0 1 2 3
1 2 3
0 1 2 3 4

What is an infinite loop?

A loop that runs without stopping due to incorrect conditions
A loop that runs exactly 10 times
A loop that runs when there are syntax errors
A loop that skips iterations based on a condition

What will the following code do?

for (;;) { console.log("Hello"); }

Outputs "Hello" 5 times
Outputs "Hello" 10 times
Infinite loop printing "Hello"
Throws an error