0% found this document useful (0 votes)
17 views4 pages

2015 Aut

The document outlines the PhD Qualifier Examination for the Department of Computer Science and Engineering, dated November 3, 2020, with a maximum score of 100 marks. It consists of three groups of questions (A, B, and C) covering various topics in computer science, including algorithms, data structures, and theoretical concepts. Candidates are required to answer five questions from Group A and five from Groups B and C.

Uploaded by

vimkain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views4 pages

2015 Aut

The document outlines the PhD Qualifier Examination for the Department of Computer Science and Engineering, dated November 3, 2020, with a maximum score of 100 marks. It consists of three groups of questions (A, B, and C) covering various topics in computer science, including algorithms, data structures, and theoretical concepts. Candidates are required to answer five questions from Group A and five from Groups B and C.

Uploaded by

vimkain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

PhD Qualifier Examination

Department of Computer Science and Engineering


Date: 03-Nov-20IS Maximum Marks: 100

[Answer any five questions from Group A, and any five questions from Groups Band c.]
Group A

A.I Let J.«. h be positive real-valued functions of non-negative integers.


(a) Letf(n) = (log2n)]og2n, andg(n) = 2(]Og2n)2.Prove thatf(n) = O(g(n)). (3)

(b) Prove or disprove: f(n) = 8(g(n)) if and only iflogf(n) = 8(logg(n)). (3)
(c) Letf(n) = 1 +a+a2 + ...+~-], where a is a positive real constant. Find all values of a, for which
f(n) = 8(an)? (4)

A.2 Let T be a binary tree with root r. For every vertex v in T, there exists a unique r-v path=-call this path
P; The length of P; is called the level of v. Any vertex lying on the path P; (including r and v) is called
an ancestor ofv. Let n denote the number of nodes in T.
w

(a) Suppose that each node in T contains a field to store the level of the node. During the creation of T,
w

these fields are kept un initialized. After the creation of T, you want to populate the level fields properly
at all the nodes of T. Propose an O(n)-time algorithm to do this task. (5)
w

(b) Given two vertices u, v in T, your task is to find out in O( 1) time whether u is an ancestor of v.
.s

Propose how this can be done. You may do an O(n)-time preprocessing of the tree, in which you are
allowed to use extra space in each node of the tree. Clearly explain your preprocessing algorithm. (5)
ol

A.3 You buy a black box which, upon the input of an integer array A of size n, outputs an integer array B of
ut

the same size. The manufacturer of the black box claims that B is the sorted version of A. You need to
verify that the manufacturer's claim is valid.
io

(a) Design an O(n)-time algorithm that, given an array B of size n, tests whether B is sorted or not. (3)
ns

(b) The black box passes the test of Part (a). But you realize that running only this test is not sufficient
to establish that the black box is working correctly. Why? (2)
(c) You communicate your misgivings to the manufacturer, and the manufacturer agrees to modify the
ad

black box so that a second array C of size n will be output by the black box (in addition to B). It is your
choice what C will consist of, but the creation of C must not take more time than sorting A (in the 00
da

notation). Explain what you want the array C to contain, and how you can use this extra information to
test in O(n) time the correctness of the working of the black box. (5)
. in

A.4 During the end of the semester, you realize that you have n assignments to solve. The marks for these
assignments are m1, m-, ... , mn, and the times needed to solve these assignments are t1 , t2 ... tn. You
have a total time T in order to solve your pending assignments. There is no part marking, that is, you
have to solve an assignment fully or leave it altogether. You want to choose a subset of the assignments,
that you can finish in time T, such that the total marks attempted is as large as possible. Assume that all
m., all tj, and T are positive integers. Propose an O(nT)-time algorithm for this problem. (Hint: Prepare
a two-dimensional array of size (n + 1) x (T + 1).) (10)

