Question 13 pts
(TCO 4) Which of the following functions grows at a slower rate than the rest?
| n2 |
| n |
| log n |
| n3 |
Flag this Question
Question 23 pts
(TCO 4) Algorithms can be described using
| pseudo-code. |
| assignment and arithmetic operations. |
| loops and decision statements. |
| All of the above |
Flag this Question
Question 33 pts
(TCO 4) The running time of an algorithm is
| the time, in milliseconds, it takes to complete its execution. |
| the running time of its implementation. |
| the maximum number of basic operations executed by the algorithm (over all inputs of size N). |
| the number of steps given in its description. |
Flag this Question
Question 43 pts
(TCO 4) The following function returns the _____ of the array
elements.
int mystery(int a[], int
n)
{
int x=a[0];
for (int i=1; i<n; i++)
if (x > a[i]) x = a[i];
return x;
}
| maximum |
| minimum |
| middle element |
| sum |
Flag this Question
Question 53 pts
(TCO 4) Consider the recursive function below.
int RecFunction(int n)
{
if (n==0) return 0;
else return RecFunction(n-1) + n;
}
What is the output in the statement cout << RecFunction(3);
?
| 2 |
| 4 |
| 6 |
| 8 |
Flag this Question
Question 63 pts
(TCO 4) Consider the function below.
long x(int n)
{
if (n == 1) return 1;
else return n*x(n-1);
}
What will be displayed by the cout statement
cout << x(3) << endl; ?
| 720 |
| 25 |
| 6 |
| 1 |
Flag this Question
Question 73 pts
(TCO 4) The running time of bubble sort is _____.
| O(n log n) |
| O(log n) |
| O(n) |
| O(n2) |
Flag this Question
Question 83 pts
(TCO 4) A method that performs very well in practice, even though its worst-case running time is quadratic, is _____.
| bubble sort |
| insertion sort |
| mergesort |
| quicksort |
Flag this Question
Question 93 pts
(TCO 4) The running time of an algorithm to find the maximum of a collection of n numbers stored in an array is
| O(n2). |
| O(n log n). |
| O(n). |
| O(1). |
Flag this Question
Question 103 pts
(TCO 8) In C++ STL, use the function _____ to obtain an iterator pointing to the smallest value of the elements in a given range.
| sort |
| min_element |
| max_element |
| lower_bound |
Q1) logn
Q2) pseudo-code (Because just by using assignment and arithmetic operations or loops and decision statements we can't describe an algorthm)
Q3) the maximum number of basic operations executed by the algorithm (over all inputs of size N).
Q4) maximum
Q5) 6
Q6) 6
Q7) O(n2)
Q8) insertion sort
Q9) O(n)
Q10) min_element
Question 13 pts (TCO 4) Which of the following functions grows at a slower rate than...
Question 216 pts (TCO 2) In order to guarantee that only one JRadioButton is selected at any time, _____. add each JRadioButton object to a different panel create a ButtonGroup object and add the JRadioBttons to it have a JCheckBox object manage the three JRadioButtons This cannot be done in Java. Flag this Question Question 226 pts (TCO 2) Which Java interface would you need to implement in order to handle events such as key-pressed or key-released events? KeyListener interface...
Question 23 pts (TCO 2, 4) Usually, running an Nmap scan in a slow mode will avoid Group of answer choices detection. false negative. false positive. reduced collision. Flag this Question Question 33 pts (TCO 2, 4) A(n) _____ is designed to detect anomalies such as malware with an application. Group of answer choices NIDS HIDS Honeypot Firewall Flag this Question Question 43 pts (TCO 2, 4) Snort is considered which of the following? Group of answer choices HIPS NIPS...
This is an assignment for my algorithm class which I have written the code partially and only need to complete it by adding a time function that calculates the average running time. We could use any programming language we want so I am using C++. I am including the instruction and my partial code below. Thank you! Implement linearSearch(a,key) and binarySearch( a,key)functions. Part A.In this part we will calculate theaverage-case running time of each function.1.Request the user to enter a...
Question 4 1 pts Here is an array which has just been partitioned by the first step of quicksort: 3, 0, 2, 1, 7,. 15. 11, 20, 13 Which of these elements was the pivot? 0 7 0 1 o 20 O 15 Question 5 1 pts Running merge sort on an array of size n which is already sorted is O(n2) O O(n log n O Ollog n
JAVA 3 PLEASE ANSWER AS MANY QUESTIONS AS POSSIBLE! ONLY 2 QUESTIONS LEFT THIS MONTH!!! Question 12 pts Which is a valid constructor for Thread? Thread ( Runnable r, int priority ); Thread ( Runnable r, String name ); Thread ( int priority ); Thread ( Runnable r, ThreadGroup g ); Flag this Question Question 22 pts What method in the Thread class is responsible for pausing a thread for a specific amount of milliseconds? pause(). sleep(). hang(). kill(). Flag...
Question 116 pts (TCO 2) What is the output of the following code? void func(int x) { x = x * 2; } int main( ) { int x = 10; func(x); cout << x << endl; } 20 30 10 5 Question 126 pts (TCO 2) A derived class is typically an example of _____. a “has a” relationship an “is a” relationship a “uses a” relationship an “is used” relationship Question...
In this lab we are going to complete a profile of two sorting algorithms by running some tests to collect empirical data. 1. First we need to be able to generate some random integers. You can do this by including the following library : #include Now first run the following to generate a seed : srand (time(NULL)) You can then generate a random number using the function rand() 2. We will use two sort algorithms - Selection Sort and Bubble...
Please answer ASAP Thank You 1Consider an algorithm that requires the following number of operations (time units) for these input sizes (n). The algorithm is ___________ . Input size Operations 100 100,000 400 100,000 1600 100,000 Group of answer choices 1.O(n2) 2.O(n) 3.O(log n) 4.O(n3) 5.O(1) 2The below algorithm contains nested loops. for (int total = 1; total <= n; total++) { for (int samples = 0; samples < n; samples++) { for (int location = 1; location < 10;...
Question 19 4 pts Using the program below, please complete the program by adding 2 functions as follow: 1. A function named getAverage that calculates and returns the Average. 2. A function named getMaximum that returns the maximum of the three numbers. Make sure to use the proper data types for all variables and functions. #include <iostream> using namespace std; //function getAverage //function getMaximum int main(int argc, char** argv) { int x, y, z; cout << "Enter three whole numbers:...
Which of the following terms is NOT associated with a stack? push top get bottom Flag this Question Question 21 pts Which of the following terms is NOT associated with a queue? add front FIFO enqueue pop Flag this Question Question 31 pts A stack exhibits what kind of behavior? Last In, First Out (LIFO) First In, First Out (FIFO) Last In, Last Out (LILO) Read-Only Write-Only Flag this Question Question 41 pts What are the final contents of myQueue...