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

Python Exam Chapters 1-5 Exam Questions Correctly Answered.

Beoordeling
-
Verkocht
-
Pagina's
13
Cijfer
A+
Geüpload op
05-04-2025
Geschreven in
2024/2025

Python Exam Chapters 1-5 Exam Questions Correctly Answered. Which of the following are operators, and which are values? * 'hello' -88.8 - / + 5 - CORRECT ANSWER The operators are +,-,*,and /. The values are 'hello' ,-88.8, and 5. Which of the following is a variable , and which is a string ? spam 'spam' - CORRECT ANSWER The variable is spam; the string is 'spam'. Strings always start and end with quotes. Name three data types. - CORRECT ANSWER The three data types are integers, floating point numbers, and strings. What is an expression made up of ? What do all expressions do ? - CORRECT ANSWER An expression is a combination of values and operators. All expressions evaluate (that is, reduce) to a single value. This chapter (1) introduced assignment statements, like spam = 10. What is the difference between an expression and a statement? - CORRECT ANSWER An expression evaluates to a single value. A statement does not. What does the variable bacon contain after the following code runs? bacon = 20 bacon + 1 - CORRECT ANSWER The bacon variable is set to 20. The bacon + 1 expression does not reassign the value in bacon (that would need an assignment statement: bacon = bacon + 1). What should the following two expressions evaluate to ? 'spam' + 'spamspam' 'spam' * 3 - CORRECT ANSWER Both expressions evaluate to the string 'spamspamspam'. Why is egg a valid variable name while 100 is invalid ? - CORRECT ANSWER Variable names cannot begin with a number. What three functions can be used to get the integer, floating-point number, or string version of a value ? - CORRECT ANSWER The int(), float(), and str() functions will evaluate to the integer, floating-point number, and string versions of the value passed to them. Why does this expression cause an error ? How can you fix it ? 'I have eaten' + 99 + 'burritos' . - CORRECT ANSWER The expression causes an error because 99 is an integer, and only strings can be concatenated to other strings with the + operator. The correct way is i have eaten ' + str(99) + ' burritos '. What are the two values of the Boolean data type? How do you write them? - CORRECT ANSWER True and False, using capital T and F, with the rest of the word in lowercase. What are the three Boolean operators? - CORRECT ANSWER and, or, and not. Write out the truth tables of each Boolean operator (that is, every possible combination of Boolean values for the operator and what they evaluate to). - CORRECT ANSWER True and True is True. True and False is False. False and True is False. False and False is False. True or True is True. True or False is True. False or True is True. False or False is False. not True is False. not False is True. What do the following expressions evaluate to ? (5 > 4) and (3 == 5) not (5 >4) (5 > 4) or (3 == 5) not ((5 > 4) or (3 == 5)) (True and True) and (True == False) (not False) or (not True) - CORRECT ANSWER False False True False False True What are the six comparison operators ? - CORRECT ANSWER ==, !=, <,>,<=,and >= What is the difference between the equal to operator and the assignment operator ? - CORRECT ANSWER == is the equal operator to operator that compares two values and evaluates to a Boolean, while = is the assignment operator that stores a value in a variable. Explain what a condition is and where you would use one. - CORRECT ANSWER A condition is an expression used in a flow control statement that evaluates to a Boolean value. Identify the three blocks in this code: spam = 0 if spam == 10: print('eggs')

Meer zien Lees minder
Instelling
PYTHON.
Vak
PYTHON.









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

Geschreven voor

Instelling
PYTHON.
Vak
PYTHON.

Documentinformatie

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

Onderwerpen

Voorbeeld van de inhoud

Python Exam Chapters 1-5 Exam
Questions Correctly Answered.

Which of the following are operators, and which are values?

*

'hello'

-88.8

-

/

+

5 - CORRECT ANSWER The operators are +,-,*,and /. The values are 'hello' ,-88.8, and 5.



Which of the following is a variable , and which is a string ?

spam

'spam' - CORRECT ANSWER The variable is spam; the string is 'spam'. Strings always start and end with
quotes.



Name three data types. - CORRECT ANSWER The three data types are integers, floating point numbers,
and strings.



What is an expression made up of ? What do all expressions do ? - CORRECT ANSWER An expression is a
combination of values and operators. All expressions evaluate (that is, reduce) to a single value.



This chapter (1) introduced assignment statements, like spam = 10. What is the difference between an
expression and a statement? - CORRECT ANSWER An expression evaluates to a single value. A
statement does not.



What does the variable bacon contain after the following code runs?

bacon = 20

, bacon + 1 - CORRECT ANSWER The bacon variable is set to 20. The bacon + 1 expression does not
reassign the value in bacon (that would need an assignment statement: bacon = bacon + 1).



What should the following two expressions evaluate to ?

'spam' + 'spamspam'

'spam' * 3 - CORRECT ANSWER Both expressions evaluate to the string 'spamspamspam'.



Why is egg a valid variable name while 100 is invalid ? - CORRECT ANSWER Variable names cannot begin
with a number.



What three functions can be used to get the integer, floating-point number, or string version of a value ?
- CORRECT ANSWER The int(), float(), and str() functions will evaluate to the integer, floating-point
number, and string versions of the value passed to them.



Why does this expression cause an error ? How can you fix it ?

'I have eaten' + 99 + 'burritos' . - CORRECT ANSWER The expression causes an error because 99 is an
integer, and only strings can be concatenated to other strings with the + operator. The correct way is i
have eaten ' + str(99) + ' burritos '.



What are the two values of the Boolean data type? How do you write them? - CORRECT ANSWER True
and False, using capital T and F, with the rest of the word in lowercase.



What are the three Boolean operators? - CORRECT ANSWER and, or, and not.



Write out the truth tables of each Boolean operator (that is, every possible combination of Boolean
values for the operator and what they evaluate to). - CORRECT ANSWER True and True is True.

True and False is False.

False and True is False.

False and False is False.

True or True is True.

True or False is True.

False or True is True.
€11,47
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.
ROSEGRADES Nursing
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
214
Lid sinds
2 jaar
Aantal volgers
87
Documenten
12158
Laatst verkocht
1 maand geleden
TOPGRADE

I HELP STUDENTS WITH REVISION MATERIALS WITH BETTER GRADES GUARANTEED. BEST OF LUCK.

3,4

30 beoordelingen

5
10
4
3
3
11
2
2
1
4

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