practice questions
.docx
keyboard_arrow_up
School
Dominica State College *
*We aren’t endorsed by this school
Course
125
Subject
Computer Science
Date
May 9, 2024
Type
docx
Pages
12
Uploaded by ProfWhale4328 on coursehero.com
Section 1: Multiple Choice (40 marks)
Choose the most appropriate answer for each question.
Which of the following data structures follows the Last-In-First-Out (LIFO) principle?
a) Stack
b) Queue
c) Linked list
d) Tree
Which data structure allows elements to be accessed directly using an index?
a) Stack
b) Queue
c) Array
d) Linked list
Which data structure represents a hierarchical structure with nodes and edges?
a) Stack
b) Queue
c) Tree
d) Linked list
Which traversal visits the left subtree, then the root, and finally the right subtree?
a) Preorder traversal
b) Inorder traversal
c) Postorder traversal
d) Level order traversal
Which sorting algorithm repeatedly swaps adjacent elements if they are in the wrong order?
a) Bubble sort
b) Selection sort
c) Insertion sort
d) Merge sort
Which search algorithm requires the data to be sorted and uses a divide-and-conquer approach?
a) Linear search
b) Binary search
c) Depth-first search
d) Breadth-first search
Which data structure guarantees that the elements are stored in a sorted order?
a) Stack
b) Queue
c) Binary search tree
d) Linked list
Which algorithm finds a minimum spanning tree in a weighted graph?
a) Dijkstra's algorithm
b) Prim's algorithm
c) Kruskal's algorithm
d) Bellman-Ford algorithm
Which algorithm solves optimization problems by making locally optimal choices at each stage?
a) Depth-first search
b) Breadth-first search
c) Greedy algorithm
d) Divide and conquer algorithm
Which data structure is used to represent and evaluate arithmetic expressions?
a) Stack
b) Queue
c) Tree
d) Linked list
Which data structure is based on the Last-In-First-Out (LIFO) principle and supports push and pop operations?
a) Queue
b) Array
c) Linked list
d) Stack
Which data structure allows efficient insertion and deletion operations at both ends?
a) Stack
b) Queue
c) Linked list
d) Array
Which tree traversal visits the root, then the left subtree, and finally the right subtree?
a) Inorder traversal
b) Preorder traversal
c) Postorder traversal
d) Level order traversal
Which sorting algorithm repeatedly selects the minimum element and places it in the correct position?
a) Bubble sort
b) Selection sort
c) Insertion sort
d) Quick sort
Which search algorithm does not require the data to be sorted and sequentially checks each element until a match is found?
a) Linear search
b) Binary search
c) Depth-first search
d) Breadth-first search
Which data structure is efficient for inserting elements at the beginning or end, but inefficient for
arbitrary element access?
a) Stack
b) Queue
c) Linked list
d) Array
Which algorithm divides a problem into smaller subproblems, solves them recursively, and combines the solutions to the subproblems?
a) Greedy algorithm
b) Divide and conquer algorithm
c) Depth-first search algorithm
d) Breadth-first search algorithm
Which data structure stores elements in a sorted manner and allows efficient search, insertion, and deletion operations?
a) Stack
b) Queue
c) Binary search tree
d) Linked list
Which sorting algorithm works by repeatedly swapping adjacent elements if they are in the wrong order?
a) Bubble sort
b) Selection sort
c) Insertion sort
d) Merge sort
Which traversal visits the left subtree, then the right subtree, and finally the root?
a) Inorder traversal
b) Preorder traversal
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
LINKED LIST IMPLEMENTATION
Subject: Data Structure and Algorithm in C++Create a Student Record Management system that can perform the following operations:1) Insert student records2) Delete student record3) Show student record4) Search student record
The student record should contain the following items1) Name of Student2) Student Matriculation ID number3) Course in which the student is enrolled4) Total marks of the student Approach: With the basic knowledge of operations of Linked Lists like insertion, deletion of elements in linked list, the student record management can be created. Below are the functionalities explained that are to be implemented.●Check Record: It is a utility function of creating a record it checks before insertion that the Record Already exist or not. It uses the concept of checking for a Node with given Data in a linked list.-Create Record: It is as simple as creating a new node in the Empty Linked list or inserting a new node in a non-Empty linked list.-Search…
arrow_forward
Why is it necessary to have a framework for storing data? Each of the following should be accompanied with an example.Discuss a list data structure's mathematical concept and implementation.
arrow_forward
Q. _ In terms of data structures, what is the difference between a Linked List and an Array?
arrow_forward
When compared to alternative data structures, such as a linked
list o
arrow_forward
Subject : Data Structure
Q: As discussed in the class that for implementation of the list data structures the interface of the list will be stayed the same. Explain what is meant by interface of list? What are the different operations performed on any data structure?
arrow_forward
When contrasted with other data structures, such as a linked
list or tree, this one has a number of advantages.
arrow_forward
1. Why do we need data structures? Provide an example of each.2. Discuss a mathematical model and implementation of a List data structure?3. What are the differences between a list and a linked list?
arrow_forward
What is the best way to describe a data structure that makes use of a double linked list?
arrow_forward
Write a linked list structure declaration to define a record of car partscontaining:
part identification (integer)
part name (maximum 20 characters)
quantity on stock (integer)
cost per unit (double)
supplier's name (maximum 30 characters)
pointer to the next node
arrow_forward
C Language
Explain what is the difference between a doubly linked list and singly linked list? Give the advantages and uses of a circular linked list.
Thank you
arrow_forward
When contrasted with other data structures, such as a linked list or a tree, this
arrow_forward
Explain the difference between an array and a linked list data structure. Discuss their advantages and disadvantages in terms of insertion, deletion, and access operations.
arrow_forward
(b) What is the advantages of using linked list compared to array?
(c) Briefly explain FIVE (5) basic operations of linked list.
arrow_forward
Lab 1 – Using Fundamental Data Structures
Purpose: The purpose of this Lab assignment is to:
Design and develop Applications that incorporate fundamental data structures such as:
Singly Linked Lists
Doubly Linked Lists
Circularly Linked Lists
References: Read the course’s text chapter 3 and the lecture slides. This material provides the necessary information that you need to complete the exercises.
Be sure to read the following general instructions carefully:
- This assignment must be completed individually by all the students.
- See the naming and submission rules at the end of this document
Exercise 1
If your first name starts with a letter from A-J inclusively:
Add a method swapTwoNodes to SinglyLinkedList class from week 2 lecture examples. This method should swap two nodes node1 and node2 (and not just their contents) given references only to node1 and node2. The new method should check if node1 and node2 are the same node, etc. Write the main method to…
arrow_forward
Course: Data Structure (Python)
Discuss the main concept of Linked List. Include a diagram of an Linked List node and Linked List as is.
Node in LL
Data in LL
Address in LL
Head in LL
arrow_forward
This data structure provides a variety of benefits over others, such as a linked list or tree.
arrow_forward
Are linked lists considered linear or non-linear data structures?
arrow_forward
What is the best way to explain a data structure that employs a double linked list?
arrow_forward
A tree based data structure could be more efficient than array or list based data structures, because
arrow_forward
Subject: Data structures and algorithms
Create an essay about the disadvantage of doubly linked list compared to singly linked list
arrow_forward
C++ Data Structures
Write a program to implement two queues using doubly linked lists. User will enqueue values on first queue,when an element is dequeued from first queue it should automatically enqueue to second queue. From secondqueue user will dequeue this element explicitly.
arrow_forward
what are the advantages of an adjacency list over an adjacency matrix
arrow_forward
Overview
Topies
Doubly Linked List
Description
For this assignment, you will code a basic job leads management system to keep track of your
job search opportunities, using a doubly linked list. Your implementation should include the
following:
1. Create a doubly linked link
2. Add new job leads to the front of the list
3. Add new job leads to the tail of the list
4. Remove job leads from the list
5. Print the list from head to tail
JAVA
6. Print the list from tail to head
Coding Specifications
Implement the following classes:
1) JobLead Class
a) Must have the following attributes:
- company name: string, private, company full name
- contact name: string, private, contact person full name
contact phone: string, private, contact person phone number
job title: string, private, job title
job description: string, private, job description
b) Must have an overloaded constructor which takes in the five (5) attributes and sets
the object variables
c) Must have getter/setter methods for the five…
arrow_forward
java program:
A linked queue is a single linked list in which:
The first node of the linked list is both the front of the queue and the rear of the queue.
The first node of the linked list is the rear of the queue and the last node of the linked list is the front of the queue.
The first node of the linked list is the front of the queue and the last node of the linked list is the rear of the queue.
The last node of the linked list is both the front of the queue and the rear of the queue.
arrow_forward
4. What are the basic operations supported by a list?
5. What are the Advantages of using a Linked list over Array?
6. What are the Disadvantages of Linked list?
arrow_forward
Subject: Data structures and algorithms
Create an essay about the advantage of doubly linked list compared to singly linked list
arrow_forward
Topic: Doubly Linked List Deque
Implement the following problem in the main case 0 (see attached photo)
Your algorithm for the hierarchy problem should follow this: Evaluate the final set of operations first given the set of rules. Then, do the remove operations. Finally, do the add operations.
DO NOT MIND THE #include "dlldeque.h" it is already implemented only the case 0 needs to be solved
#include <iostream>
#include <cstring>
#include "dlldeque.h"
using namespace std;
int main(int argc, char** argv) {
DLLDeque* deque = new DLLDeque();
int test;
cin >> test;
switch (test) {
case 0:
// perform your Hierarchy implementation here
// utilize the deque initialized,
// initialize variables you need before switch
// you can use the print() method to debug, but not the final_print()
// do not modify from this point onwards
deque->final_print();…
arrow_forward
Question 1
1 Point
A linked queue is a single linked list in which:
The first node of the linked list is the rear of the queue and the last node of the linked list is the front of the
queue.
B The last node of the linked list is both the front of the queue and the rear of the queue.
The first node of the linked list is the front of the queue and the last node of the linked list is the rear of the
queue.
The first node of the linked list is both the front of the queue and the rear of the queue.
arrow_forward
Data structure (C++)
Problem: Create an employee Record Management system using linked listthat can perform the following operations:• Insert employee record• Delete employee record• Update employee record• Show employee• Search employee• Update salary
The employee record should contain the following items• Name of Employee• ID of Employee• First day of work• Phone number of the employee• Address of the employee• Work hours• Salary
Approach:With the basic knowledge of operations on Linked Lists like insertion, deletion of elementsin the Linked list, the employee record management system can be created. Below are thefunctionalities explained that are to be implemented:Check Record: It is a utility function of creating a record it checks before insertionthat the Record Already Exist or not. It uses the concept of checking for a Node with givenData in a linked list.Create Record: It is as simple as creating a new node in the Empty Linked list orinserting a new node in a non-Empty linked…
arrow_forward
dout in data structures:
Write an algorithm to delete an element from the queue. Explain the algorithm with the help of an example and diagram.
arrow_forward
As compared to other data structures like a linked list or tree, this one offers many benefits.
arrow_forward
Select the most appropriate data structure for each scenario.
Search needs to be done
frequently.
A binary search needs to be
done on a sorted structure.
1. An array
Insertion needs to be done
frequently at the beginning
of the structure.
2. A linked list
Deletion needs to be done
frequently in a sorted
structure (with known
deletion positions).
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Related Questions
- LINKED LIST IMPLEMENTATION Subject: Data Structure and Algorithm in C++Create a Student Record Management system that can perform the following operations:1) Insert student records2) Delete student record3) Show student record4) Search student record The student record should contain the following items1) Name of Student2) Student Matriculation ID number3) Course in which the student is enrolled4) Total marks of the student Approach: With the basic knowledge of operations of Linked Lists like insertion, deletion of elements in linked list, the student record management can be created. Below are the functionalities explained that are to be implemented.●Check Record: It is a utility function of creating a record it checks before insertion that the Record Already exist or not. It uses the concept of checking for a Node with given Data in a linked list.-Create Record: It is as simple as creating a new node in the Empty Linked list or inserting a new node in a non-Empty linked list.-Search…arrow_forwardWhy is it necessary to have a framework for storing data? Each of the following should be accompanied with an example.Discuss a list data structure's mathematical concept and implementation.arrow_forwardQ. _ In terms of data structures, what is the difference between a Linked List and an Array?arrow_forward
- When compared to alternative data structures, such as a linked list oarrow_forwardSubject : Data Structure Q: As discussed in the class that for implementation of the list data structures the interface of the list will be stayed the same. Explain what is meant by interface of list? What are the different operations performed on any data structure?arrow_forwardWhen contrasted with other data structures, such as a linked list or tree, this one has a number of advantages.arrow_forward
- 1. Why do we need data structures? Provide an example of each.2. Discuss a mathematical model and implementation of a List data structure?3. What are the differences between a list and a linked list?arrow_forwardWhat is the best way to describe a data structure that makes use of a double linked list?arrow_forwardWrite a linked list structure declaration to define a record of car partscontaining: part identification (integer) part name (maximum 20 characters) quantity on stock (integer) cost per unit (double) supplier's name (maximum 30 characters) pointer to the next nodearrow_forward
- C Language Explain what is the difference between a doubly linked list and singly linked list? Give the advantages and uses of a circular linked list. Thank youarrow_forwardWhen contrasted with other data structures, such as a linked list or a tree, thisarrow_forwardExplain the difference between an array and a linked list data structure. Discuss their advantages and disadvantages in terms of insertion, deletion, and access operations.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education