100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4.2 TrustPilot
logo-home
Tentamen (uitwerkingen)

CMPSC 101 MIDTERM EXAM 1 QUESTIONS & ANSWERS(RATED A+)

Beoordeling
-
Verkocht
-
Pagina's
5
Cijfer
A+
Geüpload op
26-02-2025
Geschreven in
2024/2025

What command should you type in the interpreter to check your Python installation? - ANSWERpython What do you call a saved file containing Python instructions? - ANSWERA module How can you write the expression "n = n * 2" using short-hand operators? - ANSWERn *= 2 Which string function do you call when you want to convert the first letter in the string to uppercase? - ANSWERalize() Which function do you call to check the number of items in a list? - ANSWERlen() Which operator is used to concatenate two lists? - ANSWER+ (plus) Which function do you call when you want to append an element at the end of a list? - ANSWERd() What is the name of the output you get when an error occurs in your program? - ANSWERStack trace or traceback What is the output of running the following script? >>> print(5*4) - ANSWER20 What are variables? - ANSWERThey refer to values in a memory Which function can be used to convert strings to integers? - ANSWERint() What is the syntax for assigning a variable, x, to the value 8? - ANSWERx = 8 What type of value is returned by the input function? - ANSWERString

Meer zien Lees minder
Instelling
CMPSC 101
Vak
CMPSC 101









Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Instelling
CMPSC 101
Vak
CMPSC 101

Documentinformatie

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

Onderwerpen

Voorbeeld van de inhoud

CMPSC 101 MIDTERM EXAM 1
QUESTIONS & ANSWERS(RATED A+)
What command should you type in the interpreter to check your Python installation?
- ANSWERpython

What do you call a saved file containing Python instructions? - ANSWERA module

How can you write the expression "n = n * 2" using short-hand operators? -
ANSWERn *= 2

Which string function do you call when you want to convert the first letter in the string
to uppercase? - ANSWERstr.capitalize()

Which function do you call to check the number of items in a list? - ANSWERlen()

Which operator is used to concatenate two lists? - ANSWER+ (plus)

Which function do you call when you want to append an element at the end of a list?
- ANSWERlist.append()

What is the name of the output you get when an error occurs in your program? -
ANSWERStack trace or traceback

What is the output of running the following script?
>>> print(5*4) - ANSWER20

What are variables? - ANSWERThey refer to values in a memory

Which function can be used to convert strings to integers? - ANSWERint()

What is the syntax for assigning a variable, x, to the value 8? - ANSWERx = 8

What type of value is returned by the input function? - ANSWERString

How do you write an inline comment in Python? - ANSWER>>>print(ans) # this is
answer

What is the output of the following script?
>>> a, b, c = 1, 2, 3
>>> print(a)
>>> print(b)
>>> print(c) - ANSWER1
2
3

, Which function should you use to convert an integer into a binary number? -
ANSWERbin()


What is the order of operations while evaluating an expression? -
ANSWERPEMDAS

What is the output of the following script?
>>> string = "championship"
>>> print(string[0:5]) - ANSWERchamp

What is the output of the following script?
>>> fruits = ["apples", "bananas", "strawberries", "mangoes", "pears"]
>>>print(fruits[3]) - ANSWERmangoes

How many values do Boolean data types contain? - ANSWER2

Which of the following best describes a software engineering process used by most
successful programmers? - ANSWERDesign a solution carefully; document the
design; then code accordingly

Everyone can figure out that 90 minutes after 2:15 PM is 3:45 PM. We know the
value 45 is correct because - ANSWER(15 + 90) % 60 = 45

The primary difference between / and // in Python 3 is that - ANSWER// always
results in an integer; / may result in fractions or decimals

When is it appropriate to get an input with "int(input___))" instead of merely
"input(___)"? - ANSWERWhen the input should be a number and not a string

To get the first item from a list named 'names', use - ANSWERnames[0]

What would be displayed by the following code sequence?
a = [1, 2, 3]
b =a
a.append(4)
b.append(4)
print(b) - ANSWER[1, 2, 3, 4, 4]

If one wishes to use square brackets to access elements in a dictionary, within the
square brackets one must put - ANSWERa key value to search for

Which of these is not automatically available for lists in Python? -
ANSWERaverage(list) -- compute the average of values

_+1
_+2
_+3
€11,81
Krijg toegang tot het volledige document:

100% tevredenheidsgarantie
Direct beschikbaar na je betaling
Lees online óf als PDF
Geen vaste maandelijkse kosten


Ook beschikbaar in voordeelbundel

Maak kennis met de verkoper

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 West Virginia
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
421
Lid sinds
2 jaar
Aantal volgers
253
Documenten
13986
Laatst verkocht
2 weken geleden

3,8

72 beoordelingen

5
27
4
18
3
17
2
2
1
8

Recent door jou bekeken

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

Veelgestelde vragen