CCP Data Structures & Abstract Data Types Flashcards
6 cards from real CCP practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 CCP Data Structures & Abstract Data Types flashcards as text
Which data structure uses a LIFO (Last In, First Out) access pattern?
Answer: Stack
A stack follows LIFO order, meaning the last element pushed is the first one popped.
In a singly linked list, each node contains data and a pointer to which node?
Answer: The next node
In a singly linked list, each node holds a reference (pointer) to the next node in the sequence.
What is the time complexity of accessing an element by index in an array?
Answer: O(1)
Arrays provide O(1) random access because elements are stored at contiguous memory addresses.
Which abstract data type operates on a FIFO (First In, First Out) principle?
Answer: Queue
A queue processes elements in FIFO order — the first element enqueued is the first dequeued.
A doubly linked list differs from a singly linked list in that each node has pointers to:
Answer: Both the next and previous nodes
A doubly linked list maintains both a next and a previous pointer in each node, enabling bidirectional traversal.
Which data structure is most appropriate for implementing an undo feature in a text editor?
Answer: Stack
A stack is ideal for undo because each action is pushed on the stack and the most recent action (last pushed) is reversed first.