A.S You have three glasses with capacities C1, C2, C3 liters. Initially, the glasses contain water of volume
a1,a2,a3 liters. Eventually, you want the glasses to contain water of volume bi.bi b3 liters. Assume
that ai,bi,ci are non-negative integers and a..b, ~ c, for all i = 1 2,3, and a1 +a2 +a3 = b, + b2 + b3.
You have no measuring device nor any source or sink of water. All you can do is to transfer water from
one glass to another until either the former becomes empty or the latter becomes full (whichever happens
earlier). Your task is to find out whether there exists a sequence of moves (water transfers) such that
the initial configuration (a],a2,a3) can be changed to the desired configuration (b],b2,b3). Pose this
problem as a graph-theoretic problem. How do you solve the problem using an efficient algorithm? What
is the time complexity of your algorithm? (5+3+2)

- Page 1 of4 -
A.6 Catalan numbers C; are recursively defined as: Co = 1, and Cn = COCn-1 +CICn-2 + ... +Cn-2CI +
Cn-ICO for n ~ 1. Write an efficient C function that, upon the input ofn, returns the value ofCn. (10)

A.7 You are given a black-box implementation of a stack. You do not know how the stack data in this
implementation is organized. All you can do is to make the following calls to perform the basic utility
functions on stacks.
stack initStack()
int isEmpty(stack S)
stack push(stack S, int x)
stack pop (stack S)
int top (stack S)

Write a recursive function stack sortStack (stack S) to sort a stack. The function modifies the origi-
nal stack to a sorted one. The stack elements in the output stack follow a non-decreasing sequence from
bottom to top. You can define additional functions if necessary. (10)

A.8 Let G = (V,E, w) be a weighted directed acyclic graph with V = {O, 1,2, ... .n - I}, lEI = m, and w:
E -t;;Z+ (where Z" is the set of positive integers). Any edge (i,}) E E satisfies i <i (however, not every
pair (i,)) with i <} is required to be present in E). The edge weight w(e) stands for the profit that you
encounter when you follow the edge e. Your task is to enter the graph at Vertex 0, collect as much profit
w

as possible by following the directed edges in E, and leave the graph at Vertex n - 1.
w

(a) Define a C data type to store G in the adjacency-list representation. (3)


(b) Write an O(n + m)-time C function to find the maximum profit that you can have in a path in G from
°
w

Vertex to Vertex n - 1. If no such path exists, your function should return 0. (7)
.s
ol

Group B
ut

B.l (a) Let f(n) = n3 + n + 1, where n is a positive integer-valued variable. Prove that for infinitely many n,
io

the integer value f(n) is divisible by three. - (5)


(b) Let R be a binary relation on a set S, satisfying the property that for all a, b, C E S, whenever (a. b) E R
ns

and (c, b) E R, we have (a, c) E R. Prove or disprove: R must be a transitive relation on S. (5)

B.2 (a) For integers m.n ~ 0, let T(m,n) denote the count of functions f: {O, 1 2 .... m} -t {O.I. 2 ..... n}
ad

such that f(O) = 0, f(m) = n, and f(i - 1) ~ f(i) for all i = 1,2, ... .m. Prove that for all m.n ~ 1, we
have T(m,n) = T(m,n-l)+T(m-l,n). (5)
da

(b) Let A be a set of n 4-digit integers (that is, a subset of size n of { 1000, 1001 .... 9999}). What is the
smallest n for which A is guaranteed to contain two different integers with the same sum of digits? (5)
. in

B.3 There are two bags: the first bag contains three red and three blue balls, and the second bag contains three
red and two green balls. One of the two bags is chosen at random (with equal probability), and a ball is
drawn at random from the chosen bag. The ball drawn is not returned to any of the bags. For a second
time, a bag is chosen uniformly at random, and a ball is drawn randomly from the chosen bag.
(a) What is the probability that both the balls drawn are red? (5)
(b) Given that both the balls drawn are red, what is the probability that both the balls are drawn from the
fu~~~ ~
B.4 Let A be a non -empty language over the alphabet {O, 1}. Define

