Search Header Logo
3rd prep lOOPING

3rd prep lOOPING

Assessment

Presentation

Computers

9th Grade

Practice Problem

Hard

Created by

Rabab Saudi

FREE Resource

3 Slides • 8 Questions

1

media

Loops

In the previous chapter, we have learned how
to execute a specific code, based on a
conditional expression.
In this chapter, you will learn how to repeat a
certain code for a number of times (which is
called Loops) using :
(For... Next) and (Do While... loop).

2

media

Comparison between Looping Statements

For …Next Statement

Do …. While Statement

It is one of the limited loop statements
used when we want to repeat a code for
specific number of time . It needs
numeric variable (integer or decimal) to
work as a counter with start value , end
value and add or increment value .

The statement 'Do while ... loop' is used
to repeat a specific code for a several
times of an unknown end, but based on a
specific condition, so they are useful if
you do not know the number of iterations
emphatically.

The repetitive code will be implemented
(executed) as long as the counter variable
is less than or equal the end value .The
loop stops when the value of the counter
exceeds the last value.

The repetitive code will be implemented
(executed) as long as the conditional
expression is true. If the condition is not
met for any reason, we get out of the
iterative loop, and implement the code
after the Loop if it exists.

General syntax for this statement

For Variable = Start To

End Step Add

Value
Repetitive Code
Next [Variable]

General syntax for this statement

Do While Conditional Expression
Repetitive Code
Loop

3

Multiple Choice

   In ( For ..next ) looping statement  the keyword step is a must.

1

True

2

False

4

Multiple Choice

  To display the Odd Numbers arranged descending from 15 to 5  we write the codes

1

For M = 15  to  5 step - 2

2

For M = 15  to  5  step 2

3

For M = 15  to  5

5

Multiple Choice

In case the value of keyword Step in (For .. Next) loop takes zero, the loop will repeated infinite number of repetition and never stops.      

1

True

2

False

6

Multiple Choice

Dim j As Integer

   Label1.Text = ""

   j = 2

   Do While j <= 10

   Me.Label1.Text = Label1.Text & vbCrLf & j

   j = j + 2

   Loop

The purpose of this Loop is to print ............................... from 2 to 10

1

Odd Numbers

2

Even Numbers

3

All Numbers

7

media

8

Multiple Choice

In the code :(ListBox1. Items. Add( m)) , Add is ………………..

1

Control

2

Property

3

Method

9

Multiple Choice

  In case we don`t write the keyword Step in (For .. Next) loop it will take the initial value zero.  

1

True

2

False

10

Multiple Choice

We use ---------------------- loop statement when we don`t know the number of repetition in advance.

1

If.......Then ....... Else

2

For.......Next

3

Do......While

11

Multiple Choice

Dim N , Sum    as  Integer

For   N = 1  to  100

Sum= Sum +  N

Next

Label1.Text = Sum

The Result of this Code is .........................

1

Displaying the numbers from 1 to 100

2

Displaying the sum of the numbers from 1 to 100.

3

Displaying the Product of the numbers from 1 to 100.

media

Loops

In the previous chapter, we have learned how
to execute a specific code, based on a
conditional expression.
In this chapter, you will learn how to repeat a
certain code for a number of times (which is
called Loops) using :
(For... Next) and (Do While... loop).

Show answer

Auto Play

Slide 1 / 11

SLIDE