Search Header Logo

For/While Loops

Authored by Techie Potato

Computers

Used 1+ times

For/While Loops
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

6 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

You need a program that will keep letting you add money to a piggy bank until you get to $10,000. Which kind of loop should be used?

FOR Loop

WHILE Loop

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

You want to print the numbers from 1 to 10 in ascending order. Which loop should be used?

For Loop

While Loop

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

You want to keep asking the user for their name until they enter a valid name that is not empty or contains only spaces. Which loop should be used?

For Loop

While Loop

4.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

  • You want to calculate the factorial of a given number n, which is the product of all positive integers less than or equal to n. For example, the factorial of 5 is 5 x 4 x 3 x 2 x 1 = 120. Which loop would you use?

For Loop

While Loop

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

You want to find the smallest positive integer that is divisible by both 7 and 13. Which loop should be used?

For Loop

While Loop

6.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Media Image

Look at the following code snippet, what will it generate?

Media Image
Media Image
Media Image

1,2,3,4

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?