100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

Computer Science 170 Midterm || All Answers Are Correct 100%.

Rating
-
Sold
-
Pages
5
Grade
A+
Uploaded on
25-03-2025
Written in
2024/2025

How would you display the message "Hello" on the console. correct answers print("Hello") How would you assign the product of hourlySalary and hoursWorked to variable earnings. correct answers earnings = hourlySalary*hoursWorked Determine the output produced by the lines of code. 1). 1 num = 4 2). if num <= 9: 3). print("Less than ten.") 4). else: 5). if num == 4: 6). print("Equal to four.") correct answers # Less than ten. Determine the output produced by the lines of code. 1). price = 0 2). age = 17 3). 4). if (age < 6): 5). price = 0 6). elif (age <= 17): 7). price = 3.75 8). else: 9). price = 5 10 11). print("The price is ", format(price, "0.2f")) correct answers # The price is 3.75. Identify the error Print(Hello) correct answers print("Hello") Identify the error a = 2 b = 3 a + b = c print(c) correct answers c = a + b Identify the error 0.05 = interest balance = 800*interest correct answers interest = 0.05 Write a condition equivalent to the negation of the given condition. (a == b) correct answers (a != b)

Show more Read less
Institution
Computer Science 170
Course
Computer Science 170









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Computer Science 170
Course
Computer Science 170

Document information

Uploaded on
March 25, 2025
Number of pages
5
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

Computer Science 170 Midterm || All Answers Are Correct
100%.
How would you display the message "Hello" on the console. correct answers print("Hello")

How would you assign the product of hourlySalary and hoursWorked to variable
earnings. correct answers earnings = hourlySalary*hoursWorked

Determine the output produced by the lines of code.
1). 1 num = 4
2). if num <= 9:
3). print("Less than ten.")
4). else:
5). if num == 4:
6). print("Equal to four.") correct answers # Less than ten.

Determine the output produced by the lines of code.
1). price = 0
2). age = 17
3).
4). if (age < 6):
5). price = 0
6). elif (age <= 17):
7). price = 3.75
8). else:
9). price = 5
10
11). print("The price is ", format(price, "0.2f")) correct answers # The price is 3.75.

Identify the error
Print(Hello) correct answers print("Hello")

Identify the error
a=2
b=3
a+b=c
print(c) correct answers c = a + b

Identify the error
0.05 = interest
balance = 800*interest correct answers interest = 0.05

Write a condition equivalent to the negation of the given condition.
(a == b) correct answers (a != b)

, Write a condition equivalent to the negation of the given condition.
(a < b) correct answers (a >= b)

Write a condition equivalent to the negation of the given condition.
(c != d) correct answers (c == d)

What does this code do?
number1, number2, result = 0, 0, 0
number1 = 5*(4+6)
number2 = 2^2
result = number1\number2 correct answers number1 = 50
number2 = 4
result = 12

Improve/Simplify the code.
1).if (j == 7):
b=1
else:
if (j != 7) :
b = 2 correct answers if (j == 7):
b=1
else:
b=2

Improve/Simplify the code.
if not (answer !="y"):
print("Yes")
else:
if (answer == "y") or (answer == "Y"):
print("Yes") correct answers if (answer == "Y" or answer == "y")
print("Yes")

Declare variables used in steps b) - d), and initialize them to 0. correct answers price,
discountPercent, markDown = 0, 0, 0

Assign the value 19.95 to the variable price. correct answers price = 19.95

Assign the value 30 to the variable discountPercent. correct answers discountPercent = 30

Assign the value of (discountPercent divided by 100) times
price to the variable markDown. correct answers markDown = prince*discountPercent/100

Decrease price by markdown. correct answers price = price - markDown

print the value of price on the console and format it with two decimal points. correct answers
print("The price is", format(price, "0.2f"))

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
SirAnton NURSING, ECONOMICS, MATHEMATICS, BIOLOGY, AND HISTORY MATERIALS BEST TUTORING, HOMEWORK HELP, EXAMS, TESTS, AND STUDY GUIDE MATERIALS WITH GUARANTEED A+ I am a dedicated medical practitioner with diverse knowledge in matters
View profile
Follow You need to be logged in order to follow users or courses
Sold
734
Member since
3 year
Number of followers
437
Documents
34580
Last sold
3 weeks ago
Reign Supreme Scholarly || Enlightened.

Here we offer revised study materials to elevate your educational outcomes. We have verified learning materials (Research, Exams Questions and answers, Assignments, notes etc) for different courses guaranteed to boost your academic results. We are dedicated to offering you the best services and you are encouraged to inquire further assistance from our end if need be. Having a wide knowledge in Nursing, trust us to take care of your Academic materials and your remaining duty will just be to Excel. Remember to give us a review, it is key for us to understand our clients satisfaction. We highly appreciate clients who always come back for more of the study content we offer, you are extremely valued. All the best.

Read more Read less
3.7

110 reviews

5
46
4
20
3
22
2
8
1
14

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions