• Verkeerd document? Gratis ruilen
  • Geschreven door studenten die geslaagd zijn
  • Direct beschikbaar na je betaling
  • Online lezen of als PDF
Verkopen
Kies je studieland
Kies je taal
Document preview thumbnail
Voorbeeld 1 van de 2 pagina's
Tentamen (uitwerkingen)

Cmpsc 101 Midterm 2 Correct 100%

Document preview thumbnail
Voorbeeld 1 van de 2 pagina's

The Range(1,10,3) produces the values A. 1,4,7,10 B. 1,4,7 C. 1,3,5,7,9 D. 1,10,3 - ANSWERB. 1,4,7 How many asterisks would be printed by these two code fragments? A. 12 in both cases B. 6 in both cases C. 12 in the one on the left; 6 in the one of the right D. 6 in the one on the left; 4 in the one on the right - ANSWERC. 12 in the one on the left; 6 in the one of the right If is_prime is a function that identifies whether its argument was prime, what would this short function return? A. The value 2 only B. The value 7 only C. All of the small primes in a list: [2,3,5,7] D. One small prime, and a different one each time it is called. - ANSWERA. The value 2 only I wish to catch invalid input values outside the range of 1 to 5, inclusive. The test to identify a bad input would be: A. value 1 and value 5 B. value 1 or value 5 C. 1 value 5

Voorbeeld van de inhoud

CMPSC 101 MIDTERM 2 CORRECT
100%
The Range(1,10,3) produces the values

A. 1,4,7,10
B. 1,4,7
C. 1,3,5,7,9
D. 1,10,3 - ANSWERB. 1,4,7

How many asterisks would be printed by these two code fragments?

A. 12 in both cases
B. 6 in both cases
C. 12 in the one on the left; 6 in the one of the right
D. 6 in the one on the left; 4 in the one on the right - ANSWERC. 12 in the one on
the left; 6 in the one of the right

If is_prime is a function that identifies whether its argument was prime, what would
this short function return?

A. The value 2 only
B. The value 7 only
C. All of the small primes in a list: [2,3,5,7]
D. One small prime, and a different one each time it is called. - ANSWERA. The
value 2 only


I wish to catch invalid input values outside the range of 1 to 5, inclusive. The test to
identify a bad input would be:

A. value < 1 and value > 5
B. value < 1 or value > 5
C. 1 > value > 5
D. value < 1 and > 5 - ANSWERB. value < 1 or value > 5

A series of inputs will arrive at the keyboard, ending with an empty line. Assuming all
of these inputs are whole numbers, compute their sum. - ANSWERtotal = 0
line = input()
while line != '':
total = total + int(total)
line = input()

Given a list of integers in nums display the first value greater than 60 and its position
in that list. - ANSWERposition = 0
while nums[position] <= 60:
position = position + 1

Documentinformatie

Geüpload op
26 februari 2025
Aantal pagina's
2
Geschreven in
2024/2025
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden
$13.99

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
papersbyjol
3.8
(79)
Verkocht
454
Volgers
254
Items
14152
Laatst verkocht
1 week geleden




Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen