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

2014 SPR

The document outlines the PhD Qualifier Examination for the Computer Science and Engineering department, dated March 20, 2014, with a maximum score of 100. It includes various questions across three groups, covering topics such as directed acyclic graphs, stacks, expression trees, Gray codes, probability, Boolean algebra, and memory systems. Candidates are required to answer a selection of questions from each group to demonstrate their knowledge and understanding of these subjects.

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)
14 views4 pages

2014 SPR

The document outlines the PhD Qualifier Examination for the Computer Science and Engineering department, dated March 20, 2014, with a maximum score of 100. It includes various questions across three groups, covering topics such as directed acyclic graphs, stacks, expression trees, Gray codes, probability, Boolean algebra, and memory systems. Candidates are required to answer a selection of questions from each group to demonstrate their knowledge and understanding of these subjects.

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: 20-Mar-2014 Maximum Marks: 100

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

A.l Let G be a directed acyclic graph with n vertices. Let s be a source (a vertex with in-degree zero) and
t a sink (a vertex of out-degree zero) in G. We want to compute the number of paths from s to t. For
u, v E G, letN(u, v) denote the number of paths in G from u to v. So our task is to compute N(s, t). Let
VI, V2,"" Vkbe all the neighbors of s is G. Then, we have N(s,t) = N(VI ,t) +N(V2,t) +...+N(Vk,t),
that is, we compute each N( Vi, t) recursively, and return their sum.
(a) Describe the termination condition(s) for the above recursive algorithm. (3)
(b) Prove that the worst-case complexity of the above recursive algorithm can be exponential in n. (7)

if<a) Describe what ADT (abstract data type) calls (operations with functional specifications) should
, be defined for implementing stacks. Do not implement the calls. Only mention the call prototypes.
w

For example, here is a call prototype for inserting an element in an ordered list at a given index:
w

list insert (list, index, element). (3)

(b) Use these stack ADT calls to recognize strings with balanced parentheses. Examples of such
w

