Questions
What are three of your favorite Web 2.0 technologies or Web sites? Explain what is so...

What are three of your favorite Web 2.0 technologies or Web sites? Explain what is so great about each of them and how they might be improved.

(Dont copy previous answers)

In: Computer Science

A) What happens when a software Interrupt occurs? Write steps briefly?    B) Differentiate between maskable...

A) What happens when a software Interrupt occurs? Write steps briefly?   

B) Differentiate between maskable and non-maskable interrupts?

C) How are the multiplexed bus of 8086 demultiplexed?

D) Find the address range when a 2K x 8 memory is interfaced with 8086/8088?

In: Computer Science

The centered average of a list of numbers is the arithmetic mean of all the numbers...

The centered average of a list of numbers is the arithmetic mean of all the numbers in the list, except for the smallest and largest values. If the list has multiple copies of the smallest or largest values, only one copy is ignored when calculating the mean. For example, given the list [1, 1, 5, 3 5, 10, 8, 7], one 1 and 10 are ignored, and the centered average is the mean of the remaining values; that is, 5.2. Use the function design recipe to develop a function named centered_average. The function takes a list of integers. (Assume that the list has at least three integers). The function returns the centered average of the list. Hint: In this exercise you are permitted and encouraged to use Python's min and max functions.

**** YOU CANNOT USE THE FOLLOWING:

