Questions
Q1: Server Design Models: (explain clearly) a. For a multi-threaded server, describe the advantages of adopting...

Q1: Server Design Models: (explain clearly) a. For a multi-threaded server, describe the advantages of adopting the many-to-one threading model. b. For a multi-threaded server, describe the advantages of adopting the one-to-one threading model.

In: Computer Science

Write a C++ code that keeps reading integer numbers (x) until a negative number is entered....

Write a C++ code that keeps reading integer numbers (x) until a negative number is entered. Every time x is entered, the program does the following: calculates and prints the product of odd numbers. calculates and prints the count of numbers that ends with 19. Example, 19, 3219, 50619,....etc calculates and prints the percentage of the numbers that contain 3 digits exactly, such as, 301, 500, 206,...etc.

In: Computer Science

6.2_What is the meaning of the term busy waiting? What other kinds of waiting are there...

6.2_What is the meaning of the term busy waiting? What other kinds of waiting are there in an operating system? Can busy waiting be avoided altogether? Explain your answer.

7.4_Describe how deadlock is possible with the dining-philosophers problem.

Why is it necessary to have an atomic instruction for providing access to a critical section?

In: Computer Science

Describe a scenario in which an access point impersonation attack could be used to steal personal...

Describe a scenario in which an access point impersonation attack could be used to steal personal financial information.

In: Computer Science

Describe in detail the intrusion detection and prevention measures that you will deploy in your organization....

Describe in detail the intrusion detection and prevention measures that you will deploy in your organization. Your discussion should also include the following:

Describe in detail the intrusion detection and prevention measures that you will deploy in your organization. Your discussion should also include the following:

[T3.1] IDS type and why you will need it

[T3.2] IPS type and why you will need it

[T3.3] The proposal of the appropriate positions for IDS/IPS in a network topology in order to increase the security of the environment,

along with providing supportive justifications of the proposed positions.

In: Computer Science

1. Write a queue client, "LineNum," that takes an integer command line argument “n” and prints...

1. Write a queue client, "LineNum," that takes an integer command line argument “n” and prints the nth string from the first string found on standard input. [MO6.2]

Please note that you would need to use a queue to implement it for full credit. You should add the strings inputted by the user to a queue using the enqueue method. Then you should remove and return "n" strings from the queue using the dequeue method. The nth string that is returned by the dequeue method should then be printed out.

  • Sample runs would be as follows.

    >java LineNum 2
    apple
    save
    that
    is
    too
    me
    <CTRL-D>
    2 from the first is save

    >java LineNum 3
    this
    is
    not
    a
    shorter
    version
    <CTRL-D>
    3 from the first is not

This is the code I have, but i keep getting errors.

public class LineNum { // public class LineNum
public static void main(String[] args) { // main method
int n = Integer.parseInt(args[0]); // variable n parses integers from args
Queue<String> queue = new Queue<String>(); // new String queue
//LinkedList<java.lang.String> Dequeue = new LinkedList();
while (!StdIn.isEmpty()) { // while standard input is empty
String item = StdIn.readString();
// String item read string from standard input
if (!item.equals("-")) // if item equal - then ebqueue item
queue.enqueue(item);
else if (!queue.isEmpty()) // otherwise if queue is empty
StdOut.println(queue.dequeue() + " "); // print dequeue + a space
}
  
StdOut.println(queue);
for (int i = 1; i < n; i++) // for loop i=1, <n, increments i
queue.dequeue(); // dequeues element on each loop until i = n
// StdOut.print(queue.size() + " left on queue)");
// StdOut.println("The dequeue contains: " +queue.dequeue() + " ");
StdOut.println(n+ " from the first is " +queue.dequeue());
// Prints number from first and current element in dequeue
  
}
}
these are the errors i'm getting:

