Documente Academic
Documente Profesional
Documente Cultură
1.
2.
Practice Exams
3.
Announcements
Discussion Board
Syllabus
Organizer
Lecture Notes
Practice Exams
Exams
My Grades
Lacher
Virtual Office Live!
Jeremy Crook
COP 4530 (Spring 2014)
Practice Midterm Exam
2/16/14 11:06 AM
2/16/14 12:27 PM
Completed
125 out of 200 points
1 hour, 20 minutes out of 2 hours.
Instruction
s
Select a minimal set of operations that distinguish fsu::List from from other fsu::
sequential containers.
(Here i is an iterator, t is a container element, and n is an integer.)
Answer
Selected Answers:
PushBack(t)
PushFront(t)
Insert(i,t)
Correct Answers:
Insert(i,t)
Question 2
5 out of 5 points
Question 3
5 out of 5 points
PushBack(t)
PopFront()
Correct Answers:
PushBack(t)
PopFront()
Question 4
5 out of 5 points
Question 5
5 out of 5 points
Correct
Answers:
Question 6
0 out of 5 points
Selected Answer:
D E F G H
Correct Answer:
H I J A B C
Question 7
0 out of 5 points
Selected Answer:
BBDDDFFGGGHPQQQV
Correct Answer:
BBDDDFFGGGHPQQQV
Question 8
0 out of 5 points
O(n)
Correct Answer:
(log n)
Question 9
5 out of 5 points
} // end Insert((i,t))
Select the missing TWO LINES of code from the choices below.
Answer
Selected Answer:
newLink->next_->prev_ = newLink;
newLink->prev_->next_ = newLink;
Correct Answer:
newLink->next_->prev_ = newLink;
newLink->prev_->next_ = newLink;
Question 10
5 out of 5 points
Select the answer that best describes the asymptotic runtime of the operation
Deque<T>::PushBack(t)
Here t is an item of type Deque<T>::ValueType and n is the size of the vector.
Answer
Selected Answer:
Amortized O(1)
Correct Answer:
Amortized O(1)
Question 11
0 out of 5 points
Selected Answer:
[None Given]
Correct Answer:
fsu::Deque<Widget> wd;
for ( size_t i = 0 ; i < 10 ; ++i )
wd.PushFront(ZED);
Question 12
0 out of 5 points
Selected Answer:
content_[i]:
i mod 10:
A B C D E F G X I J
0 1 2 3 4 5 6 7 8 9
e
b
Correct Answer:
content_[i]:
i mod 10:
A B C D E F X H I J
0 1 2 3 4 5 6 7 8 9
e
b
Question 13
5 out of 5 points
Selected Answer:
content_[i]:
i mod 10:
A B C D E F G H I J K L
0 1 2 3 4 5 6 7 8 9 0 1
e
b
content_[i]:
i mod 10:
A B C D E F G H I J K L
0 1 2 3 4 5 6 7 8 9 0 1
e
b
Correct Answer:
Question 14
0 out of 5 points
Question 15
5 out of 5 points
Correct Answer:
Question 16
5 out of 5 points
Correct Answer:
Question 17
0 out of 5 points
Selected Answer:
link = link->next_;
Correct Answer:
link = link->prev_;
Question 18
5 out of 5 points
Selected
Answer:
Correct
Answer:
Question 19
0 out of 5 points
7
Correct Answer:
Question 20
5 out of 5 points
O(n)
Correct Answer:
O(n)
Question 21
0 out of 5 points
Selected Answer:
8
Correct Answer:
10
Question 22
5 out of 5 points
O(n)
Correct Answer:
O(n)
Question 23
5 out of 5 points
8
Correct Answer:
Question 24
5 out of 5 points
Select the answer that best describes the asymptotic runtime of the operation
fsu::Vector<T>:: bracket operator [i]
Here i is an item of type size_t and n is the size of the vector.
Answer
Selected Answer:
O(1)
Correct Answer:
O(1)
Question 25
5 out of 5 points
Selected
Answer:
Correct Answer:
Question 26
5 out of 5 points
Select the answer that best describes the asymptotic runtime of the operation
fsu::Vector<T>:: Destructor
Here n is the size of the vector.
Answer
Selected Answer:
(n)
Correct Answer:
(n)
Question 27
0 out of 5 points
stack -->
--------1
1 2
1 2 3
1 2 3 5
1 2 3 5 4
1 2 3 5 4
1 2 3 5 4
1 2 3 5 4
1 2 3 5 4
1 2 3 5 4
1 2 3 5 4
Correct Answer:
stack -->
--------1
1 2
1 2 3
1 5
1 5 4
1 5 4 5
5
5
5
5
5
5
6
6
6
6
6
11
11 44
11 44 49
11 44 49 50
1 5 9
1 45
1 45 6
1 51
52
Question 28
0 out of 5 points
Select the answer that best describes the asymptotic runtime of the operation
fsu::List<T>::Remove(t)
Here t is an item of type fsu::List::ValueType and n is the size of the list.
Answer
Selected Answer:
O(n)
Correct Answer:
(n)
Question 29
5 out of 5 points
Selected
Answer:
Correct
Answer:
Question 30
0 out of 5 points
F
Correct Answer:
Question 31
5 out of 5 points
False
Correct Answer:
False
Question 32
0 out of 5 points
Selected Answer:
False
Correct Answer:
True
Question 33
5 out of 5 points
True
Correct Answer:
True
Question 34
5 out of 5 points
Selected Answer:
True
Correct Answer:
True
Question 35
5 out of 5 points
AssociativeArray::KeyType::Iterator i;
for (i = KeyType::Begin(); i != KeyType::End(); ++i)
std::cout << i << " : " << aa[i] << '\n';
Answer
Selected Answer:
False
Correct Answer:
False
Question 36
5 out of 5 points
False
Correct Answer:
False
Question 37
5 out of 5 points
AssociativeArray::Iterator i;
for (i = aa.Begin(); i != aa.End(); ++i)
std::cout << *i.key_ << " : " << *i.data_ << '\n';
Answer
Selected Answer:
True
Correct Answer:
True
Question 38
5 out of 5 points
False
Correct Answer:
False
Question 39
5 out of 5 points
Selected Answer:
True
Correct Answer:
True
Question 40
0 out of 5 points
Answer
Selected Answer:
True
Correct Answer:
False