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

CSCI 1301 FINAL QUESTIONS WITH 100% CORRECT ANSWERS

Rating
-
Sold
-
Pages
160
Grade
A+
Uploaded on
05-12-2025
Written in
2025/2026

CSCI 1301 FINAL QUESTIONS WITH 100% CORRECT ANSWERS

Institution
CSCI 1301
Course
CSCI 1301











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

Written for

Institution
CSCI 1301
Course
CSCI 1301

Document information

Uploaded on
December 5, 2025
Number of pages
160
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

Complete the code to handle the exception and to generate 'Error Occurred'
new_string = 'Python'
my_index = 0


try:
while my_index != len(new_string) / 2:
print(new_string[my_index:len(new_string)/2])
my_index += 1


XXX
print('Error Occurred')

,A. except (TypeError, IndentationError):
B. except (IndentationError, AttributeError):
C. except (AttributeError, IndentationError):
D. except (NameError, TypeError):


Give this one a try later!


D. except (NameError, TypeError):




What is the output?
new_list = [0, 1, 2, 3, 4]
print(all(new_list))
print(min(new_list) + max(new_list))


A. True
4
B. False
4
C. False
10
D. True
10


Give this one a try later!


A. True
4




Choose the option that gives ['ABC', 'ABC'] as the output.
A. my_list = ['ABC', 'DEF']
my_list[len(my_list)-1] = 'DEF'
print(my_list)

,B. my_list = ['ABC', 'DEF']
my_list[len(my_list)] = 'ABC'
print(my_list)
C. my_list = ['ABC', 'DEF']
my_list[len[my_list)-1] = 'ABC'
print(my_list)
D. my_list = ['DEF', 'ABC']
my_list[len(my_list)-1] = 'ABC'
print(my_list)


Give this one a try later!


C. my_list = ['ABC', 'DEF']
my_list[len[my_list)-1] = 'ABC'
print(my_list)




Python uses _________ constructs to handle errors during execution.
A. control
B. class method
C. exception-handling
D. conditional


Give this one a try later!


C. exception-handling




Which function is most appropriate to improve the given code?
power_consumption_app1 = 600.85
hours_of_use1 = 12.8
energy_per_day1 = (power_consumption_app1 * hours_of_use1) / 1000


power_consumption_app2 = 1800.45
hours_of_use2 = 0.45

, energy_per_day2 = (....)


power_consumption_app3 = 70
hours_of_use3 = 1.5
energy_per_day3 = (...)


total_energy_consumed = energy_per_day1 + energy_per_day2 + energy_per_day3


print(f'The total energy consumed per day is {total_energy_consumed:f}')


A. def print_power_consumed(total_energy_consumed):
print(total_energy_consumed)
B. def input_values(power, hours):
power = float(input())
hours = float(input())
C. def compute_energy_consumed(power, hours):
return (power * hours) / 1000
D. def compute_total(energy_day1, energy_day2, energy_day3):
return energy_per_day1 + energy_per_day2 + energy_per_day3


Give this one a try later!


C. def compute_energy_consumed(power, hours):
return (power * hours) / 1000




Given that my_val is a list of float values, which of the following is an example of a
built-in function?
A. my_val.capitalize()
B. my_val.title()
C. len(my_val)
D. average(my_val)


Give this one a try later!

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.
TestITandFixIT Johns Hopkins University
View profile
Follow You need to be logged in order to follow users or courses
Sold
36
Member since
1 year
Number of followers
0
Documents
4737
Last sold
4 days ago

3.5

8 reviews

5
3
4
2
3
1
2
0
1
2

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