Questions
               At execution time, calls to methods are resolved based on the type of the object to...

               At execution time, calls to methods are resolved based on the type of the object to which the reference refers to using a process called              

dynamic binding.

static binding.

symmetric binding.

none of the above

                Classes that can be used to instantiate objects are called

abstract classes.

concrete classes.

solid classes.

none of the above

               The keyword to use in the class declaration to indicate that it uses an interface is

inherits.

implements.

extends.

none of the above

                

              The UML expresses the relationship between a class and an interface through a                

realization relationship.

is-a relationship.

has-a relationship.

none of the above

                

                By default, interface methods are considered

private and abstract.

public and abstract.

abstract only.

none of the above

               

In: Computer Science

7. You have a hash function that takes the binary bits of a number, divides it...

7. You have a hash function that takes the binary bits of a number, divides it up into blocks of 4 bits and then XORs the blocks together. So for example, if we have 4 blocks, block X0, X1, X2 and X3, the result of the 4-bit block hash would be X0 XOR X1 XOR X2 XOR X3. For example, the hash of "011011001010" would be "0110" XOR "1100" XOR "1010". Demonstrate that this is a poor hash function by showing me a hash collision using this function and two different input strings of at least 8 bits.

In: Computer Science

Explain why Critical Infrastructures Systems are so hard to protect and provide a recommendation of how...

  1. Explain why Critical Infrastructures Systems are so hard to protect and provide a recommendation of how to fix issues these issues for these types of systems.
  2. Explain the three tiers of Risk Management and how they work together to provide a Risk Management Strategy for an Organization.
  3. Please explain the IRP Process. We discussed 5 steps concerning this.
  4. We talked about different Security Laws. In your opinion explain why it is so hard to pass an updated IT Security Law  
  5. Explain the Risk Management Process (4 tasks) and explain the 4 ways to respond to risk and provide an example of each.
  6. Explain the reason for having a Configuration Management Plan
  7. Explain why Critical Infrastructures Systems are so hard to protect and provide a recommendation of how to fix issues these issues for these types of systems.
  8. Explain the three tiers of Risk Management and how they work together to provide a Risk Management Strategy for an Organization.
  9. Please explain the IRP Process. We discussed 5 steps concerning this.
  10. We talked about different Security Laws. In your opinion explain why it is so hard to pass an updated IT Security Law  
  11. Explain the Risk Management Process (4 tasks) and explain the 4 ways to respond to risk and provide an example of each.
  12. Explain the reason for having a Configuration Management Plan

In: Computer Science