list slicing (e.g., lst[i : j] or (lst[i : j] = t)  the del statement (e.g., del lst[0])  Python's built-in reversed and sorted functions.  any of the Python methods that provide list operations; e.g., append, clear , copy , count, extend, index, insert, pop, remove, reverse and sort  list comprehensions

In: Computer Science

You must program the game called MaDi which is described below. There is a board of...

You must program the game called MaDi which is described below. There is a board of NxN (the size N is defined by the user and must be a number greater than or equal to 2), where in each box there is an instruction. The first (the [0] [0]) and the last box (the [N-1] [N-1]) have no instruction. Possible instructions are:
1. Don't move
2. Advance 4 places
3. Jump to the next row
4. Go back 2 places
5. It exploded! End of the game.
In order to facilitate the visualization of the matrix for the player, the instruction number will be displayed on the board and below it the list of instructions with their numbering.
Instructions:
1. Don't move
2. Advance 4 places
3. Jump to the next row
4. Go back 2 places
5. Bomb! Exploded.
The instruction that goes in each square of the board will be assigned randomly each time the game starts.
The player starts with his chip in the first position (row: 0, column: 0) and (bottom-right corner). On each turn the player rolls a die that will tell him how many spaces to advance. You advance across the board from left to right and from top to bottom as follows:
On each turn the player rolls a dice that tells him how many positions on the board to advance. After advancing, he must execute what is indicated in the instruction of the box where he fell. For each turn, only execute one instruction on the board. The player has a maximum number of rolls of the dice, which will be asked to the player when starting the game.
The game is lost if the dice are thrown without having reached the goal or if the product of rolling the dice advances to a square with a bomb. The game is won if you reach the goal (it does not have to be by exact count) before the roll of the dice runs out.

In: Computer Science

Write a function that plots the following trajectory equations using python turtle graphics. x = v*sin(A)*t...

Write a function that plots the following trajectory equations using python turtle graphics.

x = v*sin(A)*t

y = v*cos(A)*t -.5*(9.8)*t**2

Loop through t starting at 0 and increment by .1 until y<=0. (hint, while loop) Experiment with values of velocity V (1 to 20) and angle A (0 to 90) that gives you a good plot that does not go off the screen. Position the start of the plot at the left bottom of the screen

In: Computer Science

1- Write a class called MedicalStaff that is a Person (the class that you wrote in...

1- Write a class called MedicalStaff that is a Person (the class that you wrote in last lab). A MedicalStaff has specialty (i.e. Orthopedic, cardiology, etc.).

2- Then write two classes:

Doctor class has office visit fee.

Nurse class has title (i.e. RN, NP, etc.)

Both classes inherit from MedicalStaff.

Be sure these are all complete classes, including toString method.

3- Write a tester to test these classes and their methods, by creating an array or ArrayList of Person and adding different kinds of objects (MedicalStaff, Doctor, Nurse) to it.
Now that you know polymorphism, you don't need to create specific references for each object.

4- Print the list of Person items by calling toString method in a for-each loop.

The Person class was,

public class Person { // Decalring super class//
private String name; // attributes
private int birthYear;

public Person(String n, int y) {
this.name = n;
this.birthYear = y;
}

public Person() {
name = "";
birthYear = 0;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public int getbirthYear() {
return birthYear;
}

public void setbirthYear(int birthYear) {
this.birthYear = birthYear;
}

public String toString() {
return "Person [name=" + name + ", birthYear=" + birthYear + "]";
}

}

In: Computer Science

Question #1 The commented codes in the Driver class are either causing a syntax error or...

Question #1

The commented codes in the Driver class are either causing a syntax error or run time error. Make sure to identify the error yourself without running it.

predict the output once you fix all the errors.

  1. un-comment one line at a time
  2. identify the error
  3. fix just that line, You are not allowed to change any declarations of the objects.
  4. if it is a runtime error explain the error
  5. compile the code.
  6. move to the next error

Make sure you are able to answer similar question if it appears in the exam.

public class Cup extends Box {
    public void method1() {
        System.out.println("Cup 1");
    }

    public void method2() {
        System.out.println("Cup 2");
        super.method2();
    }
}

 class Pill {
    public void method2() {
        System.out.println("Pill 2");
    }
}

class Jar extends Box {
    public void method1() {
        System.out.println("Jar 1");
    }

    public void method2() {
        System.out.println("Jar 2");
    }
}

class Box extends Pill {
    public void method2() {
        System.out.println("Box 2");
    }

    public void method3() {
        method2();
        System.out.println("Box 3");
    }
}
class Driver
{
  public static void main(String[] args)
  {
      Box var1 = new Box();
      Pill var2 = new Jar();
      Box var3 = new Cup();
      Box var4 = new Jar();
      Object var5 = new Box();
      Pill var6 = new Pill();
      var1.method2();
      var2.method2();
      var3.method2();
      var4.method2();
     // var5.method2();  //error
      var6.method2();
      var1.method3();
     // var2.method3();//error
      var3.method3();
      var4.method3();
      //((Cup)var1).method1(); //runtime error
      ((Jar)var2).method1();
      ((Cup)var3).method1();
     // ((Cup)var4).method1(); //runtime error
      ((Jar)var4).method2();
      ((Box)var5).method2();
     // ((Pill)var5).method3();//error
      ((Jar)var2).method3();
      ((Cup)var3).method3();
     // ((Cup)var5).method3();//runtime error
      

  }

}

****************************************************************************************************************

Question 2

Comparable Programming. Suppose you have a pre-existing class BankAccount that represents users' accounts and money deposited at a given bank. The class has the following data and behavior:

Field/Constructor/Method

Description

private String name

name of the person using the account

private int id

ID number of this account

private double balance

amount of money currently in the account

public BankAccount(String name, int id)

makes account with given name/ID and $0.00

public void deposit(double amount)

adds given amount to account's balance

public int getID()

returns the account's ID number

public String getName()

returns the account's name

public double getBalance()

returns the account's balance

public String toString()

returns String such as "Ed Smith: $12.56"

public void withdraw(double amount)

subtracts given amount from account's balance

Make BankAccount objects comparable to each other using the Comparable interface.

use the following rules to implement the compareTo method

  • The bank wants to sort by who has the most money, so accounts are compared by balance.
  • One with a lower balance is considered to be "less than" one with a higher balance.
  • If two accounts have the same balance, they are compared by ID.
  • The one with the lower ID is considered to be "less than" the one with the higher ID.
  • If two accounts have the same balance and ID, they are considered to be "equal." Your method should not modify any account's state. You may assume the parameter passed is not null.

public class BankAccount implements Comparable {

    public int compareTo(Object o) {
         BankAccount other = (BankAccount)o;
        if (balance > other.getBalance()) {

            return 1;

        } else if (balance < other.getBalance()) {

            return -1;

        } else if (id > other.getID()) {

            return 1;

        } else if (id < other.getID()) {

            return -1;

        } else {

            return 0;

        }

    }

}

****************************************************************************************************************

Question 3

Add a compreTo method to the Passenger class that you created for the previous assignment. Passengers should be compared based on their last names. If two passengers have the same last name then the seat numbers must be compared.

Solution

 public int compareTo(Object o)
  {
     Passenger p = (Passenger)o;
     //checking to see if the last names are the same, if it is then compare based on the seat number
     if (this.getLast().equalsIgnoreCase(p.getLast()))   
         return this.seatNumber - p.seatNumber; 
     else
      return  this.getLast().compareTo(p.getLast());     //if the last names are not the same then compare the last names  
        
  }

PreviousNext

****************************************************************************************************************

Question 4

You should be able to answer the following questions

Part 1.create an interface called Incrementable that has two methods called increment and decrement. both of these methods have a parameter of type integer and they don't return anything.

part 2:

The following code does not compile. what is the issue? how can you fix the problem

interface Pay
{
   public double getRaise();
   public String getPromotion(double num);
}
class Secretary implements Pay
{
   public Secretary()
   {
   }
   public void getRaise()
   {
      System.out.println("You got a Raise");
   }
   public double getPromotion(int num)
   {
      System.out.println("You got " +num + " promotion");
   }
} 

dsfdfdf

PreviousNext

****************************************************************************************************************

question 5

Suppose that the following two classes have been declared:

 public class Car {
    public void m1() {
        System.out.println("car 1");
    }
​
    public void m2() {
        System.out.println("car 2");
    }
​
    public String toString() {
        return "vroom";
    }
}
class Truck extends Car {
    public void m1() {
        System.out.println("truck 1");
    }
     
    public void m2() {
        super.m1();
    }
     
    public String toString() {
        return super.toString() + super.toString();
    }
}

Write a class MonsterTruck whose methods have the behavior below. Don't just print/return the output; use inheritance to reuse behavior from the superclass.

Method Output/Return
m1 : monster 1
m2 : truck 1

car 1
toString: "monster vroomvroom"

Solution

 class MonsterTruck extends Truck
 {
   public void m1()
   {
      System.out.println("Monster 1");
   }
   public void m2()
   {
      super.m1();
      super.m2();
   }
   public String toString()
   {
      return "Monster "+ super.toString();
   }
    } 
class Driver
{
   public static void main(String[]args)
   {
      MonsterTruck m = new MonsterTruck();
      m.m1();
      m.m2();
      System.out.println(m);
      
   }
}

your turn:

the following classes have been created.

class Eye extends Mouth {
    public void method1() {
       System.out.println("Eye 1");
        
    }
}

 class Mouth {
    public void method1() {
        System.out.println("Mouth 1");
    }

    public void method2() {
        System.out.println("Mouth 2");
        
    }
}

class Nose extends Eye {
    public void method1() {
        System.out.println("Nose 1");
    }

    public void method3() {
        System.out.println("Nose 3");
    }
}




create a class called Ear that extends Nose. this class must implement the method1, method2, method3 . After creating the Ear class the following drive should generate the given output

 class Driver
{
   public static void main(String[] args)
   {
      Ear e = new Ear();
      System.out.println("calling method 1");
      e.method1();
      System.out.println("calling the method 2");
      e.method2();
      System.out.println("calling the method 3");
      e.method3();
   }
}

Output: 
calling method 1
Nose 1
Ear1
calling the method 2
Ear 2
Mouth 2
calling the method 3
Ear 3
Nose 1

public class Ear extends  Nose
{
    //your code
}

****************************************************************************************************************

Question 6

The following classes have been created.

public class Plate
{
    public void method1()
    {
      System.out.println("Plate");
    }
}
class Fork 
{
  public void method2()
  {
     System.out.println("Fork");
  }
}
class Spoon
{
   public void method3()
   {
      System.out.println("Spoon");
   }
}

The following driver has been created but it does not compile. what is the cause of the error and how can you fix it.

class Driver
{
   public static void main(String[] args)
   {
     Object[] stuff = {new Spoon(), new Fork(), new Plate()};
     for(int i = 0; i < stuff.length; i++)
     {
         stuff[i].method1();
         Stuff[i].method2();
         stuff[i].method3();
     }
   }
}

solution: since there is an array of Objects, every element in the array must be type casted to the proper type. then the method from the class can be called on it.

class Driver
{
   public static void main(String[] args)
   {
     Object[] stuff = {new Spoon(), new Fork(), new Plate()};
     for(int i = 0; i < stuff.length; i++)
     {
         if(stuff[i] instanceof Plate)
         {
            Plate p = (Plate)stuff[i];
            p.method1();
         }
         else if(stuff[i] instanceof Fork)
         {
            Fork f = (Fork)stuff[i];
            f.method2();
         }
         else if(stuff[i] instanceof Spoon)
         {
            Spoon s = (Spoon)stuff[i];
            s.method3();
         }

    }
   }
}

****************************************************************************************************************

Question 7

There will one question related to ArrayList class similar to the following question.

The following driver has created a an ArrayList of Point objects. write a method that moves all the points with the value of x greater than its value of y to the end of the list. .  

import java.util.*;
public class ArrayistQuestion
{
  public static void main(String[] args)
  {
     ArrayList<Point> points = new ArrayList<Point>();
     points.add(new Point(12, 5));
     points.add(new Point(2,23));
     points.add(new Point(6,3));
     points.add(new Point(9,2));
     points.add(new Point(12,23));
     System.out.println(points);
     shift(points);
     System.out.println(points);
  }
  //this method shifts all the points with x greater than y to the end of the list
  public static void shift(ArrayList<Point> list)
  {
     int count = list.size();
     for(int i = 0; i < count; i++)
     {
        if(list.get(i).getX() > list.get(i).getY())
        {
           Point p = list.get(i); //make a copy of the Point object
           list.remove(i);//removes it from the list
           list.add(p);  // adds it ot the endof the list
           i--;
           count--; // decrement the count by 1 since one element has been removed
        }
     }
  }
}
class Point
{
   private int x;
   private int y;
   public Point(int x, int y)
   {
     this.x = x;
     this.y = y;
   }
   public int getX()
   {
     return x;
   }
   public int getY()
   {
     return y;
   }
   public String toString()
   {
     return "(x = "+ x + " y = " + y+" )";
   }
   }

****************************************************************************************************************

In: Computer Science

This is based on LinkedLists. Please complete the methods max() and threshold(). I'd greatly appreciate it....

This is based on LinkedLists. Please complete the methods max() and threshold(). I'd greatly appreciate it. There is a type mismatch in my first method and I dont know how to get around it. I've commented on the line with the type mismatch. Please write a correct method in the answer so I can compare it to my wrong method

public class Node {
   public T info;
public Node link;
public Node(T i, Node l) {
   info = i; link = l;
   }
}

class LinkedList> {
  
protected Node head = null;
public LinkedList add(T el) {
head = new Node(el, head);
return this;
}
public void print() {
for(Node node = head; node!=null; node=node.link) {
System.out.print(node.info+" ");
}
System.out.println("");
}
  
public T maxValue() { // Note: Recursive methods not allowed, using new key word not allowed, no iterators allowed
   if (head == null) {
   return null;
   }
   else {
   Node temp = head;
   if (temp.link == null) {
   return temp.info;
   }
   else {
   T max = temp.link; //type mismatch
   if (temp.info.compareTo(max) > 0)
   max = temp.info;
   return max;
   }
}
}
  
public void threshold(T thres) {//Note: Recursive methods not allowed, using new key word not allowed, no iterators allowed

}

public static void main(String args[]) {
  
LinkedList list = new LinkedList();
System.out.println(list.maxValue()); // should be null
list.add(20).add(30).add(10);
System.out.println(list.maxValue()); // should be 30
list.threshold(40);
list.print(); // should print out all elements
list.threshold(30);
list.print(); // should print out 10 20
list.threshold(10);
list.print(); // should print nothing
}
}

In: Computer Science

To get some practice with recursion. You can do all this in one driver program. Write...

To get some practice with recursion.

You can do all this in one driver program.

Write a recursive method to compute the result of the Fibonacci sequence:

Fibonacci(N) = Fibonacci(N -1) + Fibonacci(N-2)

N == 0 is 0

N == 1 is 1

Testing: Display the result for Fibonacci(N) and the number of function calls for N = 2, 5 and 10.

In: Computer Science

CODE IN JAVA Create a new class named Task1. In its main function, use Scanner to...

CODE IN JAVA

Create a new class named Task1. In its main function, use Scanner to read integers from the keyboard with the method nextInt. Use a try catch block to capture non-integer input, and tell the user, "This is not an Integer". The program loop should end when the user enters the string "quit". (Hint: "quit" is clearly not a number and will be captured in the try / catch block.)

A typical Output Dialog is shown below:

Enter an Integer: 5
You typed.......: 5

Enter an Integer: 91
You typed.......: 91

Enter an Integer: 8.7
>>> That is not an Integer!

Enter an Integer: 34
You typed.......: 34

Enter an Integer: Isabelle
>>> That is not an Integer!

Enter an Integer: 45
You typed.......: 45

Enter an Integer: quit
::: End Program

In: Computer Science

Describe how the Round Robin Scheduling algorithm works. Explain the differences of working procedure between preemptive...

Describe how the Round Robin Scheduling algorithm works. Explain the differences of working procedure between preemptive and non-preemptive version of this algorithm.

In: Computer Science

Task 1 Please import the “admit.csv” into Rstudio. In this dataset, we know the GRE score,...

Task 1

Please import the “admit.csv” into Rstudio. In this dataset, we know the GRE score, the GPA, and the rankof 400 applicants for a graduate program. We also know if each of the candidates is admitted. In the admit column, 1 stands for admitted, and 0 stands for rejected. Please answer the following questions and include the codes.

1. import the dataset and call it "mydata". Then check the structure of the data

2. convert the data type of the admit and the rank column from int to factors

3. randomly select 80% of the dataset as training set and the rest as the testing set

4. train a decision tree model, using admit as the category, and gre, gpa, and rank as predictors. Then plot the tree

5. Please answer the question: if a candidate has a GPA of 3.7, and rank of 4, does this candidate have a higher chance to be admitted or to be rejected? Please note that when you only have two categories, the darker proportion stands for the proportion for 1 in the end node of the tree plot

6. Please calculate the accuracy of your decision tree model



admit,gre,gpa,rank
0,380,3.61,3
1,660,3.67,3
1,800,4,1
1,640,3.19,4
0,520,2.93,4
1,760,3,2
1,560,2.98,1
0,400,3.08,2
1,540,3.39,3
0,700,3.92,2
0,800,4,4
0,440,3.22,1
1,760,4,1
0,700,3.08,2
1,700,4,1
0,480,3.44,3
0,780,3.87,4
0,360,2.56,3
0,800,3.75,2
1,540,3.81,1
0,500,3.17,3
1,660,3.63,2
0,600,2.82,4
0,680,3.19,4
1,760,3.35,2
1,800,3.66,1
1,620,3.61,1
1,520,3.74,4
1,780,3.22,2
0,520,3.29,1
0,540,3.78,4
0,760,3.35,3
0,600,3.4,3
1,800,4,3
0,360,3.14,1
0,400,3.05,2
0,580,3.25,1
0,520,2.9,3
1,500,3.13,2
1,520,2.68,3
0,560,2.42,2
1,580,3.32,2
1,600,3.15,2
0,500,3.31,3
0,700,2.94,2
1,460,3.45,3
1,580,3.46,2
0,500,2.97,4
0,440,2.48,4
0,400,3.35,3
0,640,3.86,3
0,440,3.13,4
0,740,3.37,4
1,680,3.27,2
0,660,3.34,3
1,740,4,3
0,560,3.19,3
0,380,2.94,3
0,400,3.65,2
0,600,2.82,4
1,620,3.18,2
0,560,3.32,4
0,640,3.67,3
1,680,3.85,3
0,580,4,3
0,600,3.59,2
0,740,3.62,4
0,620,3.3,1
0,580,3.69,1
0,800,3.73,1
0,640,4,3
0,300,2.92,4
0,480,3.39,4
0,580,4,2
0,720,3.45,4
0,720,4,3
0,560,3.36,3
1,800,4,3
0,540,3.12,1
1,620,4,1
0,700,2.9,4
0,620,3.07,2
0,500,2.71,2
0,380,2.91,4
1,500,3.6,3
0,520,2.98,2
0,600,3.32,2
0,600,3.48,2
0,700,3.28,1
1,660,4,2
0,700,3.83,2
1,720,3.64,1
0,800,3.9,2
0,580,2.93,2
1,660,3.44,2
0,660,3.33,2
0,640,3.52,4
0,480,3.57,2
0,700,2.88,2
0,400,3.31,3
0,340,3.15,3
0,580,3.57,3
0,380,3.33,4
0,540,3.94,3
1,660,3.95,2
1,740,2.97,2
1,700,3.56,1
0,480,3.13,2
0,400,2.93,3
0,480,3.45,2
0,680,3.08,4
0,420,3.41,4
0,360,3,3
0,600,3.22,1
0,720,3.84,3
0,620,3.99,3
1,440,3.45,2
0,700,3.72,2
1,800,3.7,1
0,340,2.92,3
1,520,3.74,2
1,480,2.67,2
0,520,2.85,3
0,500,2.98,3
0,720,3.88,3
0,540,3.38,4
1,600,3.54,1
0,740,3.74,4
0,540,3.19,2
0,460,3.15,4
1,620,3.17,2
0,640,2.79,2
0,580,3.4,2
0,500,3.08,3
0,560,2.95,2
0,500,3.57,3
0,560,3.33,4
0,700,4,3
0,620,3.4,2
1,600,3.58,1
0,640,3.93,2
1,700,3.52,4
0,620,3.94,4
0,580,3.4,3
0,580,3.4,4
0,380,3.43,3
0,480,3.4,2
0,560,2.71,3
1,480,2.91,1
0,740,3.31,1
1,800,3.74,1
0,400,3.38,2
1,640,3.94,2
0,580,3.46,3
0,620,3.69,3
1,580,2.86,4
0,560,2.52,2
1,480,3.58,1
0,660,3.49,2
0,700,3.82,3
0,600,3.13,2
0,640,3.5,2
1,700,3.56,2
0,520,2.73,2
0,580,3.3,2
0,700,4,1
0,440,3.24,4
0,720,3.77,3
0,500,4,3
0,600,3.62,3
0,400,3.51,3
0,540,2.81,3
0,680,3.48,3
1,800,3.43,2
0,500,3.53,4
1,620,3.37,2
0,520,2.62,2
1,620,3.23,3
0,620,3.33,3
0,300,3.01,3
0,620,3.78,3
0,500,3.88,4
0,700,4,2
1,540,3.84,2
0,500,2.79,4
0,800,3.6,2
0,560,3.61,3
0,580,2.88,2
0,560,3.07,2
0,500,3.35,2
1,640,2.94,2
0,800,3.54,3
0,640,3.76,3
0,380,3.59,4
1,600,3.47,2
0,560,3.59,2
0,660,3.07,3
1,400,3.23,4
0,600,3.63,3
0,580,3.77,4
0,800,3.31,3
1,580,3.2,2
1,700,4,1
0,420,3.92,4
1,600,3.89,1
1,780,3.8,3
0,740,3.54,1
1,640,3.63,1
0,540,3.16,3
0,580,3.5,2
0,740,3.34,4
0,580,3.02,2
0,460,2.87,2
0,640,3.38,3
1,600,3.56,2
1,660,2.91,3
0,340,2.9,1
1,460,3.64,1
0,460,2.98,1
1,560,3.59,2
0,540,3.28,3
0,680,3.99,3
1,480,3.02,1
0,800,3.47,3
0,800,2.9,2
1,720,3.5,3
0,620,3.58,2
0,540,3.02,4
0,480,3.43,2
1,720,3.42,2
0,580,3.29,4
0,600,3.28,3
0,380,3.38,2
0,420,2.67,3
1,800,3.53,1
0,620,3.05,2
1,660,3.49,2
0,480,4,2
0,500,2.86,4
0,700,3.45,3
0,440,2.76,2
1,520,3.81,1
1,680,2.96,3
0,620,3.22,2
0,540,3.04,1
0,800,3.91,3
0,680,3.34,2
0,440,3.17,2
0,680,3.64,3
0,640,3.73,3
0,660,3.31,4
0,620,3.21,4
1,520,4,2
1,540,3.55,4
1,740,3.52,4
0,640,3.35,3
1,520,3.3,2
1,620,3.95,3
0,520,3.51,2
0,640,3.81,2
0,680,3.11,2
0,440,3.15,2
1,520,3.19,3
1,620,3.95,3
1,520,3.9,3
0,380,3.34,3
0,560,3.24,4
1,600,3.64,3
1,680,3.46,2
0,500,2.81,3
1,640,3.95,2
0,540,3.33,3
1,680,3.67,2
0,660,3.32,1
0,520,3.12,2
1,600,2.98,2
0,460,3.77,3
1,580,3.58,1
1,680,3,4
1,660,3.14,2
0,660,3.94,2
0,360,3.27,3
0,660,3.45,4
0,520,3.1,4
1,440,3.39,2
0,600,3.31,4
1,800,3.22,1
1,660,3.7,4
0,800,3.15,4
0,420,2.26,4
1,620,3.45,2
0,800,2.78,2
0,680,3.7,2
0,800,3.97,1
0,480,2.55,1
0,520,3.25,3
0,560,3.16,1
0,460,3.07,2
0,540,3.5,2
0,720,3.4,3
0,640,3.3,2
1,660,3.6,3
1,400,3.15,2
1,680,3.98,2
0,220,2.83,3
0,580,3.46,4
1,540,3.17,1
0,580,3.51,2
0,540,3.13,2
0,440,2.98,3
0,560,4,3
0,660,3.67,2
0,660,3.77,3
1,520,3.65,4
0,540,3.46,4
1,300,2.84,2
1,340,3,2
1,780,3.63,4
1,480,3.71,4
0,540,3.28,1
0,460,3.14,3
0,460,3.58,2
0,500,3.01,4
0,420,2.69,2
0,520,2.7,3
0,680,3.9,1
0,680,3.31,2
1,560,3.48,2
0,580,3.34,2
0,500,2.93,4
0,740,4,3
0,660,3.59,3
0,420,2.96,1
0,560,3.43,3
1,460,3.64,3
1,620,3.71,1
0,520,3.15,3
0,620,3.09,4
0,540,3.2,1
1,660,3.47,3
0,500,3.23,4
1,560,2.65,3
0,500,3.95,4
0,580,3.06,2
0,520,3.35,3
0,500,3.03,3
0,600,3.35,2
0,580,3.8,2
0,400,3.36,2
0,620,2.85,2
1,780,4,2
0,620,3.43,3
1,580,3.12,3
0,700,3.52,2
1,540,3.78,2
1,760,2.81,1
0,700,3.27,2
0,720,3.31,1
1,560,3.69,3
0,720,3.94,3
1,520,4,1
1,540,3.49,1
0,680,3.14,2
0,460,3.44,2
1,560,3.36,1
0,480,2.78,3
0,460,2.93,3
0,620,3.63,3
0,580,4,1
0,800,3.89,2
1,540,3.77,2
1,680,3.76,3
1,680,2.42,1
1,620,3.37,1
0,560,3.78,2
0,560,3.49,4
0,620,3.63,2
1,800,4,2
0,640,3.12,3
0,540,2.7,2
0,700,3.65,2
1,540,3.49,2
0,540,3.51,2
0,660,4,1
1,480,2.62,2
0,420,3.02,1
1,740,3.86,2
0,580,3.36,2
0,640,3.17,2
0,640,3.51,2
1,800,3.05,2
1,660,3.88,2
1,600,3.38,3
1,620,3.75,2
1,460,3.99,3
0,620,4,2
0,560,3.04,3
0,460,2.63,2
0,700,3.65,2
0,600,3.89,3

In: Computer Science

1. What is the average waiting time for Processes If the Operating System uses the Shortest-Job-First...

1. What is the average waiting time for Processes If the Operating System uses the Shortest-Job-First (SJF) Scheduling Algorithm?

(P1=5 ms, P2=10 ms, P3=15 ms)

2. How many page faults occur in the Optimum Page Replacement algorithm (OPR) with the following reference string for three-page frames?   

Reference String: 4,2,1,3,2,3,4,1

3. What is the average waiting time for Processes If the Operating System uses Shortest-Job-Remaining-First (SJRF) Scheduling Algorithm?

(P1=5 ms, P2=10 ms, P3=15 ms)

Arrival Time ( P1=0 ms, P2=5 ms, P3=10 ms)

4. What is the average waiting time for Processes If Operating System uses the First Come First Serve (FCFS) Scheduling Algorithm?

(P1=5 ms, P2=10 ms, P3=15 ms)

Process Order: P2, P1, P3

5. What is the average waiting time for Processes If the Operating System uses Round Robin (RR) Scheduling Algorithm?

(P1=5 ms, P2=10 ms, P3=15 ms)

Time slice/ quantum = 5 ms

6. What is the average waiting time for Processes If the Operating System uses the Priority Scheduling (PS) Scheduling Algorithm?

(P1=5 ms, P2=10 ms, P3=15 ms)

Priority Order: P3, P1, P2

7. How many page faults occur in the FIFO replacement algorithm with the following reference string for THREE-page frames?   

Reference String: 4,2,1,3,2,3,4,1

8. How many page faults occur in the Least Recently Used Algorithm (LRU) with the following reference string for three-page frames?   

Reference String: 4,2,1,3,2,3,4,1

In: Computer Science

Describe how the Shortest Job First (SJF)Scheduling algorithm works. Explain the differences of working procedure between...

Describe how the Shortest Job First (SJF)Scheduling algorithm works. Explain the differences of working procedure between preemptive and non-preemptive version of this algorithm.

In: Computer Science

Write a Python program: The function is named validity(). It receives 2 floating point parameters, min...

Write a Python program:

The function is named validity(). It receives 2 floating point parameters, min and max, from the program that invoked it. The function asks the user to enter a float number. Using a while loop it checks whether the number is valid (between min and max, inclusive). If not valid, the while loop uses this statement to prompt for a new number: num = float (input (" Enter a number that is at least :"+ str(min) + "and at most: "+ str(max) + " : ")). Once the function decides a number is valid, it returns it to the program. The program inputs 2 floating point numbers, max and min. It then invokes the validity() function with this statement: “validNum = validity(max,min)”. Once a valid number is returned to the program by the function. The program will print out the values of max, min, and the valid number returned.

In: Computer Science