Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Aims:

1. To ensure you understand the material discussed in lectures.

2. To give you practice in following the various algorithms discussed in the lectures.

Fill in the form fields as appropriate, save and submit via Blackboard.

The first ten questions are multiple choice questions. In each case there is only one correct answer for which 1 mark will be awarded. Incorrect or missing answers will score 0.

1. Which of the following tracks the progress of a program during execution?
A) process management
B) memory management
C) multiprogramming
D) timesharing
E) CPU scheduling

2. Which of the following is a technique for keeping more than one process in memory at the same time?
A) process management 
B) memory management 
C) multiprogramming 
D) timesharing 
E) CPU scheduling 

3. Which of the following shares CPU time among multiple processes to create the illusion that each user has a dedicated machine?
A) process management 
B) memory management 
C) multiprogramming 
D) timesharing 
E) CPU scheduling 

4. Which of the following describes a memory management technique in which a program is divided into fixed sized sections and stored into areas of memory called frames?
A) single contiguous 
B) logical address 
C) physical address 
D) round robin 
E) paged 

5. Which of the following describes the act of bringing in a page from secondary memory, which may cause another to be written back to secondary memory?
A) swapping 
B) context switch 
C) demand paging 
D) thrashing 
E) virtual memory 

6. Which of the following describes the situation in which memory appears to be unlimited because the program size is not restricted?
A) swapping 
B) context switch 
C) demand paging 
D) thrashing 
E) virtual memory 

7. To which state does the currently executing process return when it is interrupted by the operating system?
A) ready 
B) new 
C) blocked 
D) suspended 
E) running

8. In which state does a process reside if it is not currently resident in main memory?
A) ready 
B) new 
C) blocked 
D) suspended 
E) running 

9. In which state does a process reside if it does not have a needed resource, such as a page from secondary memory?
A) ready 
B) new 
C) blocked 
D) suspended 
E) running 

10. To which state does a process move when the CPU scheduling algorithm determines it may next use the CPU?
A) ready 
B) new 
C) blocked 
D) suspended 
E) running 

11. Consider the following Binary Search Algorithm

upper = length - 1;
lower = 1;
while (upper >= lower)
{ mid_pt = (upper + lower) / 2;
if(data[mid_pt] < target) ; comparison A
{ lower = mid_pt + 1; }
elseif (data[mid_pt] == target) ; comparison B
{ return mid_pt; }
else { upper = mid_pt - 1;}
}
//target not found

Give the values for lower, upper and mid-pt for each iteration of the while loop and state how many times will the two comparisons A and B be executed using this algorithm to find the value 77 in the following array? You may not need to complete all the rows.

[0]

[1]

[2]

[3]

[4]

[5]

[6]

[7]

[8]

[9]

[10]

[11]

[12]

14

27

29

38

42

55

57

61

64

69

77

79

84

Comparison A executed times;Comparison B executed times;

12. A Bubble Sort algorithm as discussed in lectures is given below

index1 = 1;
repeat exchange = false;
{ for index2 ← length- 1 downto index1
{ if data[index2] < data[index2-1]
{ //exchange
exchange = true;
tmp = data[index2];
data[index2] = data[index2-1];
data[index2-1] = tmp;
}
}
index1 = index1 + 1;
} until (not exchange)

Apply this algorithm to the following data. Give the contents of the array after each pass (repeat loop) is completed. For each pass how many exchanges are made?

Note it may not be necessary to use all 7 passes.

                          Original Data      14   27   12    56   63   72    8   10

          After     Pass 1                                            

                          Exchanges                

          After     Pass 2                                            

                         Exchanges                

          After     Pass 3                                            

                          Exchanges                

          After     Pass 4                                            

                          Exchanges                

          After     Pass 5                                                                                                                

                          Exchanges                

          After     Pass 6                                                                                                                

                          Exchanges                

          After     Pass 7                                                                                                                

                          Exchanges                

How many comparisons will be made in total?

13. Consider the following quicksort algorithm

Quicksort(first, last)
{IF (first < last) // There is more than one item
       splitVal = data[first];
       splitPoint = Split(splitVal);
       left= first + 1;
       right= last;
       WHILE (left <= right)
          {Increment left until data[left] > splitVal OR left > right;
           Decrement right until data[right] < splitVal OR left > right;
           IF(left < right)
           Swap data[left] and data[right]
           }
           splitPoint= right;
           Swap data[first] and data[splitPoint];
           Quicksort(first, splitPoint - 1);
           Quicksort(splitPoint + 1, last)
}

Each recursive call to the Quicksort function acts on a portion of the array to be sorted. Illustrate how the algorithm works on the same data as in the previous questions by completing the trace below. For each call of Quicksort give the index values for first and last as well as the value (splitVal) used as a pivot value. Also show the state of the array being sorted after the evaluation of all the Quicksort functions applied to the array.

