• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 5 pages
Exam (elaborations)

WGU D278 SECTION 4 TEST LATEST UPDATED

Document preview thumbnail
Preview 2 out of 5 pages

WGU D278 SECTION 4 TEST LATEST UPDATED...

Content preview

WGU D278 SECTION 4 TEST LATEST UPDATED




loop
a language construct that re-executes a series of instructions, the so-called loop
body, as long as the controlling expression evaluates to true; then execution
continues with the next instruction after the loop.


iteration


true; execution continues past loop when false;


Common Looping Error
is to use the opposite loop expression than intended such as using x == 0 instead
of x!= 0. Programmers should pay extra attention to the fact that the expression
states when the loop is to iterate, not when it is to stop.


infinite loop
is a loop that never ends. A very common error is to accidentally create an
infinite loop, either by forgetting to change a variable in the body, or by writing
a loop expression whose evaluation to false isn't always reachable.


sentinel value
a special value that marks the end of a list, such as a list of positive integers
terminated with 0, as in 10 1 6 3 0.

, while loop
is a loop which, while the loop's expression evaluates to true, repeatedly
executes the loop body


for loop
a loop of the form that includes a loop variable initialization, a loop expression,
and a loop variable update, and which typically describes iteration to be
performed a certain number of times.


for
Number of iterations is calculable prior to the loop, such as iterate N times.


while
Number of iterations is not easily computable before the loop, for example
iterate until input is 'q'.


Nested Loop
A loop that appears inside the body of another. The inner and outer loops are
common names given to the nested loops.


While Loop
A while loop will continue to execute a loop body provided the expression
associated with the while evaluate to True.
while code
In syntax, the while loop contains the keyword "while" followed by the
expression.
Statements of the body of the loop begin on the next line and are indented.

Document information

Uploaded on
February 8, 2025
Number of pages
5
Written in
2024/2025
Type
Exam (elaborations)
Contains
Unknown
$11.59

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
luzlinkuz
3.8
(330)
Sold
1607
Followers
852
Items
32480
Last sold
1 day ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions