An IPv4 Layer 3 router that uses 32-bit host addresses has four output interfaces, which are numbered 0 through 3. Packets are forwarded to the link interfaces using the following rules:
Destination Address Range Output Link
Interface
00000010 00000000 00000000 00000000
through
00000010 00011111 11111111 11111111 0
00000010 00100000 00000000 00000000
through
00000010 00100001 11111111 11111111 1
00000010 01000010 00000000 00000000
through
00000010 01000011 11111111 11111111 2
all other addresses 3
a. Construct a forwarding table that has no more than five entries
and uses longest prefix matching.
b. Describe how your forwarding table determines the appropriate
link interface
For the following incoming datagram destination addresses, describe
which rule is used, and to which port interface the datagram is
forwarded:
i) 00000010 00001000 11000011 00111100 (binary octets)
ii) 00000010 00001000 11000011 00111100 (binary octets)
iii) 10.0.3.1 (base-10 octets)
iv) 2.65.3.41 (base-10 octets)
v) 2.34.225.200 (base-10 octets)
In: Computer Science
You must write functions permute(...) and permuteAux(...) by analogy with the the functions enumerate(....) and enumAux(....). Basically, the changes are to implement the "without replacement" condition: you must keep track of which letters have been used using a Boolean list in previous stages of the recursion (e.g., B[0] will be true if at an earlier stage of the recursion, 'A' has already been inserted into X; simply don't do the recursive call if that letter has been used).
Print out the sequences for permute(4,3)
CODE FOR enumerate and enumAux
letter = [chr(i) for i in range(ord('A'),ord('Z')+1)] =
def enumerate(N,L):
X = [0] * L
enumAux(N,X,0)
def enumAux(N,X,I):
if(I >= len(X)):
print(X)
else:
for j in range(N):
X[I] = letter[j]
enumAux(N,X,I+1)
enumerate(3,2)
OUTPUT:
['A', 'A'] ['A', 'B'] ['A', 'C'] ['B', 'A'] ['B', 'B'] ['B', 'C'] ['C', 'A'] ['C', 'B'] ['C', 'C']
In: Computer Science
How do you write this code in JavaScript inside the head?
In: Computer Science
Write a Python module that must satisfy the following-
Define a function named rinsert. This function will accept two arguments, the first a list of items to be sorted and the second an integer value in the range 0 to the length of the list, minus 1. This function shall insert the element corresponding to the second parameter into the presumably sorted list from position 0 to one less than the second parameter’s index.
Define a function named rinsort. This function will accept two arguments, the first a list of items to be sorted and the second an integer value in the range 0 to the length of the list, minus 1. This function shall sort the elements of the list from position 0 to the position corresponding to the second parameter, in ascending order using insertion sort. This function must be recursive.
In: Computer Science
Provide at least three (3) best practices when creating methods in C# and explain why they are "best.
In: Computer Science
Task #1 Develop a recursive method to reverse a list Develop a method with the prototype public static void reverse (ArrayList inputList) based on selecting the first list element as the head and the remaining list as its tail. Here is the recursive design. 1) Base case: The problem is trivial when the list size is 0 or 1. 2) Decomposition: For lists with size > 1: a) Extract its head (element) and leave the tail (the input list with the head removed). You can look up the method that does this for the List interface. b) Make a recursive call to obtain the tail reversed. Page 2 of 3 3) Composition: Append the extracted head element to the reversed tail obtain the original list reversed. Task #2 Develop a recursive method to find the maximal element Note that this is not possible unless the list elements are comparable to each other. Java provides a generic Interface for this called Comparable. Based on this, develop a method with the following prototype public static > E max(List inputList) You can use the same problem decomposition technique as in Task #1. Think about how the composition of result should be made. Task #3 Develop a recursive method to sum the list elements Obviously, this is not possible unless the list elements are of numeric type. Develop a recursive summing method with the prototype public static double sum (List inputList) Task #4 Use command line arguments to supply the list elements Use the following main() method: public static void main(String args[]) { ArrayList argList = new ArrayList<>(); ArrayList numericArgs = new ArrayList<>(); for (String s : args) { argList.add(s); try { numericArgs.add(Double.parseDouble(s)); } catch (NumberFormatException e) { System.out.println(e.getMessage() + "is not numeric...skipping"); } } System.out.print("Command line arguments before reversal: "); for (int i=0; i
In: Computer Science
Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions: void getScore() should ask the user for a test score, store it in a reference parameter variable, and validate it. This function should be called by main once for each of the five scores to be entered. void calcAverage() should calculate and display the average of the four highest scores. This function should be called just once by main and should be passed the five scores. int findLowest() should find and return the lowest of the five scores passed to it. It should be called by calcAverage, which uses the function to determine which of the five scores to drop.
Please post the program working as well. Thank you
In: Computer Science
How to prove f(n)=O(n) for any integer ⩾1, if f(1)=1 and f(n)=2f(⌊n/2⌋)+1 for n⩾2?
Do you need induction? If so, how do you do it?
In: Computer Science
Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate 12 times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month.
After all iterations, the program should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period.
Input Validation: Do not accept a number less than 1 for the number of years. Do not accept negative numbers for the monthly rainfall.
Please post the program working as well. Thank you
In: Computer Science
A painting company has determined that for every 110 square feet of wall space, one gallon of paint and eight hours of labor will be required. The company charges $25.00 per hour for labor. Write a modular program that allows the user to enter the number of rooms that are to be painted and the price of the paint per gallon. It should also ask for the square feet of wall space in each room.
It should then display the following data:
Input validation: Do not accept a value less than 1 for the number of rooms. Do not accept a value less than $10.00 for the price of paint. Do not accept a negative value for square footage of wall space.
In: Computer Science
just anwser .the question, so that I can finish the essay
[10 marks] Given the following article in Computer Technology:
We can’t trust AI systems built on deep learning alone
Gary Marcus, a leader in the field, discusses how we could achieve general intelligence— and why that might make machines safer.
by Karen Hao Sep 27, 2019
https://www.technologyreview.com/s/614443/we-cant-trust-ai-systems-built-on-deeplearning-alone/
INSTRUCTIONS: Answer the following questions in an essay:
1. What are the value and descriptive assumptions? [4 marks]
2. Is/Are there any fallacy/fallacies in the reasoning? [4 marks]
3. What kind of evidence is provided and how good is it? [2 marks]
In: Computer Science
C++ Code
***User Interface
Write a program that offers an easy way to add items, remove the last item, look at the last item put in the list. You will write all of the code for processing the stack - do not use any predefined objects in C++. You decide how the interface will look. A menu driven program is always a good choice.
***Rules for program***
****PLEASE READ**** Additional information for program below.
Write a program to keep up with a collection of "Item" objects. ( Please put comments on all functions other than main to describe purpose)
create a class “Item” with the following private data attributes:
For this lab have separate files in a project. Put your class definitions in header files and the implementations of the methods in a .cpp file.
You will have the following public methods:
Create another class to implement a stack of "Items" using an array-based implementation.
Your stack class should include the following operations:
In: Computer Science
Write a java code that first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical digits as possible, and interprets them as a numerical value.
The string can contain additional characters after those that form the integral number, which are ignored and have no effect on the behavior of this function.
If the first sequence of non-whitespace characters in str is not a valid integral number, or if no such sequence exists because either str is empty or it contains only whitespace characters, no conversion is performed.
If no valid conversion could be performed, a zero value is returned.
Example 1:
Input: "42"
Output: 42
Example 2:
Input: " -42"
Output: -42
Explanation: The first non-whitespace character is '-', which is the minus sign. Then take as many numerical digits as possible, which gets 42.
Example 3:
Input: "4193 with words"
Output: 4193
Explanation: Conversion stops at digit '3' as the next character is not a numerical digit.
Example 4:
Input: "words and 987"
Output: 0
Explanation: The first non-whitespace character is 'w', which is not a numerical digit or a +/- sign. Therefore no valid conversion could be performed.
Note 1: When you are testing your code, drop the " around the input values.
Note 2: In this project, you should use the String methods you have learned in this class and implement a loop structure.
In: Computer Science
1) Two of the major challenges business users face when using big data are finding the information they need to make decisions and knowing that the data they have is valid.
(TRUE OR FALSE)
2) In microsoft access, Carlos is working with an existing database, but he wants to eliminate some of the columns in the table to create a new, more streamlined database. He will use projection to create his new database.
(TRUE OR FALSE)
3) A virtual private network (VPN) supports a secure, encrypted connection between a company's employees and remote users through a third-party service provider.
(TRUE OR FALSE)
4) A client is any computer on a network that sends messages requesting services from the servers on the network.
(TRUE OR FALSE)
5) JavaScript can be used to validate data entry in a Web form.
(TRUE OR FALSE
In: Computer Science
Create 3 Classes per the following instructions:
1) Create an abstract parent superclass called MobileDevices and include only the attributes that are common to both cellphones and tablets like iPads. Also create at least one abstract method.
2) Create a child class that extends the MobileDevices class called DeviceType that has attributes and methods regarding the type of device.
3) Create a third class that extends the DeviceType class called DeviceBrand that has attributes and methods for both Apple and Android devices. Make sure to create methods that override any methods in the superclass and possibly any parent class.
4) Create a driver class that initializes the classes and prints out values. Submit you .java files with your name appended to the file names and screenshots of your output.
In: Computer Science