What does this program output (make sure you can explain why the output is what it...

What does this program output
(make sure you can explain why the output is what it is)

#include <iostream>
using namespace std;

class A {
   int i;
public:
   A() {cout << "A()\n" ;}
   A(int x) :i(x) {cout << "A(int)\n" ;}
   A(const A& a) : i(a.i) {cout << "A(const A&)\n" ;}
   ~A() {cout << "A()\n" ;}
};

class B {
   A a;
public:
   B() {cout << "B()\n" ;}
   B(int x) :a(x) {cout << "B(int)\n" ;}
   B(const B& b) : a(b.a) {cout << "B(const B&)\n" ;}
   ~B() {cout << "~B()\n" ;}
};

B func(B k) {return k;}

int main() {
   B b1(2), b2;
   b2=func(b1);
   return 0;
}

In: Computer Science

Create Course object class (Course.java) Course object should be the following attributes: Course id:12345 Instructor id:...

  • Create Course object class (Course.java)
    • Course object should be the following attributes:
      • Course id:12345
      • Instructor id: 9876
      • Room id: 101

I have everything written out but it won't compile, any help?

public class Course
{
   private int course id;
   private int instructor id;
   private int room id;

   Course()
   {
       setCourseID (13233);
       setInsID    (001);
       setRoomID    (101);
   }

   Course(int courseID, int instructorID, int roomID)
   {
       setCourseID    (courseID);
       setInsID        (instructorID);
       setRoomID        (roomID);
   }

   public int getCourseID()
   {
       return courseID;
}

public int getInsID()
   {
       return instructorID;
}

public int getRoomID()
   {
       return roomID;
}

{
       System.out.println("Course ID : " + getCourseID());
       System.out.println("Instructor ID : " + getInsID());
       System.out.println("Room ID : " + getRoomID());
   }
}


In: Computer Science

Write a C++ program to perform various calculations related to the fuel economy of a vehicle...

Write a C++ program to perform various calculations related to the fuel economy of a vehicle where the fuel economy is modeling using a polynomial of the form y = Ax2 + Bx + C, where

y = fuel economy in miles per gallon (mpg)

x = speed in miles per hour (mph)

In particular:

Inputs: The user should be prompted to input the following information.

The values for coefficients A, B, and C used to model the fuel efficiency

The capacity of the fuel tank (in gallons).

The current amount of fuel in the tank (in gallons).

The current speed of the vehicle (in mpg)

The distance to be travelled on the current trip (in miles)

The cost per gallon for gasoline

The minimum speed, Smin, to be used in the table of Fuel Economy vs Speed

The maximum speed, Smax, to be used in the table of Fuel Economy vs Speed

The speed increment, Sinc, to be used in the table of Fuel Economy vs Speed

Functions: The program should use at least 4 user-defined functions (in addition to main) as described below.

MPG(A, B, C, Speed) – This function returns the fuel economy in mpg for a given speed in mph.

PrintTable(Smin, Smax, Sinc A, B, C) – This function will print a table of Speed (in mpg) and Fuel Economy (in mpg).

Use the range of speeds indicated with the speed increment indicated.

This function should call the function MPG above.

Fuel economy should be calculated using the coefficients A, B, and C provided.

Include a table heading with units.

Display speeds as integers and fuel economy with 2 digits after the decimal point (include trailing zeros).

MaxEconomy(Smin, Smax, Sinc A, B, C, MaxMPG, MaxMPH) – This function will return the maximum mpg and the corresponding speed value using the speed range and increment specified. This function should call the function MPG above.

Use at least one more useful (user-defined) function to calculate one or more of the program outputs.

Outputs: The program output should include the following:

Neatly summarize the input values

A table of Speed and Fuel Economy values (created by the PrintTable function above).

The maximum fuel economy (in mpg) and the corresponding speed (determined by the MaxEconomy function above).

The fuel economy (in mpg) at the current speed

The minimum fuel economy (in mph) and the corresponding speed. Note: This does not always occur at the minimum speed.

For the current speed, trip distance, number of gallons currently in the tank, and cost per gallon for fuel (show the value of each), display the following:

The fuel economy (in mpg)

Speed for the trip (in mph)

The fuel cost for the trip.

The number of gallons that will be used for the trip.

The time to reach the destination.

State how many times you will need to stop for gas. Assume that the tank must be filled when it is 10% full.

State the number of gallons of gas will be left in the tank at the end of the trip.

State the number of miles until the next time the tank must be filled (after the trip).

Repeat the above if you drive at the speed for maximum fuel economy. Also state how many gallons of gas were saved and how much money was saved by driving at the speed for maximum fuel efficiency.

Use a suitable number of digits for all numeric outputs and include units when appropriate.

Error Checks: The program should check for appropriate ranges for inputs and allow the user to re-enter any incorrect inputs, including:

Fuel tank capacity: 0 to 20 gallons

Current amount of fuel in tank: 20% - 100% of fuel tank capacity

Current speed of vehicle: 20 to 80 mph

Distance to be travelled: Must be > 0

Cost per gasoline: Must be > 0

Minimum speed for table (Smin): Integer value where 20 < Smin < 50

Maximum speed for table (Smax): Integer value where (Smin + 10) < Smax < 80

Speed increment for table (Sinc): Integer value where 0 < Sinc < (Smax – Smin)/5

Re-running the Program: Include a loop that will give the user the option of re-running the program.

In: Computer Science

Question 1 The GCD is the greatest common denominator. Euclid found that if A=Bx +R then...

Question 1

The GCD is the greatest common denominator. Euclid found that if A=Bx +R then GCD(A,B)=GCD(A,R). Prove this is true. Show working

Question 2

The approach Euclid in calculating the GCD used was novel as it was an ________process to solve a complex problem, hence formed the first _______.

Question 3

The difference between a breadth first search (BFS) and a depth first search (DFS) is that in the DFS you traverse all the first branch before proceeding to the next branch.

a) True

b) False

  1. Question 4 If a Graph is defined as a diagram showing the relation between variable quantities, typically of two variables, each measured along one of a pair of axes at right angles, OR a diagram representing a system of connections or interrelations among two or more things by a number of distinctive dots, lines, bars, etc, which is correct?
    1. The first definition as graphs need axes

    2. The second definition as more general so covers all graphs

    3. Neither as they are too vague

Question 5

Find a c such that f(n) is O(n2) when f(n) = 1/4 n2 + 15 n + 115. Justify this answer.

Question 6

If f(n)= 10* log n then Big-O of f(n) is O(n)

a) True

b) False

In: Computer Science

Suppose we are given an arbitrary digraph G = (V, E) that may or may not...

Suppose we are given an arbitrary digraph G = (V, E) that may or may not be a DAG. Modify the topological ordering algorithm so that given an input G, it outputs one of the two things:

a. A topological ordering thus establishing that G is a DAG.

b. A cycle in G thus establishing that it is not a DAG.

The runtime of your algorithm should be O(m+n) where m = |E| and n = |V|

In: Computer Science

