WGU C949 DATA STRUCTURES AND
ALGORITHMS PREPARATION TEST
QUESTIONS
⩥ What is the time complexity for popping an element from a stack?
Answer: O(1)
⩥ What is a Bag (multiset)? Answer: A data structure that allows for
storing a collection of elements where duplicates are allowed.
⩥ What is the time complexity for adding an element to a bag? Answer:
O(1)
⩥ What does the append() method do in a list? Answer: Adds an element
to the end of the list.
⩥ What does the remove() method do in a list? Answer: Removes the
first occurrence of a specified value from the list.
⩥ What is the purpose of the index() method in a list? Answer: Returns
the index of the first occurrence of a specified value.
,⩥ What does the sort() method do in a list? Answer: Sorts the elements
of the list in ascending order.
⩥ What is a Record in data structures? Answer: A composite data
structure used to store a collection of related fields, each with a specific
name and data type.
⩥ What operation checks if an element is in a bag? Answer: Check
Membership (contains)
⩥ What operation counts how many times an element appears in a bag?
Answer: Count Occurrences (count)
⩥ What is the time complexity of removing an element from a bag?
Answer: O(n)
⩥ What does the Get Size (size) operation return? Answer: The total
number of elements in the bag, including duplicates.
⩥ What is a queue? Answer: A linear data structure that follows the
First-In-First-Out (FIFO) principle.
⩥ What is the time complexity for enqueueing an element in a queue?
Answer: O(1)
, ⩥ What operation removes the front element from a queue? Answer:
Dequeue (Deletion/Pop)
⩥ What is a deque? Answer: A linear data structure that allows insertion
and deletion from both ends.
⩥ What is the time complexity for inserting an element at the front of a
deque? Answer: O(1)
⩥ What is a hash table? Answer: A data structure that maps keys to
values using a hash function.
⩥ What operation retrieves the value associated with a given key in a
hash table? Answer: Search
⩥ What are the two methods for handling collisions in hash tables?
Answer: Chaining and Open Addressing (Probing)
⩥ What is a hash function? Answer: A function that converts input (key)
into a fixed-size value, typically an integer.
⩥ What is a tree in data structures? Answer: A hierarchical data structure
composed of nodes, with a root and leaves.
ALGORITHMS PREPARATION TEST
QUESTIONS
⩥ What is the time complexity for popping an element from a stack?
Answer: O(1)
⩥ What is a Bag (multiset)? Answer: A data structure that allows for
storing a collection of elements where duplicates are allowed.
⩥ What is the time complexity for adding an element to a bag? Answer:
O(1)
⩥ What does the append() method do in a list? Answer: Adds an element
to the end of the list.
⩥ What does the remove() method do in a list? Answer: Removes the
first occurrence of a specified value from the list.
⩥ What is the purpose of the index() method in a list? Answer: Returns
the index of the first occurrence of a specified value.
,⩥ What does the sort() method do in a list? Answer: Sorts the elements
of the list in ascending order.
⩥ What is a Record in data structures? Answer: A composite data
structure used to store a collection of related fields, each with a specific
name and data type.
⩥ What operation checks if an element is in a bag? Answer: Check
Membership (contains)
⩥ What operation counts how many times an element appears in a bag?
Answer: Count Occurrences (count)
⩥ What is the time complexity of removing an element from a bag?
Answer: O(n)
⩥ What does the Get Size (size) operation return? Answer: The total
number of elements in the bag, including duplicates.
⩥ What is a queue? Answer: A linear data structure that follows the
First-In-First-Out (FIFO) principle.
⩥ What is the time complexity for enqueueing an element in a queue?
Answer: O(1)
, ⩥ What operation removes the front element from a queue? Answer:
Dequeue (Deletion/Pop)
⩥ What is a deque? Answer: A linear data structure that allows insertion
and deletion from both ends.
⩥ What is the time complexity for inserting an element at the front of a
deque? Answer: O(1)
⩥ What is a hash table? Answer: A data structure that maps keys to
values using a hash function.
⩥ What operation retrieves the value associated with a given key in a
hash table? Answer: Search
⩥ What are the two methods for handling collisions in hash tables?
Answer: Chaining and Open Addressing (Probing)
⩥ What is a hash function? Answer: A function that converts input (key)
into a fixed-size value, typically an integer.
⩥ What is a tree in data structures? Answer: A hierarchical data structure
composed of nodes, with a root and leaves.