\introcs> javac LineNum.java
LineNum.java:5: error: cannot find symbol
queue<String> elements = new LinkedList<>(); // new String queue
^
symbol: class queue
location: class LineNum
LineNum.java:5: error: cannot find symbol
queue<String> elements = new LinkedList<>(); // new String queue
^
symbol: class LinkedList
location: class LineNum
LineNum.java:11: error: cannot find symbol
queue.enqueue(item);
^
symbol: variable queue
location: class LineNum
LineNum.java:12: error: cannot find symbol
else if (!queue.isEmpty()) // otherwise if queue is empty
^
symbol: variable queue
location: class LineNum
LineNum.java:13: error: cannot find symbol
StdOut.println(queue.dequeue() + " "); // print dequeue + a space
^
symbol: variable queue
location: class LineNum
LineNum.java:16: error: cannot find symbol
StdOut.println(queue);
^
symbol: variable queue
location: class LineNum
LineNum.java:18: error: cannot find symbol
queue.dequeue(); // dequeues element on each loop until i = n
^
symbol: variable queue
location: class LineNum
LineNum.java:21: error: cannot find symbol
StdOut.println(n+ " from the first is " +Queue.dequeue());
^
symbol: variable Queue
location: class LineNum
8 errors

In: Computer Science

Suppose you have two sorted arrays of n integers: X0[1..n] and X1[1..n]. Devise and analyze an...

Suppose you have two sorted arrays of n integers: X0[1..n] and X1[1..n]. Devise and analyze an efficient algorithm for finding the median of all numbers in arrays X0 and X1. Now, suppose you have not two, but three such arrays, each with n elements. Devise and analyze an efficient algorithm for finding the median. Do the same for n arrays, each with n elements.

In: Computer Science

2. (4 pts) Describe a scenario in which an access point impersonation attack could be used...

2. (4 pts) Describe a scenario in which an access point impersonation attack could be used to steal personal financial information.

In: Computer Science

Write a Python program that allows the user to enter the total rainfall for each of...

Write a Python program that allows the user to enter the total rainfall for each of 12 months into a LIST. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest rainfall amounts. Data: January 7.9 inches February 10.1 inches March 3.4 inches April 6.7 inches May 8.9 inches June 9.4 inches July 5.9 inches August 4.1 inches September 3.7 inches October 5.1 inches November 7.2 inches December 8.3 inches

Write comments through both programs (file creation program, and display program) telling what the program is doing

In: Computer Science

Draw R-type format and show an example in MIPS instructions Draw I-type format and show an...

  1. Draw R-type format and show an example in MIPS instructions
  1. Draw I-type format and show an example in MIPS instructions
  1. Draw J-type format and show an example in MIPS instructions

In: Computer Science

What is the name of the IEEE standard for authentication to connect to a LAN (not...

What is the name of the IEEE standard for authentication to connect to a LAN (not just wireless)?

In: Computer Science

When using WPA2 security on your wireless router with a pre-shared key (personal mode), can clients...

When using WPA2 security on your wireless router with a pre-shared key (personal mode), can clients who are authorized to connect to the network (because they have the key) eavesdrop on each other’s traffic? Why or why not? Please provide sufficient technical detail to show your understanding.

In: Computer Science

Python: Write a program that plays Tic-tac-toe with a user. Each round, the game prints out...

Python:

Write a program that plays Tic-tac-toe with a user. Each round, the game prints out the state of the board, asks the user where they would like to place their mark, and implements this decision. The program then places its own mark on a randomly chosen available position. Once one of the player won, the program declares the result and asks if the user would like to continue. The first player is selected at random.

In: Computer Science

Answer the following questions(5pt) a)   Write an algorithm that finds the largest item in an array...

Answer the following questions(5pt)
a)   Write an algorithm that finds the largest item in an array of n items by using divide-and-conquer algorithm design pattern.
b)   Analyze the worst-case time complexity of your algorithm in (a), and show the results using asymptotic notation (ϴ)

In: Computer Science

The following is the pseudocode of algorithm that searches a sorted array of n items by...

The following is the pseudocode of algorithm that searches a sorted array of n items by dividing it into three sub arrays of almost n/3 items (7pt). Hint: refer Mergesort algorithm)

Input: Sorted array of Keys(A) indexed from 1 to n.
Output: Location, the Location of K in array A (hint: return 0 if K is no in A)
index location3 (int A[1…n ], index L, index H)
{
index m1, m2;
if (L > H) return 0;
else
   {
m1 = L + (H – L)/3;   //one third
m2 = L + 2*(H – L)/3;   //two thirds


      }
}
a)   Complete the pseudocode of the above algorithm which is indicated by blank box
b)   Analyze the worst-case time complexity of your algorithm in(a), and show the results using the asymptotic notation (ϴ)

In: Computer Science