Exam 11: Computer Science Thinking: Recursion, Searching, Sorting and Big O
Exam 1: Introduction to Computers and Python 28 Questions
Exam 2: Introduction to Python Programming 32 Questions
Exam 3: Control Statements and Program Development 20 Questions
Exam 4: Functions 18 Questions
Exam 5: Sequences: Lists and Tuples 25 Questions
Exam 6: Dictionaries and Sets 27 Questions
Exam 7: Array-Oriented Programming With Num 18 Questions
Exam 8: Strings: a Deeper Look 20 Questions
Exam 9: Files and Exceptions 30 Questions
Exam 10: Object-Oriented Programming 42 Questions
Exam 11: Computer Science Thinking: Recursion, Searching, Sorting and Big O18 Questions
Exam 12: Natural Language Processing 22 Questions
Exam 13: Data Mining Twitter 15 Questions
Exam 14: Ibm Watson and Cognitive Computing 31 Questions
Exam 15: Machine Learning: Classification, Regression and Clustering 66 Questions
Exam 16: Deep Learning 76 Questions
Exam 17: Big Data: Hadoop, Spark, Nosql and Iot 79 Questions
Select questions type
Which of the following statements a), b) or c) is false?
Free
(Multiple Choice)
4.9/5
(43)
Correct Answer:
B
What should the question mark (?) in the following for statement be replaced with, so that the statements will calculate 5!? In [1]: factorial = 1
In [2]: for number in range(5, 0, ?):
)..: factorial *= number
)..:
In [3]: factorial
Out[3]: 120
Free
(Multiple Choice)
4.9/5
(31)
Correct Answer:
C
The following fibonacci function calculates the nth Fibonacci number recursively: In [1]: def fibonacci(n):
)..: if n in (0, 1): # base cases
)..: return n
)..: else:
)..: return fibonacci(n - 1) + fibonacci(n - 2)
)..:
Which of the following statements is false?
Free
(Multiple Choice)
4.9/5
(38)
Correct Answer:
A
An algorithm that tests whether the first array element is equal to any of the other array elements requires at most n - 1 comparisons, where n is the number of array elements. Which of the following statements is false?
(Multiple Choice)
4.8/5
(36)
Which of the following statements about the binary search of an array in ascending order is false?
(Multiple Choice)
4.8/5
(38)
Which of the following statements about binary search of an array in ascending order is false?
(Multiple Choice)
4.8/5
(34)
Suppose an algorithm is designed to test whether the first element of an array is equal to the second. If the array has 10 elements, this algorithm requires one comparison. If the array has 1000 elements, it still requires only one comparison. Which of the following statements is false:
(Multiple Choice)
4.7/5
(29)
Suppose you have an algorithm that tests whether any element of an array is duplicated elsewhere in the array. The first element must be compared with all the other array elements. The second element must be compared with all the other array elements except the first (it was already compared to the first). The third element must be compared with all the other array elements except the first two. In the end, this algorithm makes (n - 1) + (n - 2) + … + 2 + 1
Or
N2/2 - n/2
Comparisons. Which of the following statements a), b) or c) is false?
(Multiple Choice)
5.0/5
(40)
The following code implements a simple linear search. In [1]: def linear_search(data, search_key):
)..: for index, value in enumerate(data):
)..: if value == search_key:
)..: return ***
)..: return -1
)..:
)..:
In the statement return ***, what should replace *** to indicate where the search key was found?
(Multiple Choice)
4.8/5
(31)
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)