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

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

Jeff decides to start saving some money from this upcoming

Jeff decides to start saving some money from this upcoming month onwards. He decides to save only $500 at first, but each month he will increase the amount invested by $100. He will do it for 60 months (including the fir ...

Suppose you make 30 annual investments in a fund that pays

Suppose you make 30 annual investments in a fund that pays 6% compounded annually. If your first deposit is $7,500 and each successive deposit is 6% greater than the preceding deposit, how much will be in the fund immedi ...

Question -under what circumstances is it ethical if ever to

Question :- Under what circumstances is it ethical, if ever, to use consumer information in marketing research? Explain why you consider it ethical or unethical.

What are the differences between four types of economics

What are the differences between four types of economics evaluations and their differences with other two (budget impact analysis (BIA) and cost of illness (COI) studies)?

What type of economic system does norway have explain some

What type of economic system does Norway have? Explain some of the benefits of this system to the country and some of the drawbacks,

Among the who imf and wto which of these governmental

Among the WHO, IMF, and WTO, which of these governmental institutions do you feel has most profoundly shaped healthcare outcomes in low-income countries and why? Please support your reasons with examples and research/doc ...

A real estate developer will build two different types of

A real estate developer will build two different types of apartments in a residential area: one- bedroom apartments and two-bedroom apartments. In addition, the developer will build either a swimming pool or a tennis cou ...

Question what some of the reasons that evolutionary models

Question : What some of the reasons that evolutionary models are considered by many to be the best approach to software development. The response must be typed, single spaced, must be in times new roman font (size 12) an ...

  • 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