strings: 0, ((())), 000, O(O(O(O())))· Non-examples: (0, (O(()))), )0(· (7)


.s

V Let [PO,PI,P2,'" ,Pn-d be an array of n distinct points in the two-dimensional plane. Each point
11 is specified by its to coordinates Xj,Yj. A point P; in the given array is called maximum if for all
ol

" ,'.
jE{0,1,2, ... ,n-l}withj#i,wehavexj::::;;xjandYj::::;;Yj. .,... 'to I '" '," l'
ut

(a) Show that not every array of points contains maximum point(s). (3)
(b) Propose an efficient algorithm to find a maximum point in a given array of points (if a maximum
io

exists). What is the running time of your algorithm? (7)


ns

.4 (a) Define a max-heap and its contiguous representation in an array. (4)


(b) Convert the array [20,11,25,7,23,17,9] to a max-heap. (3)
ad

(c) Explain how


. you insert
, 22 in the max-heap of Part (b). (3)
da

A.5 Let u, v, w be n-dimensional column vectors (that is, n x 1 matrices), and 1the n x n identity matrix.
Propose a 0(n)-time algorithm to compute the vector (1 + uv'jw, where v' is the transpose of v.
,I Assume that only u, v, ware supplied as input to your algorithm. 1is a constant matrix and does not
.in

need to be explicitly provided as an input. (10)

An expression tree is a binary tree having two properties: (a) every non-leaf node stores a binary
operator and has two child nodes, and (b) every leaf node stores a numeric operand. Such a tree stands
for an arithmetic expression. For example, the following tree stands for the expression (35/11) +
(69 - (3 * 17)), and evaluates to 21. Assume that the operands are integers, and that the operators to
be supported are +, -, *, / and % with their usual meanings.
r' I

~.. r 1 S,

- Page 1 of4 -
(a) What elements you should store in a node of an expression tree? (3)
(b) Propose an efficient algorithm to evaluate the expression tree. Report error if the input tree is not
a valid expression tree. You do not need to write a C code. A description of your algorithm suffices. (5 + 2)

0n a doubly linked list, each node is given two pointers, the first pointing to the next element in the list,
and the second to the previous element in the list. The next pointer of the last node and the previous
pointer of the first node should be NULL.
(a) Describe a suitable C data type to store a node in a doubly linked list. Suppose that each node in
the list stores an integer key value. (3)
(b) Let L be a sorted doubly linked list (of integers). Write a C function to insert an integer x in L. If
x already resided in L, then the insertion produces no change. If x was absent from L, it is inserted in
the appropriate position so that after the insertion, L continues to remain sorted. (7)

A.8 A d-dimensional Gray code is a listing of all of the 2d binary strings oflength d with any two consecu-
tive strings in the list differing in exactly one position. A recursive construction of Gray codes follows.
For d = 1, it is the listing (0,1). So suppose d ~ 2, and let (SO,SI,... ,s2d-LI) be a (d - 1)-dimensional
Gray code. Then, (Oso, OSI,... , OS2d-1_1,Is2d-LI,"" 1SI, Iso) is a d-dimensional Gray code.
(a) Define a suitable C data type to store an array of2d strings each oflength d. (3) .
w

(b) Write a C function that, upon the input of d, returns the d-dimensional Gray code as a data of type
defined in Part (a). . (7)
w
w

Group B
.s
ol

~Determine the number of integers between 1 and 250 that are divisible by (at least) one of the integers
2,3,5, and 7. (10)
ut

~ Find the general solution of s; -4Sn-1 +4Sn-2 = 2n +n2n. P 'f,..pyP 0-1»: P (10)
, 'f H ) T T t\, .
io

B A biased coin (with probability of obtaining a head equal to p > 0) is tossed repeatedly and indepen-
I dently until the first head is observed. Compute the probability that the first head appears at an even
ns

numbered toss. (10)

o
ad

Q;he following two languages are defined over the alphabet L = {O,I}. By nl (y), we denote the
number of l's in the stringy. ~1.~

= {I 'v 1y (y) ~ k} is regular.


da

(a) Prove that the language LI E {O, I} *, k ~ 1, nl (5)


(b) Prove that the language L2 = {lky 1y E {O, 1}*, k ~ 1, nl (y) ::;;;k} is not regul~. (5)
.

B.5 (a) Construct a DFA comprising at most six states which accepts the language (over L = {O, I})
in

corresponding to the regular expression (11 + 110)*0. (6)


(b) Prove that the language L = {Oilj 12i::;;;j::;;; 3i} (over L = {O, I}) is context free. (4)

~) A grammar G = (V, T,S,P) (all symbols having their usual meanings) is said to be right-linear if
all productions are either of the form 'A -+ xB' or of the form 'A -+ x'. Prove that if G is right-linear,
then L (G) is regular. (5)
) Inductively prove that every string produced by the grammar r

S °
-+ 1SO 1OS 11SS 1SSI 1SIS

(with start symbol S) has more O's than 1'so (5)

- Page20f4 -

~~-----------=---------------------------------------------=----------------------------'-
Group C

~ Prove, using Boolean algebraic justifications, that arithmetic overflow is impossible if two n-bit
~mbers of opposite signs are added in a 2 's complement number system. (3)
(b) Consider the Boolean expressions:
I
IP A+BSo+BSl,
IG AB
I

s. +ABS3, and
F IP(J)IG(J)M,

where A,B,M,So,Sl ,Sz and S3 are Boolean variables. Prove, using Boolean algebra, that if M = 1,

F =A'Bs'a +A'B'S'i +AB'Sz +ABS3. (6)

(c) From the above expression for F, explain how F can be used to implement all sixteen two-variable
Boolean functions F(A,B). (1)
w

C.2 We wish to design a sequence detector circuit which detects three or more consecutive 1's in an infinite
stream of bits coming through an input line, by making an output line logic-l (which is otherwise at
w

logic-O).
w

(a) Draw the state diagram of the finite state machine. (2)
(b) Determine the type of the circuit (Moore or Mealy machine). (1)
.s

(c) Write the complete state transition table of the circuit, assuming minimum number ofD flip-flops.
ol

Clearly indicate the state encoding you have assumed. (2)


(d) Implement the logic minimized circuit using D flip-flops. (5)
ut

C.3 (a) Identify four distinguishing features ofCISC and RISC architectures. (4)
io

(b) With respect to interrupt-driven I/O, clearly explain the following:


ns

i) If multiple devices are connected to the same interrupt line, how does the CPU identify the
source of the interrupt? (2)
ad

ii) Once the interrupting device is identified, how is the corresponding interrupt handler invoked? (2)
iii) How are nested interrupt requests typically handled (arrival of an interrupt request while another
da

one is being processed)? 16"" (2)