A+ = {aOf3 E {O, 1}* I af3 EA},


that is, A+ is obtained from A by adding one ° to each string in A (at any position).
(a) Give an example where A+ S;;; A, and another example where A+ cz. A. (2 + 2)
(b) Prove that for any non-empty language A, we have A+ i- A. (6)

- Page 2 of4 -
B.5 One of the following languages is regular, the other not. Which one is what? Give proper justifications. (5 + 5)
(a) Lsa = {ailJi I i,j ~ 0 and i+ j ~ 10}.
(b) LSb = {ailJi I i,j ~ 0 and i - j ~ 10}.

B.6 Let L6 be the context-free language over the alphabet {a, b,c}, generated by the following grammar with
the start symbol S:

S --7 c I cS I as I aSbS

(a) Show a derivation of the string accbac following this grammar. (3)
(b) Find a string a starting with a and ending with c, such that a tJ- L6. (2)
(c) Find a string a E L6 such that a has (at least) two different parse trees under the given grammar. (5)

Group C

C.1 (a) Simplify the switching expression: AB+AC+ABC(AB+C). (4)


(b) Optimize the switching function f(a,b,c,d, e) = Im(0,2, 8,10,16,17,18,19,24,26) using Quine-
w

McCluskey algorithm. (4)


w

(c) How are don't care terms handled by the Quine-McCluskey algorithm? (2)
w

C.2 A bit-wise shift-and-add multiplier has external inputs as follows:


- L: load operand (active high)
.s

- M: multiplicand
- X: multiplier
ol

It has an internal status line Z (active high) to indicate that multiplication is over. It uses internal control
signals W / M to load operands (W / M = 1) or to multiply (W / M = 0). The output status line R (active
ut

high) indicates that the results are available for transferring out.
io

Design a finite state machine with minimum number of states to control the multiplier and give correct
indication of availability of results. The FSM will have as inputs, the signals Land Z, and will have as
ns

-outputs the signals W / M and R. Its states should be labeled SO,SI,.... (10)

C.3 Non-negative integers x and yare stored in registers $so and $Sl, respectively.
ad

(a) Write a sequence of micro-MIPS instructions to compute x mody and store the result in $to. Use only
the instructions from Table 1. Your answer should reasonably handle the special case y = O. (3)
da

(b) Augment the instruction sequence in Part (a) so that it also yields lx/y J in $tl. (2)

(c) Let x and y be k-bit 2 's-complernent numbers. An adder computes S = x + Y but does not produce a
. in

carry-out signal ci, Prove that Ck can be derived externally as: ct = Xk-lYk-1 V ~_I (Xk-I V Yk-I). (5)

CA A computer system has 4 GB of byte-addressable main memory and a unified 256 KB unified cache
memory with 32-byte blocks.
(a) Draw a diagram showing each of the components ofa main memory address (that is, how many bits
for tag, set index, and byte offset) for a four-way set-associative cache. (6)
(b) The performance of the computer system with four-way set-associative cache architecture proves
unsatisfactory. Two redesign options are being considered, implying roughly the same additional design
and production costs. Option A is to increase the size of the cache to 512 KB. Option B is to increase the
associativity of the 256 KB cache to 16-way. In your judgment, which option is more likely to result in
better overall performance, and why? (4)

C.5 (a) A process-management module uses a prioritized round-robin scheduling policy (that is, the ready
queue is implemented as a priority queue). New processes are assigned an initial quantum of length q.
Whenever a process uses its entire quantum without blocking, its new quantum is set to twice its current
quantum (for its next turn). If a process blocks before its quantum expires, its new quantum is reset

