Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

kindly answer all synchronously via calls from user level? [13 marks] (b) In what way did the provision of a protected address space per process

kindly answer all

synchronously via calls from user level? [13 marks] (b) In what way did the provision of a protected address space per process affect the development of operating systems? Describe the hardware and software support for the development you mention in some detail

This assignment gives you an opportunity to learn about files, arrays, and pointers. A cost involves a Description, and an amount and An Item Number.

Write program that opens a file, reads records into a container of data structures, and prints out the sum in order. You can use Vectors to contain the data structures.

1. Create data structure to represent the record ==> struct Cost in cost.h 2. Write function called ==> parse_account, that parses one (string) record from a file, and populates a data structure with that data. 3. Write function called sum_accounts, that when passed a container of structures, returns a double representing the sum of the amounts in those structures. 4. Create main program a) Create ppropriate container of data structures b) Open the accounts file (costfile.txt) c) While you can read a line from the file without error Call parse_account, which returns a data structure. Add the returned data structure to the container (using, pushToV) d) Call sum_accounts to determine the amount of money represented e) Print a message and the result.

Try this with some sample data, such as the following lines in costfile.dat You may add or create your own data file to test the program with: You can start with the data in a text file and then write the data in a binary file, this way you practice with both file types.

I have the code that goes with this question just need a flowchart diagram?

Consider the following learning problem in which we wish to classify inputs, each consisting of a single real number, into one of two possible classes C1 and C2. There are three potential hypotheses where Pr(h1) =are the following functions hi(x) = x i 1 5 and the likelihood for any hypothesis h. You have seen three examples: (0.9, C1), (0.95, C2) and (1.3, C2), and you now wish to classify the new point x = 1.1. (a) Explain how in general the maximum a posteriori (MAP) classifier works. [3 marks] (b) Compute the class that the MAP classifier would predict in this case. [10 marks] (c) The preferred alternative to the MAP classifier is the Bayesian classifier, computing Pr(x C1|x, s). where s is the vector of examples. Show that Pr(x C1|x, s) = X hi Pr(x C1|hi , x) Pr(hi |s) What are you assuming about independence in deriving this result? [3 marks] (d) Compute the class that the Bayesian classifier would predict in this case. [4 marks

Write class called Course _xxx that represents a course taken at a school. Represent each student using the Student class from the Chapter 7 source files, Student.java. Use an ArraylList in the Course to store the students taking that course. The constructor of the Course class should accept only the name of the course. Provide a method called addStudent that accepts one Student parameter. Provide a method called roll that prints all students in the course. Create a driver class School xxx with a main method that creates a course, adds several students, and prints a rol. Submit School_xxxjava and Course ooxjava where xxox are your initials. Student.java public class Student private String firstName, lastName; private Address homeAddress. schoolAddress:

Explain the following Java words. For each write sentence giving an overview of what the word is about, then either write second sentence that shows how it fits in with related concepts or write a small code-fragment to illustrate its purpose: (a) abstract; (b) assert; (c) boolean; (d) break; (e) byte; (f ) case; (g) catch; (h) extends; (i) new; (j) null. [2 marks each] Please keep your explanations of each word brief so that your whole answer to this question remains a reasonable size: you are not expected to produce a detailed explanation or comprehensive illustration.

Consider the design of a Java application for the automated marking of exam questions on Java. The answer to each question consists of Java source code. Your application should read the text of each answer from a file, and check that actual lines of code expected by the examiner are included at any point in the answer. The examiners will want to calculate the average mark (out of 20) for each question, and also the total mark (out of 100) achieved by each candidate in a paper consisting of 5 questions. Model answers should take the form of an executable Java class, for example a class called question1model might contain the following method: protected void defineAnswer() { expectedLines.add("import java.io.*;"); expectedLines.add("public class helloWorld"); expectedLines.add("system.out.println(\"hello world\");"); } Provide a UML diagram showing the classes in the application, and write the basic code for each class, in order to achieve the above functionality. You may ignore error processing, and indicate repetitive passages of code by an ellipsis ". . .". [20 marks]

(a) Describe the four access regimes from public to private that may be applied to Java fields and methods. Why are they useful? [4 marks] (b) When you extend a class, the constructor for your new class will reference the constructor of the parent class, and this latter constructor may have any of the four possible access regimes. Comment on the consequences of each of the four possibilities. [4 marks] (c) If the only constructor for a class is marked as private, is it ever possible to have an instance of that class or any subclass of it? Explain why or why not. [2 marks]

T). At each time step all cells transform simultaneously. If a cell is dead, it becomes alive if it had (just before this time step) exactly three live neighbours. If it is alive, it becomes dead unless it has two or three live neighbours. In this question, locations beyond a 1000 1000 board are to be treated as permanently dead. (a) Show how to set up a simple Java 2-dimensional array of boolean values to represent a Life Board, with all cells initially "dead". [2 marks] (b) For a location (i, j) on the board, give code that will decide whether the next state of that cell should be alive or dead. Make it clear how your code copes if the cell is at the boundary of the board. [4 marks] (c) Referring to part (b), write code that takes one board representing the current state of the game and fills in a second board-array with the state arrived at after one time step. What would happen if instead of using two arrays you wrote the new cell state directly back, using just a single copy of the board? [3 marks] (d) Re-work your solution to part (c) so that you can perform a time step using just one board. You may need to use a 1000-element vector to store information in a way that makes the update safe. [7 marks] (e) All the code you have written so far uses an array of boolean values. Some programmers would instead use an array of int values and treat each of the 32 bits in each int as giving the status of a cell. Suppose you have a 2-dimensional array of integers of size 1024 by 32 (that size is chosen so the array of integers may be viewed as a 1024 by 1024 array of bits): give code to retrieve a bit from a given position (i, j). [4 marks]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions