Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 3 out of 28 pages
Exam (elaborations)

IS 122 (Programming Logic) Latest Midterms Review Q & S 2024

Document preview thumbnail
Preview 3 out of 28 pages

IS 122 (Programming Logic) Latest Midterms Review Q & S 2024IS 122 (Programming Logic) Latest Midterms Review Q & S 2024IS 122 (Programming Logic) Latest Midterms Review Q & S 2024

Content preview

IS 122




Programming Logic




LATEST MIDTERMS REVIEW
Q&S




©2024/2025

,1. Multiple Choice: What is the output of the following Python
code snippet?
```python
list = ['a', 'b', 'c', 'd']
print("".join(list[::2]))
```
A) ac
B) bd
C) abc
D) None of the above


Correct Answer: A) ac
Rationale: The slicing `list[::2]` takes every second element from
the list starting from the first element. Therefore, it takes 'a' and
'c'.


2. Fill-in-the-Blank: An ________ search algorithm is more
efficient than a linear search algorithm for sorted lists.
Correct Answer: Binary


©2024/2025

, Rationale: A binary search algorithm divides the list in half each
time, which makes it more efficient for sorted lists compared to a
linear search that checks each element sequentially.


3. True/False: In object-oriented programming, encapsulation is
not useful for hiding the internal state of an object.
Correct Answer: False
Rationale: Encapsulation is a fundamental concept in object-
oriented programming that is used to hide the internal state of an
object and expose only necessary parts through an interface.


4. Multiple Response: Which of the following are principles of
Object-Oriented Programming?
A) Inheritance
B) Encapsulation
C) Polymorphism
D) Recursion


Correct Answers: A) Inheritance, B) Encapsulation, C)
Polymorphism
Rationale: Inheritance, encapsulation, and polymorphism are all
key principles of object-oriented programming. Recursion is a
programming technique, not a principle of OOP.


©2024/2025

Document information

Uploaded on
November 21, 2024
Number of pages
28
Written in
2024/2025
Type
Exam (elaborations)
Contains
Unknown
$15.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

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.
EmilioOchieng
4.1
(24)
Sold
148
Followers
17
Items
4032
Last sold
3 months ago


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

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions