CSE 205 COMPLETE TEST BANK QUESTIONS
AND VERIFIED CORRECT ANSWERS
●● Which of the following scenarios would cause a
NullPointerException when working with linked lists? (Select all that
apply)
1. Accessing head.data when the list is empty
2. Setting temp.next = null when temp is null.
3. Iterating through the list while checking for null references.
4. Adding a new node without initializing the head.
Answer: 1, 2
●● Given the following declaration: int[] values = {1,3,5,0,2,8,7,2,5,2};
Evaluate the following expression: values[values[5]]
Answer: 5
●● What is the Big O run time complexity for retrieving the value at a
given index in a linked list?
1. O(n) linear
2. O(1) constant
,3. O(log n) logarithmic
4. O(2^n) exponential
5. None of these
Answer: 1
●● What is the Big O run time complexity for retrieving the value at a
given index in a stack?
1. O(n) linear
2. O(1) constant
3. O(log n) logarithmic
4. O(2^n) exponential
5. None of these
Answer: 1
●● What is the Big O run time complexity for removing the first value
in a queue?
1. O(n) linear
2. O(1) constant
3. O(log n) logarithmic
4. O(2^n) exponential
5. None of these
,Answer: 2
●● What is the Big O run time complexity for removing the top value in
a stack?
1. O(n) linear
2. O(1) constant
3. O(log n) logarithmic
4. O(2^n) exponential
5. None of these
Answer: 2
●● Which of the following would have a exponential Big O run-time
complexity?
1. Computing the area of a circle given the radius
2. Determining if two logical statements are equivalent by brute force
3. Finding the phone number in a phone book, given a person's name
4. Deleting a value from an ArrayList
5. none of these
Answer: 2
, ●● Which of the following would have a logarithmic Big O run-time
complexity?
1. Determine if two logical statements are equivalent by brute force
2. Compute the area of a circle given the radius
3. Delete a value from an ArrayList
4. Find the phone number in a phone book, given a person's name
5. none of these
Answer: 4
●● Which of the following run-time complexity orders is best?
1. O(log n) Logarithmic time
2. none of these
3. O(n) Linear time
4. O(2^n) Exponential
Answer: 1
●● Which of the following run-time complexity orders is worst?
1. O(n) Linear time
2. O(log n) Logarithmic time
AND VERIFIED CORRECT ANSWERS
●● Which of the following scenarios would cause a
NullPointerException when working with linked lists? (Select all that
apply)
1. Accessing head.data when the list is empty
2. Setting temp.next = null when temp is null.
3. Iterating through the list while checking for null references.
4. Adding a new node without initializing the head.
Answer: 1, 2
●● Given the following declaration: int[] values = {1,3,5,0,2,8,7,2,5,2};
Evaluate the following expression: values[values[5]]
Answer: 5
●● What is the Big O run time complexity for retrieving the value at a
given index in a linked list?
1. O(n) linear
2. O(1) constant
,3. O(log n) logarithmic
4. O(2^n) exponential
5. None of these
Answer: 1
●● What is the Big O run time complexity for retrieving the value at a
given index in a stack?
1. O(n) linear
2. O(1) constant
3. O(log n) logarithmic
4. O(2^n) exponential
5. None of these
Answer: 1
●● What is the Big O run time complexity for removing the first value
in a queue?
1. O(n) linear
2. O(1) constant
3. O(log n) logarithmic
4. O(2^n) exponential
5. None of these
,Answer: 2
●● What is the Big O run time complexity for removing the top value in
a stack?
1. O(n) linear
2. O(1) constant
3. O(log n) logarithmic
4. O(2^n) exponential
5. None of these
Answer: 2
●● Which of the following would have a exponential Big O run-time
complexity?
1. Computing the area of a circle given the radius
2. Determining if two logical statements are equivalent by brute force
3. Finding the phone number in a phone book, given a person's name
4. Deleting a value from an ArrayList
5. none of these
Answer: 2
, ●● Which of the following would have a logarithmic Big O run-time
complexity?
1. Determine if two logical statements are equivalent by brute force
2. Compute the area of a circle given the radius
3. Delete a value from an ArrayList
4. Find the phone number in a phone book, given a person's name
5. none of these
Answer: 4
●● Which of the following run-time complexity orders is best?
1. O(log n) Logarithmic time
2. none of these
3. O(n) Linear time
4. O(2^n) Exponential
Answer: 1
●● Which of the following run-time complexity orders is worst?
1. O(n) Linear time
2. O(log n) Logarithmic time