R PROGRAMMING QUESTION - Below I have code. For each double hashtag (##) can you comment...

R PROGRAMMING QUESTION

- Below I have code. For each double hashtag (##) can you comment on the code below it (Describe what is happening in the code below it next to each ##)

- Run the code and compare the confidence intervals

- I have to submit the confidence intervals, comments, and the code with the ## filled out

Leaps.then.press.plot.2<-function(xmat0,yvec,xpred,ncheck=20)

{

#

#input quadratic matrix with less than 30 columns eg. the result of x.auto2a<-matrix.2ndorder.make(xmat[,-7],F)

#also, no need for plotting, just pull out best, xpred is one of the row vectors from x.auto2a, but all terms with weight are divided by 2

#

   ##

   leaps.str<-leaps(xmat,yvec)

   ##

   z1<-leaps.str$Cp-leaps.str$size

   ##

   o1<-order(z1)

   matwhich<-(leaps.str$which[o1,])[1:ncheck,]

   MPSEvec<-NULL

   ##

   for(i in 1:ncheck){

       ls.str0<-regpluspress(xmat[,matwhich[i,]],yvec)

       ##

       parvec<-matwhich[i,]

       npar<-sum(parvec)

       ## (WHY npar+1)

       MPSE<-ls.str0$press/(length(yvec)-(npar+1))

       MPSEvec<-c(MPSEvec,MPSE)

   }

   ##

   I1<-(MPSEvec==min(MPSEvec))

   ##

   i<-c(1:ncheck)[I1]

   ##

   xmat.out<-xmat[,matwhich[i,]]

   ##

   xpred.out<-xpred[matwhich[i,]]

   ##

   list(xmatout=xmat.out,yvec=yvec,xpredout=xpred.out)

  

  

}

Bootreg<-function(xmat,yvec,xpred,nboot=10000,alpha=0.05)

{

   ##

   lstr0<-leaps.then.press.plot2(xmat,yvec,xpred)

   xmat0<-lstr0$xmat.out

   yvec0<-lstr0$yvec

   xpred0<-lsstr0$xpredout

   ##

   rprd.list<-regpred(xpred0,xmat0,yvec0)

   ypred0<-rprd.list$pred

   sdpred0<-rprd.list$sd

   df<-rprd.list$df

   ##

   bootvec<-NULL

   nobs<-length(yvec0)

   for(i in 1:nboot){

       ##

       vboot<-sample(c(1:nobs),replace=T)

       xmatb<-xmat0[vboot,]

       yvecb<-yvec0[vboot]

       ##

       lstrb<-leaps.then.press.plot2(xmatb,yvecb,xpred)

       ##

       xmatb0<-lstrb$xmat.out

       yvecb0<-lstrb$yvec

       xpredb0<-lsstrb$xpredout

       ##

       rprd.list<-regpred(xpred0,xmat0,yvec0)

       ypredb<-rprd.list$pred

       sdpredb<-rprd.list$sd

       dfb<-rprd.list$df

       ##

       bootvec<-c(bootvec,(ypredb-ypred0)/sdpredb)

}

##

lq<-quantile(bootvec,alpha/2)

uq<-quantile(bootvec,1-alpha/2)

##

LB<-ypred0-(sdpred0)*uq

UB<-ypred0-(sdpred0)*lq

##

NLB<-ypred0-(sdpred0)*qt(1-alpha/2,df0)

NUB<-ypred0+(sdpred0)*qt(1-alpha/2,df0)

list(bootstrap.confidence.interval=c(LB,UB),normal.confidence.interval=c(NLB,NUB))

}

> regpred<-

function(xpred,xmat,y){

##

ls.str<-lsfit(xmat,y)

#calculate prediction

ypred<-ls.str$coef%*%c(1,xpred)

#use ls.diag to extract covariance matrix

ycov<-ls.diag(ls.str)$cov.unscaled

#use ls.diag to extract std deviation

std.dev<-ls.diag(ls.str)$std.dev

#variance of data around line

v1<-std.dev^2

#variance of prediction

vpred<-v1*c(1,xpred)%*%ycov%*%c(1,xpred)

df=length(y)-length(diag(ycov))

list(pred=ypred,sd=sqrt(vpred),df=df)

}

In: Computer Science

Java only !!! Please write the following method that sorts an ArrayList of numbers: public static...

Java only !!! Please write the following method that sorts an ArrayList of numbers: public static void sort(ArrayList < Integer > list)

Prompts user to enter 5 ints stores them into an array list and display them in increasing order

In: Computer Science

Explain, with detailed examples, how Locard’s Exchange Principle will influence the forensic examination of a Solaris...

Explain, with detailed examples, how Locard’s Exchange Principle will influence the forensic examination of a Solaris Server.

In: Computer Science

Describe the process of writing and running a Java program, referringto the terms "run-time" and "compile-time"

Describe the process of writing and running a Java program, referringto the terms "run-time" and "compile-time"

In: Computer Science

Problem 2: Acronym Match                                      &nb

Problem 2: Acronym Match                                                                         (6 Points)

For each of the concepts given below, list which of the following acronyms apply:

802.3, 802.11, ARP, BGP, CIDR, CRC, CSMA/CD, DNS, FDMA, FTP, HTTP, IPv4, IPv6, ICMP, LAN, MTU, NIC, OSPF, RFC, RTT, SMTP, TCP, TDMA, TLD, TTL, UDP, URL

Not all acronyms are used. Unless otherwise stated, there is one acronym per concept.

  1. A way of interpreting IP addresses as having an initial (variable-length) network prefix, plus the remaining bits identifying a host within that network: _____________
  2. The IEEE standardization of Ethernet Medium Access: _____________
  3. 2 types of layer-4 protocols: _____________
  4. A term referring to a host’s network adaptor; Hardware device that handles an interface to a computer network and allows a network-capable device to access that network: _____________.
  5. The largest sized packet that can be sent across a link (or a network path) without requiring fragmentation: _____________.
  6. The style of MAC (Media Access Control) protocol used by Ethernet: _____________
  7. A scheme for computing a checksum value over a block of data in order to detect bit errors: _____________
  8. The time it takes to send a packet to a destination and hear a response back from it: _____________
  9. A counter in the IP header that is decreased at each hop; if it reaches 0, the packet is discarded (also refers to how long to keep a DNS response in a local cache): ________
  10. A way of sharing a link’s capacity among a group of senders in which each sender is assigned its own frequency to use when transmitting, which it can use to transmit whenever it pleases: _____________

[Good formatting, explanations and descriptions can fetch you additonal 10 points.]

In: Computer Science

In C++, please include main Goals  Identify requirements for a program using polymorphism  Create...

In C++, please include main

Goals

 Identify requirements for a program using polymorphism

 Create a program to demonstrate your class hierarchy

Requirements

In this project, you will create a simple class hierarchy as the basis for a fantasy combat game. Your ‘universe’ contains Vampires, Barbarians, Blue Men, Medusa and Harry Potter. Each has characteristics for attack, defense, armor, and strength points as follows. Type

Attack

Defense

Armor

Strength Points

Vampire1

1d12

1d6* Charm

1

18

Barbarian2

2d6

2d6

0

12


1. Suave, debonair, but vicious and surprisingly resilient!

2. Think Conan or Hercules from the movies. Big sword, big muscles, bare torso.

“3d6” is rolling three 6-sided dice, “2d10” is rolling two 10-sided dice, etc.

NOTE: The sample creatures are unbalanced intentionally. This will help you in debugging your program! Some will win a lot, and others will lose a lot.

To resolve an attack, you will need to generate 2 dice rolls. The attacker rolls the appropriate number and type of dice under Attack. The defender rolls the appropriate number and type of dice under Defense. You will subtract the Defense roll from the Attack roll. That is the damage to the defender.

Each class only has its own information or data. When O1 is fighting O2, your program should call O1’s attack function. It will return the damage inflicted. Then O2’s defense function will take the damage inflicted, roll the specified dice and subtract the damage points from the defense. To apply the damage, you subtract the Armor value. The result is then subtracted from the Strength Points. That value becomes the new Strength Points for the next round. If Strength Points goes to 0 or less, then the character is out of the combat. For example, if one object receives 9 points of damage and rolls 3 for its defense, and has an armor of 4 and strength point of 8, it would take 9 subtract 3, and then 4 for the armor, to receive 2 points of damage, and its new strength point will be 8-2=6.

Start with the base and Barbarian classes.

You need to create a Creature base class. Then you will have a subclass for each of these characters. Note that the Creature class will be an abstract class. For our purposes right now, each subclass will vary only in the values in the table. It is part of your design task to determine what functions you will need.

To play the game, write a menu. Display two fighters by their names and prompt the user to select two fighters to fight one another. Students must account for two fighters of the same type. Randomly select one fighter to attack first. The fighters will take turns fighting each other until one's Strength point is zero or negative. (You do not have to display results of each round of fighting, but you can do that for the purpose of debugging.) Then display the winning fighter to the screen. Ask users to play again or exit the game. This is the first stage of a larger project. Please do not add any creatures of your own.

In: Computer Science

Greedy algorithm for the minimum coin change problem (the number of required coins is given) function...

Greedy algorithm for the minimum coin change problem (the number of required coins is given)

function parameters :

- int amount = 20

- int Coins[] = [1, 5, 11, 25]

- int requiredCoins = 4

Expected result = 5,5,5,5,

****algorithm should be greedy, and find optimal solution***

You can provide the program or the algorithm

In: Computer Science