Questions
Another pitfall cited in Section 1.10 is expecting to improve the overall performance of a computer...

Another pitfall cited in Section 1.10 is expecting to improve the overall performance of a computer by improving only one aspect of the computer. Consider a computer running a program that requires 250 s, with 70 s spent executing FP instructions, 85 s executed L/S instructions, and 40 s spent executing branch instructions.

By how much is the total time reduced if the time for FP
operations is reduced by 20%?

By how much is the time for INT operations reduced if the
total time is reduced by 20%?

Can the total time can be reduced by 20% by reducing only
the time for branch instructions?

In: Computer Science

public class Node<T> { Public T Item { get; set; } Public Node<T> Next; { get;...

public class Node<T>
{
Public T Item { get; set; }
Public Node<T> Next; { get; set; }
public Node (T item, Node<T> next)
{ … }
}
public class Polynomial
{
// A reference to the first node of a singly linked list
private Node<Term> front;
// Creates the polynomial 0
public Polynomial ( )
{ }
// Inserts term t into the current polynomial in its proper order
// If a term with the same exponent already exists then the two terms are added together
public void AddTerm (Term t)
{ … }
// Adds polynomials p and q to yield a new polynomial
public static Polynomial operator + (Polynomial p, Polynomial q)
{ … }
// Multiplies polynomials p and q to yield a new polynomial
public static Polynomial operator * (Polynomial p, Polynomial q)
{ … }
// Evaluates the current polynomial at x
public double Evaluate (double x)
{ … }
// Prints the current polynomial
public void Print ( )
{ … }
}
DON'T SOLVE THE FIRST TASK JUST THE ONE AFTER THIS LINE. The first task is their for reference

C# Please :)

In a separate namespace, the class Polynomial (Version 2) re-implements a polynomial as a linear array
of terms ordered by exponent. Each polynomial is also reduced to simplest terms, that is, only one term
for a given exponent.
public class Polynomial
{
// P is a linear array of Terms
private Term[ ] P;

// Re-implement the six methods of Polynomial (including the constructor)

}

In: Computer Science

1 Linear Algebra in Numpy (1) Create a random 100-by-100 matrix M, using numpy method "np.random.randn(100,...

1 Linear Algebra in Numpy
(1) Create a random 100-by-100 matrix M, using numpy method "np.random.randn(100, 100)", where
each element is drawn from a random normal distribution.
(2) Calculate the mean and variance of all the elements in M;
(3) Use "for loop" to calculate the mean and variance of each row of M.
(4) Use matrix operation instead of "for loop" to calculate the mean of each row of M, hint: create a vector
of ones using np.ones(100, 1)?
(5) Calculate the inverse matrix M−1
(6) Verify that M−1M = MM−1 = I. Are the off-diagnoal elements exactly 0, why?

In: Computer Science

Develop a flowchart showing the steps required to set up and test a newly purchased computer...

  1. Develop a flowchart showing the steps required to set up and test a newly purchased computer system that includes the computer, a mouse, keyboard, speakers, and an Internet connection.

In: Computer Science

JAVA CODE FILL IN THE BLANKS you are to complete the skeleton program by completing *...

JAVA CODE FILL IN THE BLANKS

you are to complete the skeleton program by completing
* the To Do sections. I would suggest doing this a
* little bit at a time and testing each step before you
* go on to the next step.
*
*           Add whatever code is necessary to complete this assignment

*********************************************************************/


//Add whatever code is necessary to complete this assignment

public class Methods
{
   public static void main(String[] args)
   {
       //create two integer variables below
      
      
      
       //ask the user to enter numbers into each of the variables                   (
      
      
      
      
      
      
      
       //call the max method to determine which number is the biggest
       //and then display the result to the screen in a message that looks like...
       //"The highest number you entered was X"
      
      
      
      
      
      
       //call the difference method to determine the difference between the two numbers
       //and then display the result to the screen in a message that looks like...
       //"The difference between X and Y is Z" (where X is the first number,
       //Y is the second number and Z is the difference)
       //***The difference should always be a positive value***
      
      
      
      
      
      
   }//end main
  
  
   //write a max method here. It should accept two numbers and return the highest   
   //of those two numbers
  
  
  
  
  
  
  
  
  
   //write a difference method here. It should accept two numbers and return the difference   
   //between the two numbers. *** The difference must always be a positive number. ***
  
  
  
  
  
  
  
}//end Methods

In: Computer Science

You should use Visual Studio to write and test the program from this problem.   Write a...

You should use Visual Studio to write and test the program from this problem.  

Write a complete program with a for loop that

