CNT Books has expanded considerably since you got the network up and running three years ago. It now occupies an entire floor in the building, and its LAN has grown to include several servers and more than 60 workstations. CNT Books has recently purchased another book company and needs more space and computers. Expansion plans include leasing another floor four stories above the current offices in the same building and adding 35 workstations and at least one more server immediately, with additional equipment purchases expected. What type of network is called for—LAN, WAN, MAN, or internetwork? What additional devices might be needed to ensure efficient network communication?
In: Computer Science
MySQL
Multiple Choice
Answer as soon as possible
1. Why is it important to check the replication
status regularly by running SHOW SLAVE STATUS on the slave?
(a) Running SHOW SLAVE STATUS cleans up the binary and relay logs
that are not in use.
(b) Running SHOW SLAVE STATUS syncs all tables where the data is
different from the Master and Slave.
(c) Replication can have an error at any time and if you don't run
SHOW SLAVE STATUS regularly you may not realize for a long
time.
(d) It is not important to run SHOW SLAVE STATUS to check
replication status.
2. Why is it important for an uptime monitoring
service to check your website from multiple servers around the
world, before considering your website down?
(a) Localized network errors may cause false alarms from individual
servers.
(b) You often only need to have your website available from
specific locations so you don't need to check it from locations
around the world.
(c) It is not important. Checking your website from fewer servers
will save greatly on electricity.
(d) It is not important. You can confirm a website is down from an
individual server accurately.
3. Which of the following are correct regaring
PHP's MySQLi and PDO connections to MySQL? (select all that
apply)
(a) MySQLi offers a procedural API.
(b) PDO works only with MySQL.
(c) PDO and MySQLi both offer object-oriented APIs.
(d) PDO has an exception class to handle any problems that may
occur in our database queries.
(e) Only PDO offers prepared statements.
(f) Both PDO and MySQLi offer protection against SQL Injection
Attacks.
In: Computer Science
6. What is the MIPS machine language binary code for these three instructions?
lw $t0, 1200($t1) #Temporary reg $t0 gets A[300]
add $t0, $s2, $t0 #Temporary reg $t0 gets h+A[300]
sw $t0, 1200($t1) #Stores h+A[300]$t0 back into A[300]
In: Computer Science
MySQL
Multiple Choice
Answer as soon as possible
1. Why is it important to check the replication
status regularly by running SHOW SLAVE STATUS on the slave?
(a) Running SHOW SLAVE STATUS cleans up the binary and relay logs
that are not in use.
(b) Running SHOW SLAVE STATUS syncs all tables where the data is
different from the Master and Slave.
(c) Replication can have an error at any time and if you don't run
SHOW SLAVE STATUS regularly you may not realize for a long
time.
(d) It is not important to run SHOW SLAVE STATUS to check
replication status.
2. Why is it important for an uptime monitoring
service to check your website from multiple servers around the
world, before considering your website down?
(a) Localized network errors may cause false alarms from individual
servers.
(b) You often only need to have your website available from
specific locations so you don't need to check it from locations
around the world.
(c) It is not important. Checking your website from fewer servers
will save greatly on electricity.
(d) It is not important. You can confirm a website is down from an
individual server accurately.
3. Which of the following are correct regaring
PHP's MySQLi and PDO connections to MySQL? (select all that
apply)
(a) MySQLi offers a procedural API.
(b) PDO works only with MySQL.
(c) PDO and MySQLi both offer object-oriented APIs.
(d) PDO has an exception class to handle any problems that may
occur in our database queries.
(e) Only PDO offers prepared statements.
(f) Both PDO and MySQLi offer protection against SQL Injection
Attacks.
In: Computer Science
/*
* Returns a new array of students containing only
those students from the given roster that belong
* to the given academic program
* The resulting array must not contain any null
entries
* Returns empty array (length == 0) if no students
belong to the program
*/
public static UStudent[] filterByProgram(String
program, UStudent[] roster) {
//YOUR CODEf
int counter=0;
for(int i=0;i<roster.length;i++)
{
if(roster[i].getAcademicProgram().equals(program)) {
counter++;
UStudent[] Studentbelongprogram = new
UStudent[counter];
Studentbelongprogram[i]=roster[i];
roster=Studentbelongprogram;
}else {
return new UStudent[0];
}
}
return roster;
}
In: Computer Science
Assignment - Number Guessing with a Class
For this assignment you will revisit the number guessing game in which the user picks a number, and your program tries to guess the number.
For review, a sample run of the program is printed below. In the example the user picks the value 72 for the first game, and then 25 for the second game. The user's input is in bold. Here is how the output might look (exact numbers may vary) :
> Think of a number between 1 and 100
> Is the number 50? (h/l/c): h
> Is the number 75? (h/l/c): l
> Is the number 62? (h/l/c): h
> Is the number 68? (h/l/c): h
> Is the number 71? (h/l/c): h
> Is the number 73? (h/l/c): l
> Is the number 72? (h/l/c): c
> You picked 72? Great pick.
> Do you want to play again? (y/n): y
> Think of a number Between 1 and 100
> Is the number 50? (h/l/c): l
> Is the number 25? (h/l/c): c
> You picked 25? Great pick.
> Do you want to play again: (y/n): n
> Good bye.
The point of interest for us is not necessarily the game - but rather the design of the program. The essential part of this assignment is writing the NumberGuesser class. This class will contain all of the logic for guessing.
Write your NumberGuesser class as if it is going to be used in many different guessing games, created by different developers. You want to create a class that will be a useful tool in different contexts.
When a new instance of a NumberGuesser class is instantiated the upper and lower bounds of the possible values should be passed into its constructor. From that point on a NumberGuesser object will always return the mid-point of the possible values when the getCurrentGuess() method is called.
If the higher() or lower() methods are invoked, the NumberGuesser object should adjust its state to represent the new possible range of values. For example, if a NumberGuesser is created with the following line of code then the range will be the numbers from 1 to 100:
NumberGuesser guesser = new NumberGuesser(1, 100);
If the getCurrentGuess() method is called it should return 50, which is the midpoint between 1 and 100. If the higher() method is invoked then the object should adjust its state accordingly so that it knows that the correct value is between 51 and 100. If the lower() method is invoked then it should adjust its state to represent that the possible values are between 1 and 49.
After that, the getCurrentGuess() should return the value that is in the middle of the new range of possible values. (Either 75 or 25). By following this strategy the number guesser should be able to eventually guess the proper value.
Here is the basic design of the NumberGuesser class that you should write. The instance variables have been left up to you.
NumberGuesser Class
|
Private Instance Variables ?? |
|
Public Methods and Constructors NumberGuesser(int lowerBound, int upperBound) void higher(); void lower(); int getCurrentGuess(); void reset(); |
The reset() method should return the return a NumberGuesser to the state that it was in when it was constructed. In order to do this your class will need to be able to remember its original state. You can use two additional instance variables to store the original upper and lower bounds.
Write your number guess class and test it until you are sure that it is working properly. After it is working, write the rest of the program so that it plays the game by using an instance of your NumberGuesser class.
Note: Your NumberGuesser class should not use a Scanner object or System.out. It is only responsible for handling the indicated methods. All of the input and output work should be handled elsewhere in your program.
Testing your NumberGuesser class
You might find it useful to test your number guesser class with the main method in this program. This is not required. Testing NumberGuesser with Random Numbers
What to submit
Submit two .java files in a compressed directory:
For this assignment you will revisit the number guessing game in which the user picks a number, and your program tries to guess the number.
For review, a sample run of the program is printed below. In the example the user picks the value 72 for the first game, and then 25 for the second game. The user's input is in bold. Here is how the output might look (exact numbers may vary) :
> Think of a number between 1 and 100
> Is the number 50? (h/l/c): h
> Is the number 75? (h/l/c): l
> Is the number 62? (h/l/c): h
> Is the number 68? (h/l/c): h
> Is the number 71? (h/l/c): h
> Is the number 73? (h/l/c): l
> Is the number 72? (h/l/c): c
> You picked 72? Great pick.
> Do you want to play again? (y/n): y
> Think of a number Between 1 and 100
> Is the number 50? (h/l/c): l
> Is the number 25? (h/l/c): c
> You picked 25? Great pick.
> Do you want to play again: (y/n): n
> Good bye.
The point of interest for us is not necessarily the game - but rather the design of the program. The essential part of this assignment is writing the NumberGuesser class. This class will contain all of the logic for guessing.
Write your NumberGuesser class as if it is going to be used in many different guessing games, created by different developers. You want to create a class that will be a useful tool in different contexts.
When a new instance of a NumberGuesser class is instantiated the upper and lower bounds of the possible values should be passed into its constructor. From that point on a NumberGuesser object will always return the mid-point of the possible values when the getCurrentGuess() method is called.
If the higher() or lower() methods are invoked, the NumberGuesser object should adjust its state to represent the new possible range of values. For example, if a NumberGuesser is created with the following line of code then the range will be the numbers from 1 to 100:
NumberGuesser guesser = new NumberGuesser(1, 100);
If the getCurrentGuess() method is called it should return 50, which is the midpoint between 1 and 100. If the higher() method is invoked then the object should adjust its state accordingly so that it knows that the correct value is between 51 and 100. If the lower() method is invoked then it should adjust its state to represent that the possible values are between 1 and 49.
After that, the getCurrentGuess() should return the value that is in the middle of the new range of possible values. (Either 75 or 25). By following this strategy the number guesser should be able to eventually guess the proper value.
Here is the basic design of the NumberGuesser class that you should write. The instance variables have been left up to you.
NumberGuesser Class
|
Private Instance Variables ?? |
|
Public Methods and Constructors NumberGuesser(int lowerBound, int upperBound) void higher(); void lower(); int getCurrentGuess(); void reset(); |
The reset() method should return the return a NumberGuesser to the state that it was in when it was constructed. In order to do this your class will need to be able to remember its original state. You can use two additional instance variables to store the original upper and lower bounds.
Write your number guess class and test it until you are sure that it is working properly. After it is working, write the rest of the program so that it plays the game by using an instance of your NumberGuesser class.
Note: Your NumberGuesser class should not use a Scanner object or System.out. It is only responsible for handling the indicated methods. All of the input and output work should be handled elsewhere in your program.
Testing your NumberGuesser class
You might find it useful to test your number guesser class with the main method in this program. This is not required. Testing NumberGuesser with Random Numbers:
https://www.google.com/url?q=https://docs.google.com/document/d/1WtbkpOZ3OoKuf94HaBCC5or8-dUjClNey6C0wKUNi28/pub?embedded%3Dtrue&sa=D&ust=1571212772373000
What to submit
Submit two .java files in a compressed directory:
In: Computer Science
Number Analysis Program Python:
Initialize an array with these specific 20 numbers: 26 45 56 12 78 74 39 22 5 90 87 32 28 11 93 62 79 53 22 51
Display the following data:
1. The lowest number in the list
2. The highest number in the list
3. The total of the numbers in the list
4. The average of the numbers in the list
In: Computer Science
Write a Java program that reads two integers on the keyboard and displays them on the screen.
In: Computer Science
There is a body of software that is responsible for making it easy to run programs, allowing programs to share memory, enabling programs to interact with devices, and other stuff like that. That body of software is called the __________, as it is in charge of making sure the system operates correctly and efficiently in an easy-to-use manner.
|
operating system |
||
|
process |
||
|
linker |
||
|
compiler |
On a Linux system, which of the following gcc command can be used to compile a C file named aloha.c and generate an executable file named hello.out ?
|
gcc aloha.c |
||
|
gcc aloha.c -o hello.out |
||
|
gcc hello.out |
||
|
gcc hello.c |
||
|
gcc -o hello.c hello.out |
From the OS point of view, a process is a __________.
|
C program |
||
|
running program |
||
|
assembly code |
||
|
system call |
In: Computer Science
find the summation of the sequence of number 1,2,3...n,where n ranges from 1 to 100.use type long.Display the results in a tabular format that shows n and the corresponding sum. If this were a product instead of sum, what difficulty might you encounter with the variable that accumulates the product?
In: Computer Science
9. What are the two main registers that syscall utilizes?
In: Computer Science
Step 1. Set up the network topology with the following devices:
Step 2. Click on the router to bring up the Configuration Window.
Step 4. Select the WIC-2T module and drag it to Slot 0 on the router. Then drag a WIC Cover to Slot1.
Power the device back on
Step 5. Click on the Network Component Box and select Connections. Then select a Copper Straight-through connection to connect the router to the hub.
Click on the Config mode tab of Router0 to begin configuring the device
Click on interface FastEthernet 0/0 and assign the IP address 192.168.1.1, then press the TAB key. Enter the subnet mask 255.255.255.0.
Step 1. In the Main Tool Bar click on the Copy tool.
Click on the Paste tool and the copied device will appear in the work area.
Click on the Network Component Box and select Connections. Then select the Serial DCE connection
Click on the ITCSLAB_1 router and select the Config mode
Step 2. Click on the new router and select the Config mode.
Step 1. Click on the ITCSLAB_1 router and select the Config tab. Then click on RIP and add the network address 192.168.1.0 and 192.168.2.0.
Step 2. Click on the ITCSLAB_2 router and select the Config tab. Then click on RIP and add the network address 192.168.2.0.
Step 3. Set the default gateway on the PCs
Task 6.Test the connectivity of the network Step 1. Click on the Simulation mode.
Step 2. What is the result?
Step 3. What did the activity accomplish?
In: Computer Science
C++ CLion
using Namespace std
Draw a picture of the array that would be created by the following code
int data[10] = {1, 1};
for( int index = 2; index < 8; ++index )
data[ index ] = data[index – 1] + data[index – 2];
In: Computer Science
Explain how the use of Prepared Statements prevents SQL injection attacks.
Please give a commented code example, describing the difference between
data base access with and without the use of Prepared Statements (any
programming language may be used for illustration)
In: Computer Science
Assume we are going to copy a string "hello" from a source pointer src to a destination pointer dst.
From the viewpoint of common memory management errors, what is the problem with the following piece of code?
|
char *src = "hello"; |
|
No memory space has been allocated for the pointer dst |
||
|
No memory space has been allocated for the pointer src |
||
|
The first statement (char *src = "hello";) could cause an error |
||
|
The strcpy(dst, src) call should be strcpy(src, dst) |
From the viewpoint of common memory management errors, what is the problem with the following piece of code?
|
int *x = (int *)malloc(sizeof(int)); |
|
Forgetting to free memory before the malloc() call |
||
|
Encountering an uninitialized read in the printf() call |
||
|
No memory space has been allocated for the pointer x |
||
|
Forgetting to free memory before the printf() call |
Address translation transforms each memory access (e.g., an instruction fetch, load, or store), changing the virtual address provided by the instruction to a __________ address where the desired information is actually located.
|
pseudo |
||
|
physical |
||
|
internet |
||
|
mobile |
In: Computer Science