1. What is an advantage of a linked list over an array? A. Linked lists take up...

Question:

1. What is an advantage of a linked list over an array?
A. Linked lists take up less space per element
B. Linked lists can grow dynamically to hold individual new elements without copying existing elements
C. Linked lists are faster at finding a particular element than an array
D. Linked lists can hold structures as elements
2. Which of the following statements is true?
A. There is no reason to ever use an array
B. Linked lists and arrays have the same performance characteristics
C. Linked lists and arrays both allow constant time access to elements by index
D. It is faster to add an element into the middle of a linked list than to the middle of an array
3. When would you normally use a linked list?
A. When you only need to store one item
B. When the number of items you need to store is known at compile time
C. When you need to dynamically add and remove items
D. When you need instant access to any item in a sorted list without having to do any iteration to access it
4. Why is it OK to declare a linked list with a reference to the type of the list item? (struct Node {
Node* p_next; };)
A. This isn't allowed
B. Because the compiler is able to figure out that you don't actually need the memory for selfreferencing items
C. Because the type is a pointer, you only need enough space to hold a single pointer; the memory for the actual next node is allocated later
D. This is allowed so long as you do not actually assign p_next to point to another structure
5. Why is it important to have a NULL at the end of the linked list?
A. It's the only way to indicate where the list ends
B. It prevents the code from using uninitialized memory
C. It is a debugging aid-if you try to go too far down the list, the program will crash
D. If we don't store a NULL, then the list will need infinite memory because of the self-reference
6. How are arrays and linked lists similar?
A. Both allow you to quickly add new elements in the middle of your current list
B. Both allow you to store data sequentially and sequentially access that data
C. Both arrays and linked lists can easily grow larger by incrementally adding elements
D. Both provide fast access to every element in the list
Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Survey of Accounting

ISBN: 978-0073379555

2nd edition

Authors: Edmonds, old, Mcnair, Tsay

Question Posted: