Friday 7 October 2016

AMCAT Automata Paper III


 AMCAT-Q1 : A system that can run multiple concurrent jobs on a single CPU have a process of choosing which task hast to run when, and how to break them up, called “scheduling”. The Round-Robin policy for scheduling runs each job for a fixed amount of time before switching to the next job. The waiting time fora job is the total time that it spends waiting to be run. Each job arrives at particular time for scheduling and certain time to run, when a new job arrives, It is scheduled after existing jobs already waiting for CPU time
Given list of job submission, calculate the average waiting time for all jobs using Round-Robin policy.
The input to the function waitingTimeRobin consist of two integer arrays containing job arrival and run times, an integer n representing number of jobs and am integer q  representing the fixed amount of time used by Round-Robin policy. The list of job arrival time and run time sorted in ascending order by arrival time. For jobs arriving at same time, process them in the order they are found in the arrival array. You can assume that jobs arrive in such a way that CPU is never idle.
The function should return floating point value for the average waiting time which is calculated using round robin policy.
Assume 0<=jobs arrival time < 100 and 0<job run time <100.

AMCAT-Q2 : Mooshak the mouse has been placed in a maze.There is a huge chunk of cheese somewhere in the  maze.
The maze is represented as a two-dimentional array of integers, where 0 represents  walls.1 repersents paths where mooshak can move and 9 represents the huge chunk of cheese. Mooshak starts in the top-left corner at 0.0
Write a method isPath of class MazePath to determine if Mooshak can reach the huge chunk of cheese. The input to isPath  consists of a two- dimentional array gnd for the maze matrix. the method  should return 1 if there is a path from Mooshak to the cheese.and 0 if not Mooshak is not allowed to leave the maze or climb on walls.
EX:8 by 8(8*8)  matrix maze where Mooshak can get the cheese.
1 0 1 1 1 0 0 1
1 0 0 0 1 1 1 1
1 0 0 0 0 0 0 0
1 0 1 0 9 0 1 1
1 1 1 0 1 0 0 1
1 0 1 0 1 1 0 1
1 0 0 0 0 1 0 1
1 1 1 1 1 1 1 1


Test Case 1:

Input:[[1,1,1,][9,1,1],[0,1,0]]
Expected return value :1
Explanation:
The piece of cheese is placed at(1,0) on the grid Mooshak can move from (0,0) to (1,0) to reach it or can move from (0,0) to (0,1) to (1,1) to (1,0)

Test case 2:

Input:
[[0,0,0],[9,1,1],[0,1,1]]
Expected return value:0
Explanation:
Mooshak cannot move anywhere as there exists a wall right on (0,0)

1 comment:

  1. Sbobet Sign Up Bet £10 Get £30 | William Hill
    Join today and get sbobet ทางเข้า a 100% deposit bonus up to £30 with William Hill. £30 First Deposit Bonus: £50 Free Bet if First Deposit 퍼스트카지노 Existing Customers

    ReplyDelete