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

CSC121 PYTHON EXAM QUESTIONS WITH CORRECT ANSWERS

Rating
-
Sold
-
Pages
10
Grade
A+
Uploaded on
14-06-2025
Written in
2024/2025

CSC121 PYTHON EXAM QUESTIONS WITH CORRECT ANSWERS

Institution
CSC121 PYTHON
Module
CSC121 PYTHON









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

Written for

Institution
CSC121 PYTHON
Module
CSC121 PYTHON

Document information

Uploaded on
June 14, 2025
Number of pages
10
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

CSC121 PYTHON EXAM QUESTIONS
WITH CORRECT ANSWERS

Which of the following would you use if an element is to be removed from a specific
index?

a remove method
an index method
a del statement
a slice method - Answer-a del statement

What will be the value of the variable num_list after the following code executes?
num_list = [1, 2, 3, 4]
num_list[3] = 10

[1, 2, 3, 10]
[1, 2, 10, 4]
[1, 10, 10, 10]
Nothing; this code is invalid - Answer-[1, 2, 3, 10]

The ________ method is commonly used to add items to a list. - Answer-append

Rewrite the following code with list comprehension:
list1 = [4, 7, 12, 8, 25]
list2 = []
for x in list1:
if x > 10:
list2.append(x*2)

A. list1 = [4, 7, 12, 8, 25]list2 = [x*2 for x in list1 if x > 10]
B. list1 = [4, 7, 12, 8, 25]list2 = x*2 for x in list1 if x > 10
C. list1 = [4, 7, 12, 8, 25]list2 = [for x*2 in list1 if x > 10]
D. list1 = [4, 7, 12, 8, 25]list2 = [x*2 if x > 10 in list1 ] - Answer-A. list1 = [4, 7, 12, 8,
25]list2 = [x*2 for x in list1 if x > 10]

The primary difference between a tuple and a list is that

you don't use commas to separate elements in a tuple

, once a tuple is created, it cannot be changed
a tuple cannot include lists as elements
a tuple can only include string elements - Answer-once a tuple is created, it cannot be
changed

What will be the value of the variable list after the following code executes?
list = [1, 2]
list = list * 3

[3, 6]
[1, 2], [1, 2], [1, 2]
[1, 2, 1, 2, 1, 2]
[1, 2] * 3 - Answer-[1, 2, 1, 2, 1, 2]

When working with multiple sets of data, like a table made up of rows and columns, one
would typically use a(n)

tuple
list
nested list
sequence - Answer-nested list

Which of the follow will display "Found it!" if the string 'May 4' is found in the list
appointments? - Answer-if 'May 4' in appointments:
print('Found it!')

The index of the first element in a list is 1, the index of the second element is 2, and so
forth. TRUE OR FALSE - Answer-fALSE

The ________ function can be used to convert a list to a tuple. - Answer-TUPLE

Given the following list comprehension, write the equivalent code without using list
comprehension:
list1 =[[x,y] for x in range(3) for y in range(2) if (x + y) % 2 == 0] - Answer-.
list1 = []
for x in range(3):
for y in range(2):
if (x + y ) % 2 == 0:
list1.append([x,y])

What is an advantage of using a tuple rather than a list?

Tuples can include any data as an element.
Tuples are not limited in size.
Processing a tuple is faster than processing a list.
£10.00
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached


Also available in package deal

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.
Perfectscorer Chamberlain College Of Nursng
Follow You need to be logged in order to follow users or courses
Sold
483
Member since
3 year
Number of followers
354
Documents
8832
Last sold
3 weeks ago

Our store offers a wide selection of materials on various subjects and difficulty levels, created by experienced teachers. We specialize on NURSING,WGU,ACLS USMLE,TNCC,PMHNP,ATI and other major courses, Updated Exam, Study Guides and Test banks. If you don't find any document you are looking for in this store contact us and we will fetch it for you in minutes, we love impressing our clients with our quality work and we are very punctual on deadlines. Please go through the sets description appropriately before any purchase and leave a review after purchasing so as to make sure our customers are 100% satisfied. I WISH YOU SUCCESS IN YOUR EDUCATION JOURNEY

Read more Read less
3.6

74 reviews

5
27
4
15
3
17
2
5
1
10

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 exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight 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 smashed it. It really can be that simple.”

Alisha Student

Frequently asked questions