~ ~, ~
.~ .(aJ Four l?tX4 memory modules are to be interconnected to design a 32Kx8 memory system. Show
.

a schematic diagram for the same,


in

(3)
~ In a two-level cache memory system, the parameters are:
Main memory access time: 150 ns 0.>8' ~ 'j. 20(\/1> + ;2..s- j. (.2.0 +(~s ·I.~ f5bN>~t~)
Ll access time: 20 ns
-+ (t~ '/. (so M -+ ~o-o-))
L2 access time: 50 ns . . +150.
Ll hit ratio: 98.5%
L2 hit ratio: 85.0% (w.r.t. the residual accesses that hit L2)
MM-L2 block transfer time: 500 ns
L2-Ll block transfer time: 150 ns '
Estimate the average access time of the memory system. - (4)
..(c) For a set-associative cache memory, estimate the hardware overhead required to identify whether
a requested memory location is present in the cache or not. (3)

- Page 30f4 -
C.S MConsider three processes (process IDs 0,1,2) with CPU burst times 2, 4, 8 units. All processes
arrive at the time zero. Consider the preemptive longest remaining time first (LRTF) scheduling
algorithm. In this algorithm, the process with the longest next remaining CPU time will be scheduled
first. In LRTF, ties are broken by giving priority to tlie process with the lower process id. Compute
the average turnaround time with the help of Gantt chart. Assume that the time units are integral. (4)
~ Assume that we have a demand paged memory. The page table is held in registers. It takes 8 ms
to service page fault if an empty frame is available or if the replaced page is not modified, and 20 ms
if the replaced page is modified. Memory access time is 100 ns. Assume that the page to be replaced
is modified 70% ofthe time. What is the maximum acceptable page-fault rate for an effective access

-
time of no ~ore than 200 ns. ? 0 6 IV' ~ C1- p) x 00 IV> -to p"X ( ::, e '/. "- 'B rI\f) -+ :WI
(c) A CPU generates 32-bit virtual addresses. The page size is 4 KB. The processor has a translation
look-aside buffer (TLB) which can hold a total of 128 page table entries and is 4-way
.,....11-
set associative .
3))

What is the minimum size of the TLB tag? . 4 I( /I - ( ~ l 1 _ ~s (3)


NJ.. n'V' -1 -
C.6 (a) A shared variable p, initialized to zero, is operated on by four concurrent processes W,X, Y, Z
as follows. Each of the processes Wand X reads p from memory, increments by one, stores it to
memory, and then terminates. Each of the processes Y and Z reads p from memory, decrements
by two, stores it to memory, and then. terminates. Each process before reading p invokes the waiu)
operation on a counting semaphore S and invokes the signalt) operation on the semaphore S after
w

storing p to memory. Semaphore S is initialized to two. What is the maximum possible value of p
w

after all processes complete execution? (4)


(b) Consider a system which implements (i) preemptive priority-based CPU scheduler and (ii) busy
w

waiting for mutual exclusion. In such a system, explain whether it is possible that a high priority
.s

process gets delayed indefinitely because of the presence oflower priority processes? Assume that no
process does any I/O and there is no deadlock in the system. (3)
ol

(c) A system uses FIFO policy for page replacement. It has four page frames with no pages loaded
to begin with. The system first accesses 100 distinct pages in some order and then accesses the same
ut

100 pages but now in the reverse order. How many page faults will occur? (3)
io

;<;(
f.
ns
ad
da
. in

- Page40f4-

You might also like