You may not need to complete all the tables below.

Original Data

[0]

[1]

[2]

[3]

[4]

[5]

[6]

[7]

14

27

12

56

63

72

8

10

First

Last

splitVal

0

7

14

[0]

[1]

[2]

[3]

[4]

[5]

[6]

[7]

 

 

 

 

 

 

 

 

First

Last

splitVal

 

First

Last

splitVal

 

 

 

 

 

 

 

[0]

[1]

[2]

[3]

[4]

[5]

[6]

[7]

 

 

 

 

 

 

 

 

First

Last

splitVal

 

First

Last

splitVal

 

First

Last

splitVal

 

First

Last

splitVal

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

[0]

[1]

[2]

[3]

[4]

[5]

[6]

[7]

 

 

 

 

 

 

 

 

 

First

Last

splitVal

 

First

Last

splitVal

 

First

Last

splitVal

 

First

Last

splitVal

 

First

Last

splitVal

 

First

Last

splitVal

 

First

Last

splitVal

 

First

Last

splitVal

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

[0]

[1]

[2]

[3]

[4]

[5]

[6]

[7]

 

 

 

 

 

 

 

 

14. Complete the following table. Where appropriate you may use scientific notation (eg 1.5E+6)Give values to 6 significant figures.

n

log2n

log10n

n2

2n

nlog2n

1

 

 

 

 

 

5

 

 

 

 

 

10

 

 

 

 

 

50

 

 

 

 

 

100

 

 

 

 

 

500

 

 

 

 

 

1000

 

 

 

 

 

15. Complete the following table stating the start and end times for each process using the first-come, first-served algorithm.

Process

P1

P2

P3

P4

P5

Service time

40

70

100

20

80

Arrival Time

0

20

40

60

80

Start Time

 

 

 

 

 

End Time

 

 

 

 

 

16. Complete the following table stating the start and end times for each process using the shortest-job-next algorithm.

Process

P1

P2

P3

P4

P5

Service time

40

70

100

20

80

Arrival Time

0

20

40

60

80

Start Time

 

 

 

 

 

End Time

 

 

 

 

 

17. Complete the following table stating the start, pause, restart and end times for each process (including any times when a process is swapped out) using the round robin algorithm and a time slice of 30. You may not need to complete all entries.

Process

P1

P2

P3

P4

P5

Service time

40

70

100

20

80

Arrival Time

0

20

40

60

80

Start Time

 

 

 

 

 

Pause

 

 

 

 

 

Restart

 

 

 

 

 

Pause

 

 

 

 

 

Restart

 

 

 

 

 

Pause

 

 

 

 

 

Restart

 

 

 

 

 

End Time

 

 

 

 

 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91972067

Have any Question?


Related Questions in Computer Engineering

Question whether in a scholarly or practitioner setting

Question: Whether in a scholarly or practitioner setting, good research and data analysis should have the benefit of peer feedback. For this Discussion, you will post your response to the hypothesis test, along with the ...

Fiona told her friend that she is very fortunate as the

Fiona told her friend that she is very fortunate as the slow-down in the economy has not decreased sales in her grocery store by much compared to sales of new cars in his car dealership. Explain what Fiona meant using th ...

Structureswrite the program in c onlytask create a seating

Structures Write the Program in C++ only. Task: Create a seating reservation program for Podunk Airlines. The air fleet consists of a single plane with a seating capacity of 12. The plane makes one flight daily. Your pro ...

Given an undirected graph with both positive and negative

Given an undirected graph with both positive and negative edge weights, design an algorithm to find a maximum spanning forest with the largest total edge weights.

You have been recently promoted to it security manager your

You have been recently promoted to IT Security Manager. Your first job is to document the older hardware and software your company is currently using in the IT department. State the strengths and weaknesses with the curr ...

A chemistry student needsnbsp150 ml of acetone for an

A chemistry student needs 15.0 mL of acetone for an experiment. By consulting the  CRC Handbook of Chemistry and Physics , the student discovers that the density of acetone is 0.790 g.cm^-3. Calculate the mass of acetone ...

The second programming project involves writing a program

The second programming project involves writing a program that accepts an arithmetic expression of unsigned integers in postfix notation and builds the arithmetic expression tree that represents that expression. From tha ...

Software engineering problemdesign a software for

Software engineering problem: Design a software for restaurants to use, in order for restaurants to come up with the shortesh path of getting to houses in the order the orders came in, shows the deadline on each order to ...

Now assume that a country a takes 100 hours to produce 20

Now assume that a country A takes 100 hours to produce 20 aircraft or 10 jet engines and country B takes 100 hour to produce 15 aircraft or 5 jet engines. Which country has an absolute advantage in which product? Does ei ...

How can word processing software give a person the ability

How can Word Processing software give a person the ability to better position themself or a business, in today's society? Why?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As