Write a function matrix_power(A, n) that computes the power An using Boolean arithmetic and returns the result. You may assume that A is a 2D list containing only 0s and 1s, A is square (same number of rows and columns), and n is an integer ≥ 1. You should call your previously written matrix multiply boolean function.
Example: Let R = [ [0, 0, 0, 1], [0, 1, 1, 0], [0, 0, 0, 1], [0, 0, 1, 0] ]
Then calling matrix power(R, 2) should return [ [0, 0, 1, 0], [0, 1, 1, 1], [0, 0, 1, 0], [0, 0, 0, 1] ]
**This is to be written in a python code.
In: Computer Science
QUESTION 31
In Classic Three-Layer Hierarchical Model, the ___________ layer connects network services to the lower layer and implements policies regarding security, traffic loading, and routing.
Access |
||
Distribution |
||
Core |
||
User |
QUESTION 32
Which of the following is a RFC1918 address?
172.168.1.1 |
||
192.168.255.1 |
||
192.16.1.1 |
QUESTION 33
In modern network design, a _________ has become a method to subdivide physical switch-based LANs into many logical LANs.
STP |
||
VLAN |
||
DTP |
||
VTP |
"Test, optimize, and document design", "Monitor and optimize network performance", "Develop logical design" |
||
"Develop logical design", "Monitor and optimize network performance" , "Test, optimize, and document design" |
||
"Develop logical design", "Test, optimize, and document design", "Monitor and optimize network performance" |
||
"Monitor and optimize network performance", "Develop logical design", "Test, optimize, and document design" |
QUESTION 35
Performance can be expressed as a percent uptime per year, month, week, day, or hour, compared to the total time in that period.
True
False
QUESTION 36
Throughput is the data carrying capacity of a circuit.
True
False
QUESTION 37
Route summarization is the method of including many subnets in a few routing entries. It helps conserve routers memory and bandwidth when updating network routes.
True
False
QUESTION 38
When characterizing addressing, any address oddities, such as Discontiguous Subnets, should be noted down for analysis.
True
False
QUESTION 39
_________ provides the following management services:
Fault management |
||
Configuration management |
||
Accounting management |
||
Performance management |
QUESTION 40
The network should not fail more than once every 100 days and it should be fixed within 5 hours. Which of the following is the availability of this network?
A. |
99.79% |
|
B. |
99.89% |
|
C. |
99.69% |
|
D. |
99.99% |
In: Computer Science
Write a program (name it firstMiddleLast _yourInitials.java (yourInitials represents your initials) that will:
1. Ask the user (include appropriate dialog) to enter their:
first name
middle name
last name
save each of the above as a String variable as follows:
firstName
middleName
lastName
2. Print to the screen the number of characters in each of the
names (first, middle and last)
3. Print to the screen total number of characters in all three names. Include appropriate dialog in your output.
4. Print to the screen the initials of the person (first letter of the first, middle and last names) in all capitals with no space or lines between them. For example JFK.
5. Print to the screen the total of the ASCII values of the initials printed in #4 above. For example the initials JFK would sum to 219 (74 + 70 + 75). Remember that the ASCII values are as follows and to find the ASCII value of a single character by casting the character to an int by using (int).
A |
65 |
N |
78 |
B |
66 |
O |
79 |
C |
67 |
P |
80 |
D |
68 |
Q |
81 |
E |
69 |
R |
82 |
F |
70 |
S |
83 |
G |
71 |
T |
84 |
H |
72 |
U |
85 |
I |
73 |
V |
86 |
J |
74 |
W |
87 |
K |
75 |
X |
88 |
L |
76 |
Y |
89 |
M |
77 |
Z |
90 |
In: Computer Science
Please note: This is in Visual Basic.
Create an application. Add two text boxes, a label, and a button to the form. The button’s Click event procedure should assign the contents of the text boxes to Double variables named dblNum1 and dblNum2. It then should divide the dblNum1 variable’s value by the dblNum2 variable’s value, assigning the result to a Double variable named dblAnswer. Display the answer in the label. Code the procedure. Save the solution and then start the application. Test the application using the numbers 6 and 2; the number 3 appears in the label control. Now test it using the numbers 6 and 0. The infinity symbol (∞) appears in the label control because the application is trying to divide a number by 0. Add a selection structure to the procedure. The selection structure should perform the division and display the quotient only if the value in the dblNum2 variable is not 0; otherwise, it should display N/A in the label. Save the solution and then start and test the application. Close the solution.
In: Computer Science
2CCA : E-Discovery: Don't Be Afraid to Be Smart—Select While You Collect ? 2-3 paragraphs in length
In: Computer Science
Scientific Computing Course - please explain in detail
PI has a value of 3.14159.... Round PI to 4 decimal places using
chopping and then again using rounding.
What are the relative errors of using chopping and rounding?
In: Computer Science
TwoNumbersAddTo 1. write a class called TwoNumbersAddTo with a main method 2. the program asks for a number (lets call it "goal"). 3. then the program reads at most 20 integers (i.e. any number of integers from 0 to 20) 4. the program stops reading when user enters 0 or user has entered 20 numbers. 5. program prints all the pairs that add up to goal. 6. Notice that if goal is 5, for example, 1 + 4 and 4 + 1 are the same pair. Your program should report only one. 7. The pairs should be printed such that the first number is in the same order in which it was entered. For example: % java TwoNumbersAddTo enter goal: 5 enter at most 20 integers, end with 0: 1 2 3 4 5 0 1 + 4 = 5 2 + 3 = 5 % java TwoNumbersAddTo enter goal: 5 enter at most 20 integers, end with 0: 4 3 2 1 0 4 + 1 = 5 3 + 2 = 5
In: Computer Science
Operating System:
what is the difference between Synchronous & Asynchronous I/O.
In: Computer Science
In the following class:
public class Truth
{
private boolean yes_no;
...
}
Create constructor, setter and getter methods, and toString method.
In: Computer Science
write a C++ program that :
1. Perform a rot13 substitution
2. Perform a caesar encryption given a dictionary
3. Perform a caesar decryption given a dictionary
4. Create a random caesar cipher dictionary
If user prints:
-r : Perform rot13 substitution
-g : generate a random caesar cipher dictionary.
-e: Encrypt using the caesar cipher
-d : Decrypt using the caesar cipher
The format for the caesar cipher dictionary is a file with 26 pairs of letters, one per letter of the
alphabet, in alphabetical order. Each pair has two letters: the plaintext letter and the ciphertext
letter. The pairs are separated by whitespace. While the dictionary contains only lowercase
letters, the mappings also apply for uppercase letters. Note that the ciphertext letters must be
unique; you cannot have two different plaintext letters that map to the same ciphertext letter.
You also cannot have a plaintext letter map to itself.
Example :
as
bv
cg
dl
ep
.... 26 unique pair of letters
For all of the substitution operations, all upper and lower case letters on input should be
substituted (or rotated as the case may be) before being output. All other characters are simply
copied unchanged from input to output.
If the first argument is missing, the program should print MISSING COMMAND, then stop.
If the first argument is not one of the four listed above, print the first argument followed by a
space and NOT A VALID COMMAND, then stop.
For -r, there is an optional second argument. If provided, it is the name of the file to read from. If
it is not provided, the program should read from standard input. The output should be generated
to the standard output. If a filename is provided but the file cannot open for any reason, the
program should print the filename followed by a space and FILE COULD NOT BE OPENED,
then stop.
For -g, the dictionary should be printed to the standard output. You must ensure that each
plaintext letter maps to a unique ciphertext letter,
and that no letter maps to itself.
For both -e and -d there is a required second argument, which is the filename of the dictionary.
If the second argument is missing, print the message NO DICTIONARY GIVEN, and stop. If the
dictionary cannot open for any reason, the program should print the filename followed by a
space and DICTIONARY COULD NOT BE OPENED, then stop.When reading the dictionary,
you must ensure that each plaintext letter maps to a unique ciphertext letter.
If you find a case
where the dictionary does not contain a two-letter pair, print FORMATTING ERROR
followed by a space and the entry that you read, and stop. If you find a case where a
ciphertext is duplicated, the program should print DUPLICATE CIPHERTEXT L, where L is
the duplicated letter, and stop. If you find a plaintext that maps to the same letter in
ciphertext, the program should print MAPPING ERROR L, where L is the plaintext letter,
and stop.
If you find a case where the dictionary is not in alphabetical order, you must print
MISSING LETTER L, where L is the missing letter, and stop.
Both -e and -d support an optional third argument, which is the file to read from. If it is not
provided, the program should read from standard input. The output should be generated to the
standard output. If a filename is provided but the file cannot open for any reason, the program
should print the filename followed by a space and FILE COULD NOT BE OPENED, then stop.
In all cases if there are too many command line arguments, your program should print TOO
MANY ARGUMENTS, then stop.
In: Computer Science
For this assignment, write a program that will generate three randomly sized sets of random numbers using DEV C++
To use the random number generator, first add a #include statement for the cstdlib library to the top of the program:
#include <cstdlib>
Next, initialize the random number generator. This is done by calling the srand function and passing in an integer value (known as a seed value). This should only be done ONE time and it MUST be done before actually getting a random number. A value of 1 (or any integer literal) will generate the same sequence of "random" numbers every time the program is executed. This can be useful for debugging:
srand(1);
To get a different series of random numbers each time the program is run, the actual time that the program is run can be passed as the seed value for the random number generator. This is done as follows:
srand(time(0));
If the time function is used, make sure to include the ctime library as well.
Note: the two srand instructions that are listed above are simple examples of how to use the instruction. In a program, only one version will be used.
Now that the random number generator has been initialized, a random number can be generated by calling the rand function:
num = rand();
The above line of C++ code will generate a "random" integer between 0 and RAND_MAX and saves the value in an integer variable named num. RAND_MAX is a pre-defined constant that is equal to the maximum possible random number. It is implementation dependent but is guaranteed to be at least 32,767.
Modulus division can be used to restrict the "random" integer to a smaller range:
num = rand() % 7;
will produce a value between 0 and 6. To change the range to 1 through 7, simply add 1:
num = rand() % 7 + 1;
To get random values that are within a specified range that starts at a value other than 0 or 1:
num = minimum_value + (rand() % (maximum_value - minimum_value + 1));
So, to get values within the range 3 - 17:
num = 3 + (rand() % (17 - 3 + 1));
Run 1 (using srand(5);) on Windows PC
There are 59 numbers in the first set of numbers. 93 55 49 60 30 27 49 72 40 14 21 33 76 26 7 63 7 50 31 17 92 93 11 36 49 52 83 22 31 51 69 59 10 53 15 22 87 83 34 86 6 54 85 15 19 60 15 46 12 84 5 91 59 33 99 70 4 17 36 There are 235 numbers in the second set of numbers. 66 38 1 36 10 89 90 93 51 6 35 50 68 46 82 75 35 82 60 53 40 9 53 85 90 16 39 93 63 85 86 84 17 58 78 60 19 67 85 0 26 71 80 74 78 85 43 73 33 29 39 56 61 75 92 83 55 86 19 66 70 86 21 75 46 58 72 2 51 47 82 16 17 91 16 68 41 25 9 86 51 33 67 89 61 46 73 82 24 91 49 43 54 27 32 72 76 96 16 97 97 5 73 27 58 86 52 68 7 68 59 61 98 2 25 86 75 16 93 89 32 82 68 74 21 71 20 67 94 58 30 70 0 72 24 95 86 8 87 36 77 71 14 26 46 8 76 2 50 55 19 24 46 16 34 71 33 71 60 25 58 5 93 11 86 34 72 32 33 80 42 30 0 10 38 58 67 98 45 26 24 24 28 84 36 17 0 4 60 95 69 60 55 69 42 40 26 93 32 53 0 28 64 74 75 17 30 72 30 54 48 37 8 39 4 44 65 81 5 43 28 98 67 63 69 14 68 63 80 73 89 58 17 82 22 There are 205 numbers in the third set of values. 81 40 35 33 69 58 56 79 66 0 2 24 65 35 50 84 7 26 85 35 88 75 24 58 16 20 38 23 18 7 44 52 16 82 36 47 22 31 30 21 78 59 54 88 0 17 90 81 87 73 59 58 60 94 49 92 22 29 81 1 97 39 49 71 59 32 90 36 55 33 25 97 40 23 34 81 66 29 38 88 35 88 2 55 5 45 44 94 34 83 26 91 16 85 10 64 1 66 28 96 66 87 18 34 60 53 83 90 23 12 65 84 71 75 98 31 35 5 29 22 72 51 22 37 38 51 62 26 56 12 23 1 22 27 76 85 34 61 92 48 68 42 32 78 95 54 6 32 67 26 51 62 36 25 93 59 54 51 25 45 15 54 55 73 19 51 24 36 2 79 19 97 23 66 91 5 91 1 27 20 47 55 15 62 42 13 70 94 58 98 17 6 18 23 75 11 52 28 45 30 89 95 32 95 49
In: Computer Science
Write a Scheme function that takes a list of integers and returns all odd integers on the list in the original order:
(odd-numbers `(2 4 9 16 25 7)) (9 25 7)
Hint: 2 (remainder 13 5) 3
Please explain every step
In: Computer Science
Let X and Y be two arrays and you want to find their longest common sequence (LCS). Describe how you can calculate it in a space complexity of O(min{|X|, |Y|}). NOT O(|X| * |Y|). Pseudocode is not necessary but a detailed explanation of the idea will be very helpful.
In: Computer Science
In: Computer Science
create a class in C++ having
the following 4 private members:
one double variable representing the balance of a bank account
on string variable representing the bank account number
a function to deposit money from the bank account
a function to withdraw money from the bank account
the following 2 public members:
-two wrapper functions.
- one parameterless constructor
- one constructor initializing the account balance and account number
- sample:
#include <iostream> using namespace std; class account { public: account(); account(string s, double m); void setMoney(double b); void getMoney(double b); private: double money; string accountNo; void withdraw(double b); void deposit(double b); }; account::account() { money=0; accountNo="12345"; } account::account(string s, double m) { money=m; accountNo=s; } void account::withdraw(double b) { if(money<b) { cout<<"not enough"<<endl; } else { money = money-b; } cout<<"withdraw your new balance is "<<money<<endl; } void account::setMoney(double b) { deposit(b); } void account::getMoney(double b) { withdraw(b); } void account::deposit(double b) { money = money+b; cout<<"deposit: your new balance is "<<money<<endl; } int main() { account a; a.setMoney(1000); a.getMoney(500); account b("23456", 1234); b.setMoney(2000); b.getMoney(600); return 0; }
In: Computer Science