For an assignment you wrote the method sortByLargestDepth in the class QuakeSortInPlace to sort earthquakes by their depth from largest depth to smallest depth using the selection sort algorithm. Modify this method to do exactly 50 passes and then modify testSort to run this method on the file earthQuakeDataDec6sample2.atom. The file may not be completely sorted as there are more than 50 quakes in the file. After running your program of 50 Selection sort passes on this file, what is the depth of the last earthquake in the ArrayList?
In: Computer Science
Quiz
Question 1 (1 point)
What characteristic of WLAN makes it vulnerable to a different set of attacks from wired LANs?
Question 1 options:
WLAN often is connected to a wired LAN |
|
It's difficult to effectively contain the radio signals. |
|
WLAN is very difficult to setup and manage |
|
None of above |
Question 2 (1 point)
Which of the following can be categorized an integrity attack to a WLAN?
Question 2 options:
War driving |
|
Denial of service |
|
802.11 Frame Injection |
|
Radio frequency jamming |
Question 3 (1 point)
Which of following is (are) vulnerability (ies) of Bluetooth technology?
Question 3 options:
Encryption key length is negotiable |
|
No user authentication exists |
|
End-to-end security isn't performed |
|
All of above |
Question 4 (1 point)
Which of following is (are) the problem(s) of WEP?
Question 4 options:
Use 40 or 104 bits keys that are static and common to all users |
|
The encryption algorithm RC4 used in WEP is flawed |
|
The IV is 24bits which is too short |
|
All of above |
Question 5 (1 point)
In Bluetooth ________, the authentication and encryption are completely bypassed.
Question 5 options:
security mode 1 |
|
security mode 2 |
|
security mode 3 |
|
security mode 4 |
Question 6 (1 point)
VLAN creates LAN workgroups that are independent of physical locations.
Question 6 options:
True |
|
False |
Question 7 (1 point)
Which of the following is(are) common goal(s) of wireless security policy?
Question 7 options:
Identify required security practices and measures |
|
Dictate acceptable behavior and enforcement |
|
Serving as a vehicel for achieving consensus |
|
All of above |
Question 8 (1 point)
Which of the following is the most effective way to protect your wireless network
Question 8 options:
SSID cloaking |
|
MAC filitering |
|
Reducing the AP power level |
|
Using WPA2 security standard |
Question 9 (1 point)
____________ outlines the security concepts that are important to the company for managers and technical custodians.
Question 9 options:
Governing policy |
|
End-user policy |
|
Technical policy |
|
None of above |
Question 10 (1 point)
Which of following statement about VPN is FALSE?
Question 10 options:
It extends a private network across a public network. |
|
It can authenticate user |
|
It protects the data being transmitted using encryption |
|
VPN is very easy to deploy and manage |
In: Computer Science
C++
Write a program to declare an array of double of size 25, ask
the user to input all array elements from the keyboard, then write
a function named out_of_order that will test this array for the
condition a[0] >= a[1] >= a[2] >= ... > a[24]
The function returns a -1 if the elements are not out of order,
otherwise it returns the index of the first element that is out of
order. Explain what you do to avoid out of bounds array access.
In: Computer Science
Hello, I am using BASH. I need to write a conditional statement using grep. I want the computer to echo true if it detects any numerical character in the first line of StrepList.txt. However, the computer tells me that "grep: [0-9]: No such file or directory"
if (head -n 1 StrepList.txt | grep -o [0-9] -eq TRUE);then
echo "Contains numbers"
else
echo "No numbers"
fi
In: Computer Science
Using C# Design and implement a program (name it CheckPoint) that prompts the user to enter the x-coordinate then y-coordinate of a point (in a Cartesian plane) as integer values. The program prints out the entered values followed by the location of the point on the plane. The possibilities for a point are: the origin point, on the x-axis, on the y-axis, in the first quadrant, in the second quadrant, in the third quadrant, or in the fourth quadrant. Format the outputs following the sample runs below.
Sample run 1:
X-coordinate is 0
Y-coordinate is 0
(0, 0) is the origin point.
In: Computer Science
1. Introduction
This assignment will give you some experience working with C input (using scanf()) and output (using printf()), as well as arithmetic operations with variables. You will do some very basic circuit analysis, reading the values of a voltage source and three resistors, and calculating the voltage across and current through each of the resistors using three different circuit configurations.
Test cases for the program can be found at this link.
Remember, in addition to submitting your code, you MUST complete the Blackboard assignment "Program 2 style assessment" to get all of the points for this program. You can complete this "assignment" by typing a short message indicating you submitted your code through the textbook IDE.
2. Specification
Note that this specification refers to several figures, which can be found at the following link: Program 2 figures
In this program, you will deal with the three resistive circuits in Figure 1: a series circuit, a parallel circuit, and a circuit using resistors both in series and in parallel.
Those of you who are familiar with basic DC circuit analysis should be able to easily derive the voltage across and current through each resistor. For more details and equations, please see the Circuit Analysis Supplement in the Program 2 figures document.
Input Specification
Your program should prompt the user to enter the values of Vsource (in volts) and R1, R2, and R3 (in ohms). The source voltage should be entered on one line, while all three resistance values should be entered on a second line. (Note: remember, scanf() ignores whitespace when scanning numbers—you do not have to explicitly worry about varying numbers of spaces.)
The program could produce the first two lines below (the numbers are user inputs, not program outputs):
Enter voltage source value (V): 10 Enter three resistance values (ohms): 5 10 10
All input values should be treated as double-precision floating point values.
Output Specification
Once the voltage and resistance values have been read, you should print the following information for each circuit, as shown below:
See the Circuit Analysis Supplement in the Program 2 figures document for more details on determining the appropriate voltage and current through each resistor if you are unfamiliar with the analysis used. The output lines that would follow the example shown above would be:
SERIES CIRCUIT Current through circuit: 0.400000 A Voltage across R1: 2.000000 V Voltage across R2: 4.000000 V Voltage across R3: 4.000000 V PARALLEL CIRCUIT Voltage across each resistor: 10.000000 V Current through R1: 2.000000 A Current through R2: 1.000000 A Current through R3: 1.000000 A R2 & R3 IN PARALLEL Voltage across R1: 5.000000 V Current through R1: 1.000000 A Voltage across R2: 5.000000 V Current through R2: 0.500000 A Voltage across R3: 5.000000 V Current through R3: 0.500000 A
See the posted test cases for more sample program runs.
3. Hints
Order of operations
C operators follow the same order of operations you likely learned for basic arithmetic operations—multiplication and division take precedence over addition and subtraction. Parentheses have higher precedence than any of these operators. So, for example, if x = 5, y = 2, and z = 3:
Variables and expressions
Variables should be used to store values that are used more than once to avoid repeating calculations. For example, you could improve the following code by creating a variable to hold the value a + 2:
x = (a + 2) * 3; y = 5 / (a + 2); z = (a + 2) – (a + 2);
Values used only for output do not need variables, since printf() can print the value of any expression. Each of the following lines is therefore a valid use of this function. Assume you have variables int n and double x:
4. Grading Rubric
For this assignment, points are assigned as follows:
40 points: Your code uses appropriate coding style such as including appropriate comments, indenting the main() function body, and appropriate variable declarations. You must complete the Blackboard assignment "Program 2 style assessment" to earn any of these points.
60 points: Your code compiles and output matches the
desired test outputs shown below. Each test case has a different
number of points assigned to it, as shown in submit mode.
This section will be auto-graded, while I will assign the other
40 points after inspecting your program.
In: Computer Science
write a two-to-three-page paper describing cyberwarfare and ways our government protects our own national infrastructure.
In: Computer Science
Write down a C program which will create a list (simple linear linked list) of nodes. Each node consists of two fields. The first field is a pointer to a structure that contains a student id (integer) and a grade-point average (float). The second field is a link. The data are to be read from a text file. Your program should read a file of 10 students (with student id and grade point average) and test the function you wrote (by printing student’s information on screen). (Please comment the codes)
In: Computer Science
You have been asked to build a database for a pet foster and adoption shelter. The agency is a non-profit that takes in stray or abandoned pets and places them with foster care givers until the pet is adopted. Foster care givers are volunteers, though they must first be screened. The database needs to track all animals in its care, their species, breed, name and condition. It also needs to track all approved foster care givers and which animals are currently in their care. Foster care givers are also supposed to turn in monthly reports on the animals in their care. The database also needs to track the adoptions of the animals. Currently, volunteers come into the shelter and fill out a paper form. After a background check they are added to a file. Some volunteers complain that they are never contacted again. The shelter staff admits, they tend to go with foster care givers they know and some people get forgotten in the file. The shelter has also occasionally lost track of an animal in foster care when the care giver failed to turn in the monthly reports. Another recurring problem is that when someone comes into the shelter looking to adopt, it is not always easy or even possible to let them know about all the animals available for adoption. Ideally the shelter would like people to be able to register as a volunteer on-line. They would like to be able to call up a list of all available foster volunteers. They also would be like to be able to pull up all the animals of the kind a potential adopter is interested in and know exactly where those animals are and who is caring for them.
Would animals be stakeholders in this database? Explain why or
why not.
What might be some of the shelter database security issues?
In: Computer Science
#include<iostream>
#include<string>
#include<fstream>
#include<vector>
/*HW: Create two more functions,
Modify the posted grade example that uses dynamic arrays and file I/O to include the following:
-Use vectors
-read from values from the file and store them in the vector.
Modify the function getGrades
Extend the program to also include the following features:
-A menu option that allows the user to add more students and
there grades. Assume the number of quizzes stay the same based on
the value read from the file
-A menu option that allows the user to display all students that
were added and their grades. As well as, the average of the quizzes
and the average of the student
-A menu option to search for a student by ID, the program must
display the student ID, and the student grades
-An option to exit.
Make sure the new students added to the vector are stored in the original file that you read from. Hence, if you exit the program and run it again, the new students added will show in your new run of the program.*/
using namespace std;
//Don't forget to pass sid and grade by reference
void getGrades(ifstream &fin, vector<string> &sid, vector<vector<double>> &grade, int num_stud, int NUM_Q)
{
for (int i = 0; i<num_stud; i++)
{
string tempId;
double sgradetemp;
fin >> tempId;
sid.push_back(tempId);
vector<double>sgradetempv;
fin >> sid[i];
for (int j = 0; j < NUM_Q; j++)
{
fin >> sgradetemp;
//Vector of values
sgradetempv.push_back (sgradetemp);
}
//Vector of a vector
grade.push_back(sgradetempv);
}
}
void compute_st_ave(vector<vector<double>> grade, vector<double> &st_ave, int num_stud, int NUM_Q)
{
for (int s = 0; s<num_stud; s++)
{
double sum = 0;
for (int q = 0; q<NUM_Q; q++)
{
sum = sum + grade[s][q];
}
st_ave.push_back (s = sum / NUM_Q);
}
}
void compute_q_ave(vector<vector<double>>grade, vector<double>quiz_ave, int num_stud, int NUM_Q)
{
for (int q = 0; q<NUM_Q; q++)
{
double sum = 0;
for (int s = 0; s<num_stud; s++)
{
sum = sum + grade[s][q];
}
quiz_ave.push_back(q = sum / num_stud);
}
}
void saveToFile(vector<string> sid, vector<vector<double>>grade, vector<double>st_ave, vector<double>quiz_ave, int num_stud, int NUM_Q)
{
ofstream fout("results.txt");
fout << "Dispalying the results" << endl;
fout << "\t\t\t\tAverage" << "\t\t" << "Quizzes\n";
for (int s = 0; s<num_stud; s++)
{
fout << "Student " << sid[s] << ":\t" << st_ave[s] << " \t\t";
for (int q = 0; q<NUM_Q; q++)
{
fout << grade[s][q] << "\t";
}
fout << endl;
}
fout << "Quiz Average: \t\t\t";
for (int q = 0; q<NUM_Q; q++)
{
fout << "\t" << quiz_ave[q] << " ";
}
fout << endl;
fout.flush();
fout.close();
}
int main()
{
int NUM_STUD, NUM_Q;
ifstream fin("grades.txt");
fin >> NUM_STUD >> NUM_Q;
/*
string *sid = new string[NUM_STUD];
double **grade = new double *[NUM_STUD];
for (int i = 0; i < NUM_STUD; i++)
{
grade[i] = new double[NUM_Q];
}
double *st_ave = new double[NUM_STUD];
double *quiz_ave = new double[NUM_Q];
*/
vector<string>sid;
vector<vector<double>>grade;
vector<double> st_ave;
vector<double>quize_ave;
getGrades(fin, sid, grade, NUM_STUD, NUM_Q);
compute_st_ave(grade, st_ave, NUM_STUD, NUM_Q);
compute_q_ave(grade, quiz_ave, NUM_STUD, NUM_Q);
saveToFile(sid, grade, st_ave, quiz_ave, NUM_STUD, NUM_Q);
fin.close();
system("pause");
return 0;
}
In: Computer Science
Test Your Understanding
Create a JAVA package by name ClassEx2 and in the main() method
of
the class, assign your name to a String object and your father name
to a
different String object and do the following;
Concatenate your name and your father name.
Get the length of your full name.
Find the index of any character in your full name.
Replace the occurrence of any lower case character in your
full
name to capital character.
Compare your first name with your father name , display
message
indicating which name is first lexicographically.
In: Computer Science
In Python write a function that simulates the throwing of any even numbered dice which will be passed on as a parameter: customDice(sides). The function will return a random number rolled for that particular type of dice. Write the program that will utilize the customDice function with the following specification: Ask the user to pick which even-sided dice to use. The program will then roll the dice twice. If the total of both rolls is greater than the number of die sides+1, then they lose. If not, they win. Write statements that prompt the user for the type of dice to use, print the value from the two rolls and a message whether they win or lose. If the user enters an odd number, ask for the input again.
Sample dialogs:
Please choose an even-sided dice: 3
Sorry, it must be an even-sided dice.
Please choose an even-sided dice: 10
Roll 1: 3
Roll 2: 10
Total: 13
You lose (13 > 11)!
Please choose an even-sided dice: 8
Roll 1: 3
Roll 2: 2
Total: 5
You win (5 < 9)!
In: Computer Science
Consider a circuit-switching scenario in which Ncs users, must share a link of capacity 150 Mbps. Each user alternates between periods of activity when the user generates data at a constant rate of 20 Mbps and periods of inactivity when he generates no data. Suppose further that he is active only 20% of the time. Assume a circuit switched TDM. What is the maximum number of circuit-switched users that can be supported? Assume packet switching is used for the remaining parts of this question. Suppose there are 13 packet- switching users (i.e., Nps = 13). Can this many users be supported under circuit-switching? Explain. What is the probability that a given (specific) user is transmitting, and the remaining users are not transmitting? What is the probability that one user (any one among the 13 users) is transmitting, and the remaining users are not transmitting? When one user is transmitting, what fraction of the link capacity will be used by this user? What is the probability that any 7 users (of the total 13 users) are transmitting and the remaining users are not transmitting? (Hint: you will need to use the binomial distribution.) What is the probability that more than 7 users are transmitting? Comment on what this implies about the number of users supportable under circuit switching and packet switching. What is the probability that more than 7 users are transmitting? Comment on what this implies about the number of users supportable under circuit switching and packet switching.
In: Computer Science
I am struggling to write a python script that
calculates the average length ,max length shortest length and
overall average length of of a snake and ladder game. I use python
3
The length is the number the dice is rolled until the max is
reached
We need a python script that calculates the number of moves it will take for a single player to reach 100. We have to simulate a snake and ladder game using python language. So one person plays the game several times and will compare the number of moves per each played game for us to be able to come up with the required data
In: Computer Science
describe and discuss the Software Development Life Cycle as it relates to creating software that will calculate the totals and dispense change for a cash register at a local grocery store
In: Computer Science