

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A series of questions and answers related to data structures and algorithms, covering topics such as linear data structures (arrays, lists, stacks, queues), data structure definitions, primitive data structures, linked lists, time and space complexities, sorting algorithms (bubble sort), fibonacci numbers, solution costs, algorithm efficiency, linear search, data abstraction, binary search, cryptanalysis, conditional structures (if...then...else), recursive functions, greatest common divisor, and disadvantages of list, array, and queue data structures. It also includes questions requiring short explanations of iterative control structures, algorithm evaluation, and greedy algorithms. This material is useful for students studying computer science and preparing for exams on data structures and algorithms.
Typology: Exams
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Which of the following are the linear data structures? - Correct Answers -arrays, lists, stack, and queues Which of these is a collection of data values and the categorization of the relationships among them, making it an efficient way of organizing and sorting data within the computer? - Correct Answers -data structure Which of the following stores only one type of data in a specific location and must contain some value, meaning it cannot be null? - Correct Answers -primitive data structure The programming team knows they need to create a program that will use a linear data structure to complete large amounts of data manipulation very quickly. Which data structure is most appropriate? - Correct Answers -linked list Determine the time and space complexities of a linear search. - Correct Answers -time complexity: O(n) space complexity O(n) Suppose you are examining a set of raw medical data that includes the side effects of a specific drug. You are interested in finding out which side effects occur the most often. What would be an appropriate algorithm to find this data? - Correct Answers -bubble sort Students are discussing variations of algorithms to find Fibonacci numbers, like fib(6). What is the best possible time complexity that they can get for this algorithm? - Correct Answers -O(n^2) Which of these are the costs associated with finding a desired solution to a problem? - Correct Answers -solution costs Which of the following is a true statement? - Correct Answers -The efficiency of an algorithm measures the amount of resources it needs.
Why is it preferable to use a linear search when searching smaller datasets? - Correct Answers -A linear search is easy to implement and faster than other algorithms when searching smaller datasets. In creating a model for a data abstraction for the concept of a pen, what would be the most appropriate attributes? - Correct Answers -type and color Two students are discussing the best algorithm to use to see if a specific element is in a sorted data set. Which classic algorithm should they choose? - Correct Answers -binary search Which of the following best describes cryptanalysis? - Correct Answers -Cryptanalysis is the statistical analysis of codes, ciphers, or encrypted text with the intent of decrypting encoded messages. Suppose you are writing a program that requires you take different paths depending on the response to a prompt. The prompt has more than two acceptable responses. Which of the following structures would be most appropriate? - Correct Answers -if...then...else For the recursive factorial function output shown below, which lines of output would reflect the backward phase? - Correct Answers -4,5, How could the code be altered to print the sum of the first 6 terms in the sequence, 7n + 1? - Correct Answers -def sum(n): if n == 0: return 0 else: return 7 * n + 1 + sum(n - 1) result = sum(6) print(result) What is the output of the greatest common divisor function gcd (27, 12)? - Correct Answers - In 3-5 sentences, describe one disadvantage each for list, array, and queue data structures. - Correct Answers -shouldnt be too hard In 1-2 sentences, explain the purpose and outcome of the iterative control structure. - Correct Answers -HCF Evaluate the following algorithms in terms of its efficiency, correctness, and clarity. Explain your answer in 3-5 sentences. - Correct Answers -talk about the efficiency and correctness In 3-5 sentences, explain the algorithm. - Correct Answers -countdown