Assignment4: Firewall Allow/Block Conflicts
Using the information presented in chapter 7, the provided handout (Firewall Limitations), and the lessons learned from Lab4 to answer the following questions:
In: Computer Science
11. Which of the following C# statements displays the following message “your Score is 28”:
(note that Score is an integer variable holding the value of 28)
int Score =28;
Group of answer choices
a. MessageBox.Show = “Your Score is “ + “Score”;
d. MessageBox.Show (“Your Score is” + Score);
b. MessageBox.Show = “Your Score is” + Score;
c. MessageBox.Show (“Your Score is” + “Score”);
12. The ____________ contains statements that can potentially throw an exception.
Group of answer choices
c. try block
a. break block
b. catch block
d. run block
13. which of the following statements is correct?
double userID=25.87;
Group of answer choices
d. int userNumber = userID;
a. int userNumber =(double) userID;
b. int userNumber = toString(userID);
c. int userNumber = 2* (int) userID;
In: Computer Science
Create a program “Fib.java” and a method called “double[] getFib)” that creates an array with a length of 15 that contains the first 15 numbers in the Fibonacci sequence and returns it. Set the first element to 0 and the second element to 1, then use a for loop to fill out the rest of the array.
In: Computer Science
1. Define HTML and what each letter means. Also, define JavaScript. (Write at least one (1) paragraph (one paragraph contains 5 to 7 sentences).
2.Define Excel. What would you use Excel for? (Write at least one (1) paragraph (one paragraph contains 5 to 7 sentences).
In: Computer Science
Comparing (Sort Algorithms)
Both of the two sorting algorithms will do "sort" on arrays which would contain x randomly generated integers where the value of x would be 10000, 20000, 40000 and 80000 (inputs).
The parts of the program should be followed as.....
1. Set x = 10000, randomly generate x integers. Call qsort function to sort these integers and get the execution time.
2. Randomly generate another x integers. Call your own sorting algorithm and get the execution time.
3. Print the above two execution time on the screen. Program terminates if x = 80000, otherwise set x = x * 2.
In: Computer Science
Visibility is key to securing an organization’s networks. However, as networks become increasingly complex, it becomes more difficult to develop a clear overview of the networks an organization depends on. What recommendations would you make to assist organizations in developing visibility of their networks, and avoiding falling victim to the types of attacks that targeted US banks between 2011 and 2015?
In: Computer Science
2.
Palindromes
A palindrome is a word that reads the same forwards
and backwards. For example,
\aibohphobia" (the irrational fear of palindromes) is
a word that reads the same
forwards and backwards. Write a function
called
isPalindrome()
that accepts a
string as a parameter and returns True if the string
is a palindrome, False otherwise.
Using the function you created, write a
program
Python home work
Python
In: Computer Science
You are given a reference to the root node of a binary search tree, that implements a dictionary data structure. Please print all the elements in depths 500 through 510, all in sorted order. A node in a binary search tree is at depth x, if it takes x hops to get from the root. So the root is at depth 0, the children of the root are at depth 1, and so on. The class TreeNode defines a single node in the binary search tree, and the file MyTree.class is a pre-compiled Java code that defines a binary search tree. The file DepthPrint.java creates an instance of MyTree, and gets the root node of the tree. Please write code that will print elements in depths 500 through 510 in sorted order. Please feel free to add new methods, instance fields and classes that will help your implementation. Your output should match the file depthprint.out.
DepthPrint.java:
public class DepthPrint {
public static void main(String [] args) {
// Create an instance of MyTree.
MyTree T = new MyTree();
// Get the root node of my tree.
TreeNode root = T.getRoot();
// TODO: Code for printing the tree
from depth 500 through 510 in sorted order.
// Feel free to define recursive
methods to traverse the tree and print.
// Please print each key separated
by spaces.
// Printing a new line in the
end.
System.out.println();
}
}
TreeNode.java:
public class TreeNode
{
public int key;
public TreeNode left;
public TreeNode right;
public TreeNode(int _key)
{
key = _key;
left = null;
right = null;
}
}
MyTree.java:
public class MyTree
{
private TreeNode root;
private TreeNode insert(final TreeNode treeNode, final int
n)
{
if (treeNode == null)
{
return new TreeNode(n);
}
if (n <= treeNode.key)
{
treeNode.left = this.insert(treeNode.left, n);
}
else
{
treeNode.right = this.insert(treeNode.right, n);
}
return treeNode;
}
public MyTree()
{
this.root = null;
System.out.println("Loading my Tree.");
for (int i = 0; i < 10000; ++i)
{
if ((i & 0x1) == 0x1)
{
this.root = this.insert(this.root, -i);
}
else
{
this.root = this.insert(this.root, i);
}
}
System.out.println("My Tree is loaded.");
}
public TreeNode getRoot()
{
return this.root;
}
}
In: Computer Science
You are given a reference to the head node of a linked list that stores integers. Please print the minimum element in this linked list. The class ListNode.java contains the description of a single node in the linked list. It has a num field to store the integer number and a reference next that points to the next element in the list. The file MyList.class is a pre-defined java code, that creates a linked list. The file ListSmallest.java creates an instance of MyList, and gets the head node of this list. Please fill out the part that says “TODO”, that computes the minimum element in the list. For fun, please solve this problem recursively. This means that no part of your solution may include iterative loops. The list will not contain any integer greater than 2000000.
ListSmallest.java:
public class ListSmallest {
public static void main(String [] args) {
// Creating an instance of
MyList.
MyList L = new MyList();
// Get the head of the linked
list.
ListNode head = L.getHead();
// Create an object of this
program to avoid static context.
ListSmallest l = new
ListSmallest();
// head is the head of my linked
list L.
// TODO: please write a function to
print the minimum element in this list. Please store this in the
variable m.
int m = 0; // store the min in this
variable.
System.out.println("The smallest
is " + m);
}
}
ListNode.java:
public class ListNode
{
public int num;
public ListNode next;
public ListNode(int _num, ListNode _next)
{
num = _num;
next = _next;
}
}
MyList.java:
public class MyList
{
private ListNode head;
MyList()
{
System.out.println("Loading my list.");
for (int i = 0; i < 50000; ++i) {
this.head = new ListNode(200000 - i, this.head);
}
this.head = new ListNode(17, this.head);
for (int j = 50000; j < 100000; ++j)
{
this.head = new ListNode(200000 - j, this.head);
}
System.out.println("My list is successfully loaded. Please print
the smallest element.");
}
public ListNode getHead()
{
return this.head;
}
}
In: Computer Science
1. Design a combinational logic circuit that converts 4 bits
binary to gray code
2. Design a combinational logic circuit that converts gray code to
4 bits binary
3. Design a combinational logic circuit that converts 4bits 2421 to
excess 3 code
In: Computer Science
You are given a reference to the head node of a linked list that stores integers. Please print the minimum element in this linked list. The class ListNode.java contains the description of a single node in the linked list. It has a num field to store the integer number and a reference next that points to the next element in the list. The file MyList.class is a pre-defined java code, that creates a linked list. The file ListSmallest.java creates an instance of MyList, and gets the head node of this list. Please fill out the part that says “TODO”, that computes the minimum element in the list. For fun, please solve this problem recursively. This means that no part of your solution may include iterative loops. The list will not contain any integer greater than 2000000.
ListSmallest.java:
public class ListSmallest {
public static void main(String [] args) {
// Creating an instance of
MyList.
MyList L = new MyList();
// Get the head of the linked
list.
ListNode head = L.getHead();
// Create an object of this
program to avoid static context.
ListSmallest l = new
ListSmallest();
// head is the head of my linked
list L.
// TODO: please write a function to
print the minimum element in this list. Please store this in the
variable m.
int m = 0; // store the min in this
variable.
System.out.println("The smallest
is " + m);
}
}
ListNode.java:
public class ListNode
{
public int num;
public ListNode next;
public ListNode(int _num, ListNode _next)
{
num = _num;
next = _next;
}
}
MyList.java:
public class MyList
{
private ListNode head;
MyList()
{
System.out.println("Loading my list.");
for (int i = 0; i < 50000; ++i) {
this.head = new ListNode(200000 - i, this.head);
}
this.head = new ListNode(17, this.head);
for (int j = 50000; j < 100000; ++j)
{
this.head = new ListNode(200000 - j, this.head);
}
System.out.println("My list is successfully loaded. Please print
the smallest element.");
}
public ListNode getHead()
{
return this.head;
}
}
CANNOT ADJUST NODE SIZE
In: Computer Science
Using python: In the directory rootdir some of the files contain randomly generated content while others are written by human authors. Determine how many of the files contained in the directory are written by human authors. Store your answer in the variable number_human_authored.
In: Computer Science
Write a program to simulate a bank transaction. There are two bank accounts: checking and savings. First, ask for the initial balances of the bank accounts; reject negative balances. Then ask for the transactions; options are deposit, withdrawal, and transfer. Then ask for the account; options are checking and savings. Then ask for the amount; reject transactions that overdraw an account. At the end, print the balances of both accounts. in if and else statments only in c++
In: Computer Science
QUESTION 5
1. Switch to insert mode, and then create a script that performs the following:
• Sets the environment for the script to bash
• Have at least two comment lines that state the purpose of the script
• Clear the screen
• Sends messages back to the screen informing the user of what he or she is seeing displayed on the screen
• Have the script perform the following:
o Show your home directory
o Show your current working directory
o Create a directory called demo, and send any errors to a null file so the user does not see them on the screen.
o Switch to this new directory
o Show you are in the demo directory
o Place a empty file named file1 in the demo directory, then
o Display a long list of the contents of this (demo) directory
o Change back to your home directory
o Display a long list of all the files in your home directory
2. What construct did you use to send command errors to a null file in your script?
Answer:__________________________
4 points
QUESTION 6
Save your changes and exit the vim editor.
Command(s) to save your file and exit the vim editor?
Answer:___________________________________
2. Display the permissions for your script.
What command did you use?:__________________________
Answer:________________________
3. Does the owner have execute permission?
Answer:____________________________________________
4. Give the user (owner) execute permission to run the script.
What command did you use to change the permissions on the script?
Answer:__________________________________________
What notation did you use to change permissions: symbolic or numeric (octal)?
Answer:____________________________________________
5. Run the script.
What command did you use to run the script?
Answer:____________________________________________
In: Computer Science
Input a phrase from the keyboard. If the last letter in the phrase is "a" or "e" (uppercase or lowercase) then output the last letter 3 times. ELSE If the first letter in the phrase is either "i", "o", or "u" (uppercase or lowercase) then output the length of the phrase In all other cases print "no vowel"
Code language is java
In: Computer Science