- Page 3 of4 -
Table 1: Micro-MIPS ISA
Class Instruction Usage Meaning
Copy Load upper immediate lui rt, imm rt ~ (imm,OxOOOO)
Add add rd,rs,rt rd ~ (rs) - (rt)
Subtract sub rd,rs,rt rd ~ (rs) - (rt)
Arithmetic Set less than sit rd,rs,rt rd ~ if (rs) < (rd) then I else 0
Add Immediate addi rt,rs,imm rt ~ (rs) +imm
Set Less than immediate slti rt,rs,imm rt ~ if(rs) < immthen I else 0
AND and rd,rs,rt rd ~ (rs) 1\ (rt)
OR or rd,rs,rt rd ~ (rs) V (rt)
XOR xor rd,rs,rt rd ~ (rs) EB (rt)
Logic OR nor rd,rs,rt rd ~ ((rs) V (rt))'
AND immediate andi rt,rs,imm rt ~ (rs) l\imm
OR immediate ori rt,rs,imm rt ~ (rs Vimm
XOR immediate xori rt,rs,imm rt ~ (rs) 6 imm
Memory Word Load Word Iw rt,imm(rs) rt ~ mem[(rs) + immJ
Store Word sw rt,imm,(rs) mem[(rs) + immJ ~ (rt)
Jump J L goto L
Jump register jr rs goto (rs)
Branch on less than 0 bltz rs,L if(rs) < 0 then goto L
Control Transfer Branch on equal beq rs.rt.L if (rs) = (rt) then goto L
w

Branch on not equal bne rs,rt,L if(rs) =1= (rt) then goto L
Jump and link: jal L goto L; 31 ~ (PC)+4
w

System call syscall Associated with an OS system routine


w

to q. In this question, assume that every process requires a finite total amount of CPU time. Is starvation
possible for each of the following cases? The scheduler gives higher priority to (i) processes that have
.s

larger quanta, and (ii) processes that have smaller quanta. Justify our answers in both the cases. (3)
ol

(b) A computer system implements 8 KB pages and a 32-bit ph ical addre pace. Each page-table
entry contains a valid bit, a dirty bit, three permission bits and the frame number. If the maximum ize
ut

of the page table of a process is 24 MB, compute the length of the virtual address (in bits) supported by
the system. (2!)
io

(c) Explain the utility of a mid-term scheduler. (2)


ns

(d) Suppose that a processor does not have a TSL (Test and Set lock) instruction, but does have an
instruction "SWAP REG MEM" to swap the content of a register (REG) and a memory word _ _f
in a single indivisible (atomic) action. Show how you can use SWAP to implement mutual exclusion.
ad

Propose the entry .section and exit.section code modules. (2!)


da

C.6 (a) Each process Z},i = 0, 1,2,3, ... ,9 is coded as follows:


wait (mutex) ;
{Critical Section}
. in

signal (mutex) ;

The code for PIO is identical except that it mistakenly uses signal (mutex) instead of wail: ( ut ex) . What
is the largest number of processes that can be inside the critical section at any moment (the emaphore
mutex being initialized to I)? (3
(b) Identify the advantage of associating process ID information with each TLB entry. (2)
(c) Can a local page-replacement policy applied to the page frames allocated to a process affect the
performance of any other process in the system? Justify. (2)
(d) Consider a handheld system with 1 MB main memory. Customized operating system of size 130 KB
has been loaded in one partition of the memory. The contiguous-memory-allocation (variable partition)
scheme is used with first-fit strategy. The processes arrive and terminate in the following sequence: PI
(250 KB) arrives, P2 (100 KB) arrives, P3 (150 KB) arrives, P2 terminates, P4 (220 KB) arrives. All the
processes (including OS) have been loaded from the lowest address of the hole. Show the state of the
memory after each process arrival, termination. Now if process Ps of size 200 KB arrives in the system,
would it be possible to satisfy the request immediately? Would it be possible after compaction? What
will be the (minimum) cost of compaction? What kind of address binding is required for compaction? (3)

- Page 4 of4 ~

You might also like