![]() CATEGORIES: BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism |
Data structures can also be complex in that they can contain other data structuresA data structure can be composed of simple pieces of data.
} Which of the following is (are) true about the linear data structure known as a stack?
(a) I only
} Consider the following C++ program segment. int cpp_array[10]; for(int i=0; i<10; i++) { cpp_array[i] = i; } Which of the following lines of code can be used to output the third element of the array cpp_array?
(a) cout << cpp_array(3);
} Which of the following is (are) true regarding the linear-search algorithm?
(a) I and II only
• the main advantage of a linear search is that it does not require sorted data. Even if the data contained in a data set is stored in random order, a linear search still works as expected. • The main disadvantage of a linear search is its suitability for only small data sets. • The STL find() function performs a linear search on a container.
} Which of the following is (are) true about the nodes in a tree data structure?
(a) I and III only
} Which of the following is (are) true about the C++ Standard Template Library (STL)?
(a) I only
vector<int> v;for (int i = 0; i < 10; i++) { v.push_back(i); } ostream_iterator<int> out(cout, "\n");copy(v.rbegin(), v.rend(), out);
Functions rbegin and rend return iterators to the last element and one position before the first element, respectively.
} The weighted path length for a path in a graph is the (a) number of edges in the path
} Which of the following can be used to instantiate a C++ template class?
(a) None
} Which of the following lines of C++ code begins a preprocessing directive for declaring a macro? (a) #endif
} Which of the following indicates complexity functions listed in order of increasing growth rates? (a) Quadratic, cubic, N log N D – is true
} Algorithms that run in _____ time typically perform fewer operations than algorithms that run in _____ time. (a) logarithmic, linear
} Consider the following C++ definition of a recursive function func. int func (int n) { if (n <= 0) return 1; return n * func(n-2); } } Execution of the recursive function func will terminate (a) only for even values of n } Which of the following is (are) true about the sorting algorithm quicksort? ◦ I. Quicksort is typically implemented using recursion. ◦ II. Implementing an efficient quicksort algorithm involves selecting the element with the least value as the pivot. (a) None
} In C++, the term type checking refers to (a) syntax errors being identified during compilation
} In C++, output involves moving a sequence of _____ from a program to a device. This flow is commonly referred to as a _____. (a) strings, stream
} Consider implementing a program that is used to select an optimal move in a game. A common approach is to explore all possibilities recursively by implementing a _____ algorithm. (a) backtracking
} In C++, a child class can pass a parameter to the constructor of its parent class (a) by invoking the appropriate constructor in the initializer list
} What is the maximum depth of any node in a balanced binary tree containing 16 nodes? (a) 16
Date: 2016-01-05; view: 742
|