  • (5 pts) uses proper variable types.
  • (10 pts) uses a for loop to read in a real numbers exactly 8 times
  • (10 pts) adds the number read in the loop to a running sum.
  • (10 pts) Computes the average of the 8 numbers as a real number.
  • (5 pts) Prints the correct result with 2 decimal places, no text with the result.
  • Your program must NOT prompt the user for each number and must only print the answer, no text. (You will lose points!)

In: Computer Science

Compare the details of the passwd and shadow files under /etc/ –Who is the owner and...

  1. Compare the details of the passwd and shadow files under /etc/

–Who is the owner and group for each of the files?

–What permissions are assigned for these files?

–Are the permissions consistent with the results of activity you did before.

–Discuss the permissions in light of principle of least privilege.

2. Check the details of the log directory under /var/

–Who is the owner and group of the directory?

–What permissions are assigned for this directory?

–Discuss the permissions in light of principle of least privilege.

3. What happens to a file when the primary group of its user owner changes?

USE LINUX to answer

In: Computer Science

Write a C code program to implement the comparisons of three integer numbers, using only conditional...

Write a C code program to implement the comparisons of three integer numbers, using only conditional operators (no if statements). Please ask the user to input random three integers. Then display the minimum, middle, and maximum number in one line. Also, please calculate and display the sum and the average value (save two digits after decimal point) of these three integers. Please write the comments line by line.

In: Computer Science

What is the reason/s behind unit and system testing? Discuss in 120–150 words.

What is the reason/s behind unit and system testing? Discuss in 120–150 words.

In: Computer Science

In your book there is a Class method called Square that draws a square either using...

In your book there is a Class method called Square that draws a square either using a border or a solid. Using that class, create a Square2 class that also prompts the user for the character to be printed (i.e. such as #, $, whatever) and if the user enters a blank character it defaults to *.

You’ll need to modify the called private methods in Square to accept a character passed.

Note that for the purposes of this Lab it is okay to prompt the user from the class methods.

Sample session:

M:\Java253>java Square2Driver

Enter width of desired square: 9

Area = 81

What character should be used for printing? (i.e. *) #

Print with (b)order or (s)olid? s

#########

#########

#########

#########

#########

#########

#########

#########

#########

/***********************************************************

* SquareDriver.java

* Dean & Dean

*

* This is the driver for the Square class. ***********************************************************/

import java.util.Scanner;

public class SquareDriver

{

public static void main(String[] args)

{   

Scanner stdIn = new Scanner(System.in);

   Square square;

   System.out.print("Enter width of desired square: ");

square = new Square(stdIn.nextInt());

   System.out.println("Area = " + square.getArea());   

square.draw();

} // end main

} // end class SquareDriver

/************************************************************
* Square.java
* Dean & Dean
*
* This class manages squares.
************************************************************/

import java.util.Scanner;

public class Square
{
private int width;

//*********************************************************

public Square(int width)
{
this.width = width;
}

//*********************************************************

public int getArea()
{
return this.width * this.width;
}

//*********************************************************

public void draw()
{
Scanner stdIn = new Scanner(System.in);

System.out.print("Print with (b)order or (s)olid? ");
if (stdIn.nextLine().charAt(0) == 'b')
{
drawBorderSquare();
}
else
{
drawSolidSquare();
}
} // end draw

//*****************************************************

private void drawBorderSquare()
{
drawHorizontalLine();
drawSides();
drawHorizontalLine();
} // end drawBorderSquare

//*****************************************************

private void drawSolidSquare()
{
for (int i=0; i<this.width; i++)
{
drawHorizontalLine();
}
} // end drawSolidSquare

//*****************************************************

private void drawHorizontalLine()
{
for (int i=0; i<this.width; i++)
{
System.out.print("*");
}
System.out.println();
} // end drawHorizontalLine

//*****************************************************

private void drawSides()
{
for (int i=1; i<(this.width-1); i++)
{
System.out.print("*");
for (int j=1; j<(this.width-1); j++)
{
System.out.print(" ");
}
System.out.println("*");
}
} // end drawSides
} // end class Square

In: Computer Science

- Students must develop the code required to create a square two-dimensional array just large enough...

- Students must develop the code required to create a square two-dimensional array just large enough to store a given string in encrypted form using the given encryption algorithm. The character used after the end of the encrypted string is the ASCII delete key, set as final UNPRINTABLE_CHAR_VALUE. After this value is stored, the encryption process fills the remaining elements with random values

- Students must develop the code to decrypt a given square two-dimensional array and using the given encryption algorithm

- Students must develop other supporting methods as specified (below) to manage the encryption operations*

- Students will also document all classes and methods using the Javadoc commenting process; comments are not required to be exactly the same as found in the supporting document (below) but they should be semantically equivalent

- Students will upload the EncryptionClass.java file to this assignment; any other uploaded files will result in a reduction of the project grade, and in some cases, may cause a complete loss of credit

- Assignment Specification (Javadoc output for the project):

p1_package

Class EncryptionClass

  • java.lang.Object
    • p1_package.EncryptionClass

FileIoToolsForEncryptionClass.java

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class EncryptionClass
   {/**
     * Constant for maximum input char limit
     */
    private final int MAX_INPUT_CHARS = 256;
  
    /**
     * Constant for unprintable char value used as message end char
     */
    private final int UNPRINTABLE_CHAR_VALUE = 127; // ASCII for delete key

    /**
     * Constant for minus sign used in getAnInt
     */
    private final char MINUS_SIGN = '-';
  
    /**
     * Class Global FileReader variable so methods can be used
     */
    private FileReader fileIn;
  
    /**
     * Downloads encrypted data to file
     * <p>
     * Note: No action taken if array is empty
     * @param fileName String object holding file name to use
     */
    void downloadData( String fileName )
       {FileWriter toFile;     
        int rowIndex, colIndex;     
        if( arrSide > 0 )
           {
            try
               {
                toFile = new FileWriter( fileName );
                toFile.write( "" + arrSide + "\r\n" );
                for( rowIndex = 0; rowIndex < arrSide; rowIndex++ )
                   {
                    for( colIndex = 0; colIndex < arrSide; colIndex++ )
                       {
                        if( encryptedArr[ rowIndex ][ colIndex ] < 100 )
                           {
                            toFile.write( "0" );
                           }              
                        toFile.write(" "+ encryptedArr[ rowIndex ][ colIndex ] + " " );
                       }
                    toFile.write( "\r\n" );
                   }
         
                toFile.flush();
                toFile.close();
               }
            catch( IOException ioe )
               {
                ioe.printStackTrace();
               }
           }
       }

    /**
     * gets an integer from the input stream
     *
     * @param maxLength maximum length of characters
     * input to capture the integer
     *
     * @return integer captured from file
     */
    private int getAnInt( int maxLength )
       {
        int inCharInt;
        int index = 0;
        String strBuffer = "";
        int intValue;
        boolean negativeFlag = false;

        try
           {
            inCharInt = fileIn.read();

            // clear space up to number
            while( index < maxLength && !charInString( (char)inCharInt,
                                                           "0123456789+-" ) )
               {
                inCharInt = fileIn.read();              
                index++;
               }    
            if( inCharInt == MINUS_SIGN )
               {
                negativeFlag = true;
                inCharInt = fileIn.read();
               }

            while( charInString( (char)inCharInt, "0123456789" ) )
               {
                strBuffer += (char)( inCharInt );

                index++;
             
                inCharInt = fileIn.read();
               }          
           }
     
        catch( IOException ioe )
           {
            System.out.println( "INPUT ERROR: Failure to capture character" );
            strBuffer = "";
           }
        
        intValue = Integer.parseInt( strBuffer );
     
        if( negativeFlag )
           {
            intValue *= -1;
           }
     
        return intValue;
       }

    /**
     * Uploads data from file holding a square array
     *
     * @param fileName String object holding file name
     */
    void uploadData( String fileName )
       {
        int rowIndex, colIndex;
    
        try
           {
            // Open FileReader
            fileIn = new FileReader( fileName );
      
            // get side length
            arrSide = getAnInt( MAX_INPUT_CHARS );         
    
            encryptedArr = new int[ arrSide ][ arrSide ];
          
            for( rowIndex = 0; rowIndex < arrSide; rowIndex++ )
               {
                for( colIndex = 0; colIndex < arrSide; colIndex++ )
                   {
                    encryptedArr[ rowIndex ][ colIndex ]
                                                  = getAnInt( MAX_INPUT_CHARS );
                   }
               }
          
            fileIn.close();
           }
    
        // for opening file
        catch( FileNotFoundException fnfe )
           {
            fnfe.printStackTrace();
           }
      
        // for closing file
        catch (IOException ioe)
           {
            ioe.printStackTrace();
           }
       }   
   }  

In: Computer Science

Linux 1. Give a command line (one command) for displaying the files lab1, lab2, lab3, and...

Linux

1. Give a command line (one command) for displaying the files lab1, lab2, lab3, and lab4. Can you give another command lines that do the same thing by making use of the file name similarities? What is the command line for displaying the files lab1.c, lab2.c, lab3.c, and lab4.c? (Hint: use shell metacharacters.)

2. How to determine the number of users who are logged on to Linux server system at this time? What command did you use to discover this?

3. Determine the name of the operating system that the Linux server runs. What command did you use to discover this

4. What are special files in UNIX? What are character special files and block special files? Run the ls /dev | wc -w command to find the number of special files that the linux server system has.

5. What is the inode number of the root directory on the linux server? Give the commands that you used to find the inode number.

In: Computer Science

ITT-270 IPv6 Stateful Autoconfig, Static and Default Routing, OSPF Guide Directions:This assignment will configure IPv6. To...

ITT-270 IPv6 Stateful Autoconfig, Static and Default Routing, OSPF Guide

Directions:This assignment will configure IPv6. To complete this assignment, follow the guidelines provided below. At the end of this document you will find the related assignment questions; submit only the completed questions portion to your instructor. Note: At various points you will be required to obtain a screen capture; add this directly into the document following the related question.

Objectives

  • Manual and stateful autoconfiguration
  • Static and default routing
  • OSPF v3

Guidelines

For this assignment, the network will look like this.  The routers are Cisco 2911 models and the switches are Cisco 2960 models.

(Todd, 2016)

There will be no need to create any connections or devices for this assignment.

  1. Login to the C router and configure the Outside address as 2001:db8:3c4d:1::/64by typing the following commands:  
    1. Ipv6 unicast-routing
    2. Int gi0/0
    3. Ipv6 address 2001:db8:3c4d:1::1/64
  2. Now, the inside address needs to be 2001:db8:3c4d:2::/64. Complete this by typing the following commands:  
    1. Int gi0/1
    2. Ipv6 address 2001:db8:3c4d:2::1/64
    3. CTRL+Z
  3. Verify by typing the following command:
    1. Show ipv6 route

Capture the screen (screenshot 1) and place it with the related question below.  

  1. Continue by typing the following command:
    1. show ipv6 int brief

Capture the screen (screenshot 2) and place it with the related question below.  

  1. Login to router A and set it to autoconfig ipv6 by typing the following commandsin Global Configuration mode:  
    1. ipv6 unicast-routing
    2. int gi0/0
    3. ipv6 address autoconfig
    4. No shut
    5. CTRL+Z
  2. Confirm by typing the following command:  
    1. sh ipv6 int brief

Capture the screen (screenshot 3) and place it with the related question below.  

Before continuing, answer question 1 below.  

  1. Complete this for router B, D, and E.  

Capture the screen (screenshot 4, 5 and 6) for each router and place them with the related questions below.  

  1. Setup static and default routing.  On router A configure a static route to the 2001:db8:3c4d:2::/64 by typing the following commands:
    1. config t
    2. ipv6 route 2001:db8:3c4d:2::/64 gi0/0
    3. do show running-config

Capture the screen (screenshot 7) and place it with the related question below.

  1. Continue by typing the following command:  
    1. show ipv6 route

Capture the screen (screenshot 8) and place it with the related question below.  

Before continuing, answer question 2 below.

  1. On router B, configure a default route by typing the following commands:   
    1. conf t
    2. ipv6 route ::/0 gi0/0
      1. (there is a space after route)
    3. do show running-config

Capture the screen (screenshot 9) and place it with the related question below.  

  1. Continue by typing the following command on Router B:  
    1. show ipv6 route

Capture the screen (screenshot 10) and place it with the related question below.  

Before continuing, answer questions 3 and 4 below.  

  1. On router D, create a static route the other way by typing the following commands in Global Configuration mode:  
    1. ipv6 route 2001:db8:3c4d:1::/64 gi0/0
    2. do show running-config

Capture the screen (screenshot 11) and place it with the related question below.  

  1. Continue by typing the following command:  
    1. show ipv6 route

Capture the screen (screenshot 12) and place it with the related question below.  

  1. On router E, do the same.

Before continuing, answer question 5 below.  

  1. On Router E, run the following command:
    1. show running-config

Capture the screen (screenshot 13) and place it with the related question below.  

  1. Continue by typing the following command:  
    1. show ipv6 route

Capture the screen (screenshot 14) and place it with the related question below.  

  1. Ping from router D to router A. First, we need to find out what autoconfig address exists on router A (should being with 2001). Type the following command:
    1. sh ipv6 int brief
  2. On router D
    1. Ping <IP ADDRESS>

Capture the screen (screenshot 15) and place it with the related question below.  

Before continuing, answer question 6 below.  

Note: Now, it’s time to practice with OSPFv3. Unfortunately, because OSPF has automagic routing, the routing that was set before needs to be removed. Of course, one could just close the app and re-open it, but practice instead.  

  1. On router A type the following command:
    1. no ipv6 route 2001:db8:3c4d:2::/64 gi0/0
  2. On router B type the following command:
    1. no ipv6 route ::/0 gi0/0
  3. On router D type the following command:
    1. no ipv6 route 2001:db8:3c4d:1::/64 gi0/0
  4. On router E type the following command:
    1. no ipv6 route 2001:db8:3c4d:1::/64 gi0/0
  5. We aren’t doing this for router C.

Before continuing, answer question 7 below.  

  1. IRL, if IPv4 is not configured, RIDs need to be created for each router. On router A, define ospf 1 with RID 1.1.1.1 by typing the following commands:  
    1. ipv6 router ospf 1
    2. router-id 1.1.1.1
  2. Now, assign ospf 1 to the outside interface by typing the following commands:
    1. int gi0/0
    2. ipv6 ospf 1 area 0
    3. CTRL+Z
  3. Verify by typing the following commands:  
    1. sh ipv6 route
    2. sh ipv6 route ospf
    3. sh ipv6 int gi0/0
    4. sh ipv6 neighbor
  4. On router B, define ospf1 with RID 2.2.2.2, then assign OSPF 1 to f0/0 by typing the following commands:  
    1. ipv6 router ospf 1
    2. router-id 2.2.2.2
    3. int gi0/0
    4. ipv6 ospf 1 area 0
    5. CTRL+Z
  5. Verify by typing the following commands:  
    1. sh ipv6 route
    2. sh ipv6 route ospf
    3. sh ipv6 int gi0/0
    4. sh ipv6 neighbor
  6. Complete the same with routers C, D, & E, changing the “Router-id #.#.#.#” to be 3.3.3.3, 4.4.4.4, & 5.5.5.5, respectively.  On Router C, make sure that you issue the ipv6 ospf 1 area 0on both interfaces (gi0/0 & gi0/1).

Before continuing, answer question 8 below.  

  1. In order to confirm the ping, determine the ipv6 addresses for each router. These should all begin with 2001.  Do not use the FE80addresses as they are link-local addresses.  

Finish this assignment by completing question 9 below.

ITT-270 Stateful Autoconfig, Static and Default Routing, OSPF – Questions

Complete the following questions as required by the prompts within the guidelines above.  

  1. What does no shut do?

  1. Why are we creating a static route here? Why not a dynamic route?

  1. In this context, what is the difference between static and default routes?

  1. Will both routers ping gi0/1 on router C?

  1. What’s the command here?
  1. Can everybody ping everybody else? Fill out the chart.

A

B

C

D

E

A

---

B

---

C

---

D

---

E

---

  1. Why?

  1. What commands will you use for each router?  
  1. Fill out the table.

A

B

C

D

E

In: Computer Science

C++ Write a program that reads a line of text, changes each uppercase letter to lowercase,...

C++

Write a program that reads a line of text, changes each uppercase letter to lowercase, and places each letter both in a queue and onto a stack. The program should then verify whether the line of text is a palindrome (a set of letters or numbers that is the same whether read forward or backward). Please use a Queue Class and Stack class.

In: Computer Science

1. Copying and pasting from the Internet can be done without citing the Internet page, because...

1. Copying and pasting from the Internet can be done without citing the Internet page, because everything on the Internet is common knowledge and can be used without citation. True False

2. You don’t have to use quotation marks when you quote an author as long as you cite the author’s name at the end of the paragraph. True False

3. When you summarize a block of text from another work, citing the source at the end of your paper is sufficient. True False

4. If you quote your roommate in an interview, you don’t have to cite him/her or use quotation marks. True False

5. You don't have to cite famous proverbs because they’re common knowledge. True False

6. If you borrow someone's idea and use it in a paper, you don’t have to cite it. True False

7. Using a few phrases from an article and mixing them in with your own words is not plagiarism. True False

8. Song lyrics don't have to be cited. True False

9. If you come across the phrase "to be or not to be" and use it in your paper, you have to cite it. True False

10. The date for George Washington’s birthday is common knowledge which means you don't have to cite the source in which you found it. True False

In: Computer Science