# Xits320 mod 4 mastery ex attempt 1

Content type
User Generated
Rating
Showing Page:
1/6
Score for this attempt: 10 out of 10
Submitted Feb 12 at 11:16am
This attempt took 22 minutes.
Question 1
1 / 1 pts
The second line printed out from the following code snippet will be ________.
fruits = [‘banana’,’apple’,’mango’]
for index in range(len(fruits)):
print ‘Current fruit :’, fruits[index]
Current fruit: banana
Current fruit: apple
Current fruit: mango
The larch!
Correct! The for loop iterates through each element in the list.
Question 2
1 / 1 pts
Consider the following code snippet:
count = 0
while count print count, “ is less than 5”
count = count + 1
else:
print count, “is not less than 5.”
The last line to be printed will be _________:
2 is less than 5
3 is less than 5

Showing Page:
2/6
4 is less than 5
5 is not less than 5
Correct! The else block will execute following the last iteration step of the while loop.
Question 3
1 / 1 pts
The sequence of numbers generated by range(5,0,-2) will be _________:
-2,-1,0,1,2,3,4
0,1,2,3,4
5,3,1
5,3,1,-1
Correct! The range functions process all whole numbers starting at 5, decrementing by
2 down to 1.
Question 4
1 / 1 pts
A break statement in a nested while loop _________:
exits the inner most loop
exits the outer most loop
skips to the next statement

Showing Page:
3/6

End of Preview - Want to read all 6 pages?
Access Now
Unformatted Attachment Preview
Score for this attempt: 10 out of 10 Submitted Feb 12 at 11:16am This attempt took 22 minutes. Question 1 1 / 1 pts The second line printed out from the following code snippet will be ________. fruits = [‘banana’,’apple’,’mango’] for index in range(len(fruits)): print ‘Current fruit :’, fruits[index] Current fruit: banana Current fruit: apple Current fruit: mango The larch! Correct! The for loop iterates through each element in the list. Question 2 1 / 1 pts Consider the following code snippet: count = 0 while count print count, “ is less than 5” count = count + 1 else: print count, “is not less than 5.” The last line to be printed will be _________: 2 is less than 5 3 is less than 5 4 is less than 5 5 is not less than 5 Correct! The else block will execute following the last iteration step of the while loop. Question 3 1 / 1 pts The sequence of numbers generated by range(5,0,-2) will be _________: -2,-1,0,1,2,3,4 0,1,2,3,4 5,3,1 5,3,1,-1 Correct! The range functions process all whole numbers starting at 5, decrementing by 2 down to 1. Question 4 1 / 1 pts A break statement in a nested while loop _________: exits the inner most loop exits the outer most loop skips to the next statement causes a program error Correct! A break ends the processing of the loop it is in. Question 5 1 / 1 pts The second to last statement printed by the following code snippet will be ________. letter1 = 'a' letter2 = '?' while letter1 letter2 = 'a' while le ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

### Review

Anonymous
This is great! Exactly what I wanted.

Studypool
4.7
Indeed
4.5
Sitejabber
4.4