Final Flashcards
Learn
What is the significance of selecting appropriate data structures and algorithms in software development?
It can significantly impact the speed and efficiency of the software.
Which data structure is best suited for implementing a stack?
Linked list (or Array, as both are commonly used depending on the specific requirements and constraints)
What does it mean for an abstract data type to be “abstract”?
It hides the implementation details from the user.
How does the time complexity of an algorithm affect its efficiency?
Algorithms with lower time complexity are always more efficient.
How do data structures and algorithms contribute to the efficiency of a program?
Data structures and algorithms both play crucial roles in optimizing program performance.
Two arrays, itemsNames and itemsPrices, are used to store a list of item names and their corresponding prices. Which is true?
Both arrays should be declared to have the same number of elements.
Given an array with values 5, 10, 15, 20, 25, what are the fewest number of swaps needed to reverse the list?
2
Given array scorePerQuiz has 10 elements. Which assigns element 7 with the value 8?
scorePerQuiz[7] = 8;
Which is an invalid access for the array?
int[] numList = new int[5];
int x = 3;
- numsList[x-3]
- numsList[0]
- numsList[x+2]
- numsList[(2*x) - x]
Given that integer array x has elements 4, 7, 3, 0, 8, what are the elements after the loop?
int i;
for (i = 0; i < 4; ++i) {
x[i] = x[i + 1];
}
7, 3, 0, 8, 8
Which list is sorted into ascending order?
- Sally, Sam, Sandy, Samantha, Sal
- Ral, Reece, Rita, Ryan
- Don, Dan, Dale, Dana
- Alan, Andy, Al, Adam
Ral, Reece, Rita, Ryan
Given the number list (2, 12, 8, 19, 5, 30), identify the merged list in merge sort after the completion of the second level.
- (2, 12, 8) and (5, 19, 30)
- (2, 8, 12) and (5, 19, 30)
- (2, 5, 8) and (12, 19, 30)
- (2, 12, 8) and (19, 5, 30)
(2, 8, 12) and (5, 19, 30)
In selection sort, the smallest element is selected and swapped with the _____ unsorted element.
- next
- middle
- leftmost
- rightmost
leftmost
Which of the following is the fastest algorithm to sort a string?
- Selection Sort
- Insertion Sort
- Shell Sort
- Merge Sort
Merge Sort
Which of the following is not an example of sorting a list?
- Arranging patient records alphabetically
- Arranging employee details based on beginning dates
- Arranging student records neatly on a desk
- Arranging musical instruments based on the number of strings they have
Arranging student records neatly on a desk
Which of the following sorting algorithms cannot be performed on a doubly-linked list?
Heap Sort
Given the singly-linked list (10, 20, 30, 40, 50, 60), what commands remove 10, 20, and 60, such that the final list is (30, 40, 50)?
-ListRemoveAfter(list, null) ListRemoveAfter(list, node 10) ListRemoveAfter(list, node 50)
- ListRemoveAfter(list, null) ListRemoveAfter(list, node 20) ListRemoveAfter(list, node 60)
- ListRemoveAfter(list, null) ListRemoveAfter(list, null) ListRemoveAfter(list, node 60)
- ListRemoveAfter(list, null) ListRemoveAfter(list, null) ListRemoveAfter(list, node 50)
ListRemoveAfter(list, null) ListRemoveAfter(list, node 10) ListRemoveAfter(list, node 50)
In a singly-linked list with 1 element, the tail pointer ____ and the next pointer of the head node ____.
Points to the head node, is null
Given the list Students: Tom, Harry, Sam, Kim, Tina, Hal, Sally. What will be the value of the next pointer of the node Hal if the node Sally is removed from the list?
Null
Reference of Tom
Reference of Tina
Reference of Sally
Null
In the ListInsertAfter function for singly-linked lists, the curNode parameter points to _____ node.
any existing