COSC 477 - Exam 1 Questions and Answers Already Passed
3 views 0 purchase
Course
COSC 477 -
Institution
COSC 477 -
COSC 477 - Exam 1 Questions and
Answers Already Passed
What is the primary purpose of data structures in programming?
The primary purpose of data structures in programming is to organize and store data
efficiently, allowing for easy access and modification.
What is the difference between...
COSC 477 - Exam 1 Questions and
Answers Already Passed
What is the primary purpose of data structures in programming?
✔✔The primary purpose of data structures in programming is to organize and store data
efficiently, allowing for easy access and modification.
What is the difference between a stack and a queue?
✔✔A stack follows the Last In, First Out (LIFO) principle, while a queue follows the First In,
First Out (FIFO) principle for managing elements.
What is Big O notation, and why is it important?
✔✔Big O notation is a mathematical notation used to describe the upper bound of an algorithm's
time or space complexity, providing insight into its efficiency as input size grows.
What are the main characteristics of a linked list?
✔✔The main characteristics of a linked list include dynamic size, ease of insertion and deletion,
and the use of nodes that contain data and pointers to the next (or previous) node.
1
,What is a binary tree, and how does it differ from a binary search tree?
✔✔A binary tree is a hierarchical data structure where each node has at most two children. A
binary search tree (BST) is a type of binary tree where the left child contains values less than the
parent, and the right child contains values greater than the parent.
How do you perform a depth-first search (DFS) on a graph?
✔✔To perform a depth-first search (DFS) on a graph, you start at a selected node, explore as far
as possible along each branch before backtracking, using a stack or recursion to keep track of the
visited nodes.
What is the significance of hashing in data structures?
✔✔Hashing is significant in data structures because it allows for fast data retrieval through key-
value pairs, enabling average-case constant time complexity for search operations in hash tables.
What is a recursive function, and how does it work?
✔✔A recursive function is a function that calls itself in order to solve smaller instances of the
same problem, requiring a base case to terminate the recursion and prevent infinite loops.
What are the advantages and disadvantages of using arrays?
2
,✔✔The advantages of using arrays include fixed size, fast access time to elements, and efficient
memory usage. The disadvantages include difficulty in resizing and the need for contiguous
memory allocation.
What is the purpose of a constructor in object-oriented programming?
✔✔The purpose of a constructor in object-oriented programming is to initialize an object’s
attributes and allocate necessary resources when an instance of a class is created.
What is the concept of encapsulation in OOP?
✔✔Encapsulation is the concept in object-oriented programming that restricts access to an
object's internal state and only exposes necessary methods, promoting modularity and protecting
object integrity.
How does an algorithm's time complexity impact its performance?
✔✔An algorithm's time complexity impacts its performance by determining how the execution
time increases relative to the input size, which affects its scalability and efficiency for large
datasets.
What is the difference between shallow copy and deep copy in programming?
3
, ✔✔A shallow copy creates a new object but copies references to the original object’s elements,
while a deep copy creates a new object and recursively copies all objects found within the
original, resulting in completely independent copies.
What role do interfaces play in object-oriented design?
✔✔Interfaces define a contract for classes to implement specific methods without dictating how
those methods should be executed, promoting loose coupling and flexibility in software design.
What is the significance of the visitor design pattern?
✔✔The visitor design pattern allows operations to be performed on elements of an object
structure without changing the classes of the elements, promoting separation of concerns and
making it easier to add new operations.
What is the purpose of unit testing in software development?
✔✔The purpose of unit testing is to validate that individual components or functions of a
program work correctly in isolation, helping to identify bugs early and ensure code reliability.
THE MILLIONAIRE NEXT DOOR ✔✔THE MILLIONAIRE NEXT DOOR
4
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller StellarScores. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $10.49. You're not tied to anything after your purchase.