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

COSC 1436 FINAL UPDATED ACTUAL Exam Questions and CORRECT Answers

Beoordeling
-
Verkocht
-
Pagina's
73
Cijfer
A+
Geüpload op
15-12-2024
Geschreven in
2024/2025

COSC 1436 FINAL UPDATED ACTUAL Exam Questions and CORRECT Answers [SHORT ANSWER] Assume the string variables firstName and userID are assigned with values. use string slicing and concatenation to create a username based on the first two letters of the firstName, concatenated with the last four digits of the userID as shown in the example below. For Example: Suppose firstName = "Mary" and userID = "W" then, the username

Meer zien Lees minder
Instelling
Cosc
Vak
Cosc











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

Geschreven voor

Instelling
Cosc
Vak
Cosc

Documentinformatie

Geüpload op
15 december 2024
Aantal pagina's
73
Geschreven in
2024/2025
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

Voorbeeld van de inhoud

COSC 1436 FINAL UPDATED ACTUAL
Exam Questions and CORRECT Answers
[SHORT ANSWER] Assume the string variables firstName and userID are assigned with values.
use string slicing and concatenation to create a username based on the first two letters of the
firstName, concatenated with the last four digits of the userID as shown in the example below.


For Example: Suppose firstName = "Mary" and userID = "W12345678" then, the username
should be:
[SHORT ANSWER] Assume the string variables firstName and userID are assigned with values.
use string slicing and concatenation to create a username based on the first two letters of the
firstName, concatenated with the last four digits of the userID as shown in the example below.


For Example: Suppose firstName = "Mary" and userID = "W12345678" then, the username
should be:


Ma5678 - CORRECT ANSWER - username = firstName[:2] + userID[-4:]


SHORT ANSWER Assume variable gpa has already been assigned a value. Write python code
that displays invalid GPA if the value associated with variable gpa is not in the range [0,4] -
CORRECT ANSWER - if gpa < 0 or gpa > 4:
print("Invalid GPA")


Which type of error prevents the program from running?


human
syntax
grammatical

logical - CORRECT ANSWER - syntax


The smallest storage location in a computer's memory is known as a

,switch
byte
ketter

bit - CORRECT ANSWER - bit


A Python line comment begins with ________.
a. /*
b. $$
c. //

d. # - CORRECT ANSWER - d. #


Which of the following are valid camel case identifier naming styles (Choose all that apply)?
(a) dollar_amount
(b) dollarAmount
(c) dollar$Amount
(d) amtDollar
(e) dollarAmt$
(f) dollarAmt
(g) amountDollar

(h) Dollar_Amount - CORRECT ANSWER - (b) dollarAmount
(d) amtDollar
(f) dollarAmt
(g) amountDollar


Assume the following:


val = 99

,val += 1


Match the code with its output:
a. print('The value is', 'val')
b. print('The value is', val)
print("The value is:", 'val')


The value is val
The value is 100

The value is: val - CORRECT ANSWER - (a) The value is val
(b) The value is 100
(c) The value is: val


Match the relational operators with its meaning:
a. >
b. <
c. >=
d. <=
e. ==

f. != - CORRECT ANSWER - a. Greater than
b. less than
c. Greater than or equal to
d. Less than or equal to
e. Equal to (equality operator)
f. Not equal to


Which of the following will assign a random integer in the range of 1 through 50 to the variable
number?

, (a) number = random(range(1, 50))
(b) random(1, 50) = number
c) number = random.randint(1, 50)

(d) randint(1, 50) = number - CORRECT ANSWER - c) number = random.randint(1, 50)


x < y or z > x What is the result of the following Boolean expression, given that x = 5, y = 3, and
z= 8?


not (x < y or z > x) and y < z


(a) 5
(b) False
(c) 8

(d) True - CORRECT ANSWER - (b) False


What is the result of the following Boolean expression, given that x = 5, y = 3, and z = 8?


x < y or z > x


(a) False
(b) 8
(c) True

(d) 5 - CORRECT ANSWER - (c) True


Consider the following statements. If the input is 85, the output of the following code will be:


score=0
€13,80
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.
MGRADES Stanford University
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
1123
Lid sinds
2 jaar
Aantal volgers
104
Documenten
68962
Laatst verkocht
10 uur geleden
MGRADES (Stanford Top Brains)

Welcome to MGRADES Exams, practices and Study materials Just think of me as the plug you will refer to your friends Me and my team will always make sure you get the best value from the exams markets. I offer the best study and exam materials for a wide range of courses and units. Make your study sessions more efficient and effective. Dive in and discover all you need to excel in your academic journey!

3,8

178 beoordelingen

5
76
4
31
3
47
2
9
1
15

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