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

Assignment - ESP-VI

The document consists of a series of questions related to data structures, algorithms, computer architecture, and database management systems, each assigned a specific mark value. It covers topics such as binary search trees, linked lists, cache memory, SQL, and various programming concepts. The questions are designed to assess knowledge and understanding of fundamental computing principles and practices.

Uploaded by

Sumit singh
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 views34 pages

Assignment - ESP-VI

The document consists of a series of questions related to data structures, algorithms, computer architecture, and database management systems, each assigned a specific mark value. It covers topics such as binary search trees, linked lists, cache memory, SQL, and various programming concepts. The questions are designed to assess knowledge and understanding of fundamental computing principles and practices.

Uploaded by

Sumit singh
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/ 34

Part A

QB
Sr. Question Question Marks
No.
Define a binary search tree (BST)
2
1 and explain its key properties.
Explain the difference between a
binary tree and a binary search tree 2
2 (BST). Provide an example of each.
Discuss the advantages and
disadvantages of a singly linked list
2
compared to an array. Provide
3 specific examples for each.
Explain the concept of enqueue
2
4 and dequeue operations in a queue.
#define f(a,b) a+b
#define g(a,b)a*b
main()
{
int m; 2
m=2*f(3,g(4,5));
printf("\n m is %d", m);
}
5 What is the value of m?
How many different types of trees
that can be realized are with six 2
6 nodes?
Consider the following C
declaration
struct {
short s [5]
union{
float y; 2
long z;
}u;
}t;
What is the memory requirement
7 for variable t?
Find the maximum number of
binary trees that can be formed 2
8 with three unlabeled nodes.
Suppose the numbers 7, 5, 1, 8, 3,
6, 0, 9, 4, 2 are inserted in that
order into an initially empty binary
search tree. The binary search tree
uses 2
the usual ordering on natural
numbers. What is the inorder
traversal sequence of the resultant
9 tree?
Find the number of pointers
affected for an insertion operation 2
10 in a doubly linked list.
The function of the given Linked
List with the first node as the head
is:-
void funx1(struct node* head)
{
if (head == NULL)
2
return;
funx1 (head -> next) ;
printf (" %d ", head -> data ) ;
}

11 What is the output?


Which algorithms among Insertion
Sort, Quick Sort, Heap Sort, and
Merge Sort, can be used to sort a
2
random linked list with minimum
time complexity? Explain your
12 answer.
How many stacks are needed to
implement a queue? Consider the
situation where no other data 2
structure like arrays, linked list is
13 available to you.
Consider a direct mapped cache of
size 32 KB with block size 32
bytes. The CPU generates 32-bit
2
addresses. Calculate the number of
bits needed for cache indexing and
14 the number of tag bits.
How many 32K × 1 RAM chips are
needed to provide a memory 2
15 capacity of 256 K bytes?
Point out how DMA can improve
2
16 I/O speed.
Consider a 4-way set-associative
cache (initially empty) with total 16
cache blocks. The main memory
consists of 256 blocks and the
request for memory blocks is in the
following order:
2
0, 255, 1, 4, 3, 8, 133, 159, 216,
129, 63, 8, 48, 32, 73, 92, 155
Which one of the following
memory block will NOT be in
cache if LRU replacement policy is
17 used?
A computer has a 256 KB, 4-way
set- associative, write-back data
cache with block size of 32 bytes.
The processor sends 32-bit
addresses to the cache controller.
Each cache tag directory entry 2
contains, in addition to address tag,
2 valid bits, 1 modified bit and 1
replacement bit.
What are the number of bits in the
18 tag field of an address?
Illustrate the advantages of virtual
2
19 memory.

2
20 Define hit ratio.
A computer has 1GB of memory. Each
word in the computer is 32 bits. How
2
many bits are needed to address any
21 single word in the memory?

Illustrate memory hierarchy with 2


22 example.
What are the operations of page
2
23 replacement algorithm?
Consider a direct mapped cache of
size 16 KB with block size 256
bytes. The size of main memory is
2
128 KB. Find-
a) Number of bits in tag
24 b) Tag directory size
Which Data Structure is useful to
find Depth First Search on a given 2
25 graph?
Consider a weighted complete
graph G on the vertex set {v1, v2,
..vn} such that the weight of the
2
edge (vi, vj) is 2|i−j|. Calculate the
weight of a minimum spanning tree
26 of G.

What are the advantages of DBMS 2


27 over traditional file-based systems?
What is the difference between
primary key and unique 2
28 constraints?

2
29 What is database normalization?

What are the differences between 2


30 DDL, DML, and DCL in SQL?

What is the difference between 2


31 having and where clause?
How to print duplicate rows in a 2
32 table?

2
33 What is Identity?

34 What is a view in SQL? How to 2


create a view?

35 2
What is a Trigger?

36 2
What is a stored procedure?

37 2
What are ACID properties?

38 What are clustered and non- 2


clustered Indexes?

39 2
What is Denormalization?
What is the difference between a
40 database schema and a database 2
state?

Explain the concepts of a Primary


41 2
key and Foreign Key.

What is the concept of sub-query


42 2
in terms of SQL?

What is the use of the DROP


command and what are the
43 differences between DROP, 2
TRUNCATE and DELETE
commands?
What is the main difference
44 between UNION and UNION 2
ALL?

Explain Entity, Entity Type, and


45 2
Entity Set in DBMS?

What are the different levels of


46 2
abstraction in the DBMS?

Consider a context-free grammar


G with the following rules.

S --> aS, S --> aSbS, S --> c

Let w L(G). Let , ,


and denote the number of
times a, b, and c occur in w,
respectively. Which of the
following statements is/are TRUE?
47 Explain your answer. 2

(i) >

(ii) > -2

(iii) =

(iv) =

Let L1 be the language represented


by the regular expression
b*ab*(ab*ab*)* and L2 = {w (a +
b)*| |w| 4, where |w| denotes the
48 2
length of string w. Find the number
of strings in L2 which are also in
L1.
Consider the following two regular
expressions over the alphabet {0,
1}: r = 0* + 1*, s = 01* + 10*
Find the strings of length less than
49 2
or equal to 4, which are neither in r
nor in s.

Which of the following statements


is/are correct? explain your answer.

The intersection of two regular


languages is regular.

The intersection of two context-free


50 languages is context-free. 2
The intersection of two recursive
languages is recursive.
The intersection of two recursively
enumerable languages is
recursively enumerable.

Consider the following sets:

S1: Set of all recursively


enumerable languages over the
alphabet {0, 1}

S2: Set of all syntactically valid C


51 programs 2

S3: Set of all languages over the


alphabet {0, 1}

S4: Set of all non-regular languages


over the alphabet {0, 1}
Which of the above sets are
uncountable?

Consider the following languages:

(i)
where

(ii) { | m = n and p = q,
where

(iii) { | m = n = p, p q,
52 2
where

(iv) { | mn = p + q,
where

Which of the above languages are


context-free?

Give a RE for: L = { | i is even


and j is odd }.
53 2

What is left recursion in a


grammar? How can it be
eliminated? Explain with an
54 2
example.

Write a grammar for the following


55 language: { w ∈ {0, 1}∗ | w = wR 2 3
and |w| is even }

56 Write a grammar for the following 2 3


language: { w ∈ {0, 1}∗ | the
length of w is odd and the middle
symbol is 0}

Design grammar for the following


language L = {
}, where the alphabet set is {a, b, CO
57 2 3 Create
c}. 3

What is the difference between the


CO
58 performance of a Deterministic 2 3 Understand
3
PDA and an NPDA?
What are the common techniques CO
59 2 3 Remember
to simplify a grammar? 3
What is unit production in a
grammar? How can it be removed?
CO
60 Show with an example. 2 3 Understand
3

What is useless symbol in a


grammar? How can it be removed?
61 CO
Show with an example. 2 3 Understand
3

Compare and contrast Chomsky


62 CO
Normal Form (CNF) and Greibach 2 3 Remember
3
Normal Form (GNF).
Describe the steps for removing ε-
63 CO
productions from a CFG. Use one 2 3 Apply
3
example to show this.
Classify the following languages
according to the Chomsky
hierarchy: regular, context-free,
context-sensitive, and recursively CO
64 2 3 Analyze
enumerable: 3
Language of all strings over {0, 1}
with an equal number of '0's and
'1's.
Language of all strings over {a, b}
where each 'a' is followed by at
least one 'b'.
Language of all strings over {0, 1}
that represent palindromes.
Language of all strings over {a, b}
where the number of 'a's is twice
the number of 'b's.

Explain the significance of Turing


machines in recognizing
65 recursively enumerable languages 2
and the limitations of decidable
languages.
What is the high-speed memory
66 between the main memory and the 2
CPU called?
Which computer’s memory
67 contains the system’s Boot sector 2
files?
What is the process of mapping a
68 virtual address of a variable length 2
onto a physical memory?
Consider a CPU which takes 2
microseconds as interrupt overhead
time, when a device generates
interrupt for CPU and CPU accepts
69 it. After that the CPU takes 9 cycles 2
to service the interrupt. If CPU runs
on 2 MHZ clock rate, what is the
total time the CPU spend for
interrupt service.
In the two-level hierarchy, if the
top level has an access time of 30
70 ns and the bottom level has an 2
access time of 150 ns, what is the
hit rate on the top-level required to
give an average access time of 45
ns.
Consider a device operating on
2MBPS speed and transferring the
data to memory using cycle
stealing mode of DMA. If it takes 2
71 microseconds to transfer 16 bytes 2
data to memory when it is
read/prepare. Then what is the
percentage of time CPU is blocked
due to DMA
The chip selects logic of a certain
DRAM chip in a memory system
that has 16 address lines. What is
72 the range of address of the memory 2
system that can get enabled by the
chip select (CS) signals?

The following sequence of


operation is performed on a stack:
PUSH(10), PUSH(20), POP,
73 PUSH(10),
2
PUSH(20), POP, POP, POP,
PUSH(20), POP.
Find the sequence of values popped
out.
Suppose the numbers 7, 5, 1, 8, 3,
6, 0, 9, 4, 2 are inserted in that
order into an initially empty binary
search tree. The binary search tree
74 uses 2
the usual ordering on natural
numbers. Find the inorder traversal
sequence of the resultant
tree?
global int i = 100, j = 5;
void P(x) {
75 int i = 10; 2
print(x + 10);
i = 200;
j = 20;
print (x);
}
main() {P(i + j);}
What will be the values printed by
the above program.
What are the advantages of using
76 shared, dynamically linked libraries
2
as opposed to using statically
linked libraries?
int f(int n)
{
static int i = 1 ;
if (n >= 5) return n;
77 n = n+i;
2
i++;
return f(n);
}
What will be the value returned by
f(1).

78 Prove that the language L = {a n^ 2}


2
is not regular.

79 Prove that regular language is


2
closed under concatenation.

80 What is usually called a “dead


2
state”? What’s its peculiarity?

2
81 What is an instruction cycle?

2
82 What is the function of ALU?

Define Computer Organization and


2
83 Computer Architecture.

What is the difference between


2
84 RISC and CISC?
List the stages of an instruction
2
85 cycle.

2
86 Define pipelining in a processor.

2
87 What is cache memory?

Explain virtual memory in simple


2
88 terms.

Differentiate between Harvard and


2
89 Von Neumann architectures.

What is the function of a Program


2
90 Counter (PC)?

List different types of addressing


2
91 modes.

What is an interrupt in a computer


2
92 system?

2
93 Convert (47.625)₁₀ into binary.

Find the 2’s complement of the


2
94 binary number 110101.

Calculate the effective access time if


the cache hit ratio is 90%, cache
2
access time is 10 ns, and main
95 memory access time is 100 ns.

Compute the number of address


lines required to address a 1MB 2
96 memory.

Find the physical address if the base


address is 4000H and the offset is 2
97 200H.

How many number of Addresses are


2
98 required for 2540 video RAM.
2
99 What is DMA?

State an application of Serial Access


2
100 Memories.

How to put a microprocessor in


2
101 Wait state?

Explain the instructions: (i) RST


2
102 and (ii) LXI.

Explain the instructions: (i) JMP


2
103 and (ii) DAA.

State the sequence of events that


happen during a typical Fetch 2
104 operation.

Discuss the difference between PLA


2
105 and ROM.

Part B
QB
Question
Sr. Question
Marks
No.
Let T(n) be the number of different binary
search trees on n distinct elements. Then
5
Analyze the value of x ?
1
Find the postfix expression for the infix expression
5
2 A + B * (C + D)/E + F * G.
Postorder traversal of a given binary search tree T
produces the following sequence of keys
5
10, 9, 23, 22, 27, 25, 15, 50, 95, 60, 40, 2. Find the
3 inorder traversal of the tree T?
The following postfix expression with single-digit
operands is evaluated using a stack: 5
4 823∧ /23*+51*−
Note that ∧ is the exponentiation operator. Find
the top two elements of the stack after the first *
is evaluated.
Analyze the value printed by the following C
program?
#include <stdio.h>
int f(int * a, int n)
{
if (n<= 0)return 0;
else if(*a% 2= = 0)
return * a + f(a
+1,n - 1);
else return * a - 5
f(a + 1, n - 1);
}
int main( )
{
int a[ ] = {12, 7,
13, 4, 11, 6};
printf("%d",f(a,6));
return 0;
5 }
Analyze the value printed by the following C
program?
# include <stdio.h>
int fun(int n, int * f_p) {
int t, f;
if (n <= 1) {
* f_p =1;
return 1;
}
t = fun (n - 1, f_p);
f = t+ * f_p;
* f_p = t;
return f;
}
int main() {
int x = 15;
printf (" % d\ n", fun(5, & x));
6 return 0;
}
Consider the following C program that attempts
to locate an element x in an array Y[ ] using binary
search. The program is erroneous.
1. f(int Y[10], int x) {
2. int u, j, k;
3. i = 0; j = 9;
4. do {
5. k = (i + j) / 2;
6. if (Y[k] < x) i = k;
else j = k; 5
7. } while ((Y[k]! = x) &&
(i < j));
8. if (Y [k] == x) print f ("x is in
the array");
9. else print f ("x is not in the
array");
10. }
Analyze where the correction needed in the
7 program to make it work properly.
The preorder traversal of a binary search tree is
15, 10, 12, 11, 20, 18, 16, 19. Evaluate post-order 5
8 traversal.
9 Write an algorithm to reverse a singly linked list 5
Write an algorithm to delete an element from a
5
10 singly linked list if the item available in the list.
Write an algorithm to sort a singly linked list in
descending order. Assume numbers in the list are 5
11 random.
Suppose a circular queue of capacity (n – 1)
elements is implemented with an array of n
elements. Assume that the insertion and deletion
operation are carried out using REAR and FRONT
5
as array index variables, respectively. Initially,
REAR = FRONT = 0. Write down the algorithm
to detect whether the queue is full and queue
12 empty.
Consider a hash table with 100 slots. Collisions
5
13 are resolved using chaining. Assuming simple
uniform hashing. Calculate the probability, so that,
the first 3 slots are unfilled after the first 3
insertions.
A computer uses RAM chips of 1024 x 1 capacity.
How many chips are needed to provide a memory 5
14 capacity of 16K bytes?
A 4-way set-associative cache memory uses
blocks of four words. The cache can accommodate
a total of 1024 words from the main memory. The
5
main memory size is 128K×32. Formulate all
pertinent information required to construct the
15 cache memory.
Consider a memory hierarchy system containing a
cache, a main memory and a virtual memory.
Assuming, cache access time of 4 ns, and 70% hit
ratio. The access time of the main memory is 100 ns, 5
and it has a 99.5% hit rate. The access time of the
virtual memory is 10 ms. Calculate the average access
16 time of the memory hierarchy.
Suppose physical memory is of 2GB and each
word is of 16 bits. There is a cache containing 2K
words of data, and each cache block contains 16
5
words. For each of the direct mapped and 2-way
set associative cache configurations, specify how
17 the address would be partitioned.
Consider a direct mapped cache of size 32 KB
with block size 32 bytes. The CPU generates 32-
5
bit addresses. What are number of bits needed for
18 addressing block in cache and number of tag bits?
A main memory unit with a capacity of 4
megabytes is built using 1M × 1-bit DRAM chips.
Each DRAM chip has 1 K rows of cells with 1K
cells in each row. The time taken for a single 5
refresh operation is 100 ns. Calculate how much
time is uired to perform one refresh operation on
19 all the cells in the memory unit?
Consider a direct mapped cache of size 32KB with a
block size of 32 bytes. The CPU generates bit 5
20 addresses. What are the number of bits needed for
cache indexing and the number of tag bits,
respectively?
Create a DFA that recognizes strings over {a, b}
where the number of 'a's is one less than the 5
21 number of 'b's.
Devise a DFA that accepts strings over the
alphabet {0, 1} containing an even number of both 5
22 '0's and '1's.
Consider the context-free grammar G below:

S --> aSb | X

X --> aX | Xb | a | b

where S and X are non-terminals, and a and b are 5


terminal symbols. The starting non-terminal is S.
Find the language generated by the grammar.
Check whether the grammar is a regular grammar
or not.

23
Consider the language L over the alphabet {0, 1},
given below:

L = {w {0, 1}* | w does not contain three more


5
consecutive 1's}. Draw the associated DFA with
minimum number of states.

24
3. Comment on whether the following are
decidable or undecidable. Explain your
answer with the definition of undecidable
problem.

a. Given two Turing machines M1 5


and M2, decide if L(M1) = L(M2).

b. Given a Turing machine M, decide


if L(M) is regular.
25
c. Given a Turing machine M, decide
if M accepts all strings.

d. Given a Turing machine M, decide


if M takes more than 1073 steps on
every string.

Give a RE and a CFG for:


L = {x ∈ {0, 1}∗ | x starts and ends with different
5
symbols}
26
Give a Regular Expression and DFA for:
L = {x ∈ {0, 1}∗ | x ends with 1 and does not 5
27 contain the substring 00}
Design an NFA that recognizes the language of
all strings over the alphabet {0, 1} that contain at 5
28 least two consecutive '1's.
Develop an NFA that recognizes the language of
all strings over the alphabet {a, b} that start and 5
29 end with the same symbol.
Investigate the closure properties of languages
under the operations of union, intersection,
5
concatenation, and Kleene star for each class of
30 languages in the Chomsky hierarchy.
Assume that for a certain processor, a read
request takes 50 nanoseconds on a cache miss and
10 nanoseconds on a cache hit. Suppose while
31 running a program it is observed that 90 percent of 5
the processor’s read requests result in a cache hit.
Find out the average read access time in
nanoseconds.

Consider a computer system with DMA support.


The DMA module is transferring one 8-bit
character in one CPU cycle from a device to
32 memory through cycle stealing at regular intervals. 5
Consider a 2 MHz processor. If 0.5% processor
cycles are used for DMA, what is the data transfer
rate of the device?
A cache memory unit with capacity of N words
and block size of B words is to be designed. If it is
designed as direct mapped cache, the length of the
33 TAG field is 10 bits. If the cache unit is now 5
designed as a 16-way set-associative cache, What
is the length of the TAG field?

A DMA controller transfers 16-bit words to


memory using cycle stealing. The words are
assembled from a device that transmits characters
at a rate of 2400 characters per second. The CPU
34 is fetching and executing instructions at an 5
average rate of 1million instructions per second.
By how much will the CPU be slowed down
because of the DMA transfer?

What is the difference between isolated I/O and


35 memory mapped I/O? What are the advantages 5
and disadvantages of each
An 8-way set associative cache of size 64 KB
)(1KB = 1024 bytes) is used in a system with 32-
36 bit address. The address is sub-divided into TAG, 5
INDEX and BLOCK OFFSET. How many bits are
there in the TAG field?

Find the time complexity of the following C


function. (assume n > 0)
int recursive (int n)
37 {
5
if (n == 1)
return (1);
else
return (recursive (n-1) + recursive (n-1));
}
Consider a weighted complete graph G on the
38 vertex set {v1, v2, …, vn} such that the weight of 5
the edge (vi, vj) is 2|i - j|. Calculate the weight of a
minimum spanning tree of G.
Let xR denote the reversal of the string x. (For
example, if x = 010011 then xR = 110010 and so
39 forth.) Prove that the sets accepted by finite
5
automata are closed under string reversal by
constructing for any finite automaton, a new
machine that accepts the reversals of the strings
accepted by the original automaton.

Show that for each finite automaton, there is


another machine that accepts only strings that are
40 5
the front two thirds of the strings the first
automaton accepted.
Prove that the class of sets accepted by finite
automata is closed under intersection. In other
41 words, given Mi and Mk construct the finite 5
automaton Mm such that:
T(Mm) = T(Mi) ∩ T(Mk)
Solve the following recurrence relation:
42 5
T(n) = 4T(n/2)+ n

Develop an algorithm to design finite automata for


substring searching.
43 The input should be the substring and the output is 5
a finite automaton state table. Be sure to specify
your data structures and intuitively describe the
algorithm.
What does the following SQL query list?
SELECT title FROM book as B
44 WHERE (SELECT count(*)
5
FROM book as T
WHERE T.price > B.price) < 5

Consider the recurrence function


T(n)=2T(√𝑛)+1, n>2
45 =2, 0< n ≤ 2 5

Evaluate T(n) in terms of Θ notation.

What are ordered indices in RDBMS? Give an


46 5
example.
Differentiate the implementation of B+ tree & B
47 5
tree in the context of indexing in RDBMS?

Why sparse indexing requires less storage space


48 5
than dense index?

Explain trival and non-trival functional


49 5
dependencies in RDBMS.
What is the need/application of Canonical Cover
50 5
in RDBMS?

Is it mandatory to create clustered index with


51 5
primary key of a RDBMS? Justify your answer.

What will be the maximum possible number of


52 superkeys for the relation schema R(E,F,G,H) with 5
E as the key. Justify your answer.
Why the higher normal form is not always
53 5
desirable in RDBMS?Justify your answer.

Give an example with explanation where the


54 5
database is in 1NF but not in 2NF.

When is it preferable to use a dense index rather


55 5
than a sparse index?

Consider the relation R (ABCDE): FD =


{ A → B, B → C, C → D, D → E} 5

56 Find out the highest normal form of R.

What will be the maximum possible


number of superkeys for the relation
5
schema R(E,F,G,H) with E as the key.
57 Justify your answer.

Why the higher normal form is not always


5
58 desirable in RDBMS?Justify your answer.

Consider the relation scheme R = {E, F, G,


H, I, J, K, L, M, N} and the set of
functional dependencies {{E, F} -> {G},
5
{F} -> {I, J}, {E, H} -> {K, L}, K -> {M},
L -> {N}} on R. What is the candidate key
59 for R (Need to show every steps)?
Write the steps to find the Canonical Cover
of a given set of Functional Dependencies 5
in RDBMS.
60

Let R(A,B,C,D,E,P,G) be a relational


schema in which the following FDs are
known to hold:

AB->CD, DE->P, C->E, P->C, B->G 5

What is the highest normal form of this


relation scheme (R). Justify your answer
with proper explanation?
61

Explain the different types of addressing modes with 5


examples.
62

Describe the working of cache memory and its 5


mapping techniques.
63

Compare Hardwired control and Microprogrammed


control.

Illustrate the instruction cycle with a neat diagram. 5


64

Discuss the concept of pipelining and different 5


types of hazards.
65
Explain the memory hierarchy in computer 5
systems.
66

Differentiate between SRAM and DRAM. 5


67

Describe the different types of ROM. 5


68

Explain the role of DMA (Direct Memory Access) 5


in I/O operations.
69

Analyze different types of buses in a computer 5


system.
70

A system has 4 GB of RAM and uses 32-bit


addressing. Find the number of addressable 5
locations and addressable memory size.
71

A computer system has a cache hit ratio of 80%, a


cache access time of 5 ns, and a main memory 5
access time of 50 ns. Calculate the average memory
access time.
72

A disk rotates at 7200 RPM. The average seek time 5


is 9 ms. Find the average access time of the disk.
73

A system uses 16-bit instructions and has 32


general-purpose registers. Calculate the total 5
number of bits required for the opcode and register
fields.
74
Find out the number of RAM chips of size 5
256K×1bit required to build 2M Byte memory.
75

Differentiate between Control Register, Data


Register and Address Register. Give example of 5
each.
76

Explain the functions of Address Bus, Control Bus 5


and Data Bus.
77

When a cache is 10 times faster than main memory,


and cache can be used 90% of the time, how much 5
speed we gain by using the cache?
78

A program P reads in 500 integers in the range


[0. .. 100] representing the scores of 500 students. It
then prints the frequency of each score above 50. 5
What would be the best way for P to store the
frequencies?
79

What is the worst case time complexity for search 5


operations in a Binary Search Tree?
80

Part C
QB
Question
Sr. Question
Marks
No.
A priority queue is implemented as a max-heap.
Initially, it has five elements. The level-order
traversal of the heap is given below: 10
10, 8, 5, 3, 2. Two new elements `1’ and `7’ are
1 inserted in the heap in that order. Evaluate the
level-order traversal of the heap after the
insertion of the elements.

The C function takes a simply linked


list as input argument. It modifies the list by
moving the last element to the front of the list
10
and returns the modified list. Implement the
above function.
2
Consider two binary operators ” and `↓’ with
the precedence of operator ↓ being lower than
that of the operator . Operator is right
10
associative while
operator ↓ is left associative. Evaluate the parse
3 tree for the expression (7↓343↓2).
Consider the following recursive C function that
takes two arguments:
unsigned int foo (unsigned int n,
unsigned int r) {
if (n>0) return ((n% r) + foo (n/r, r) ); 10
else return 0;
}
Evaluate the return values of the function foo
4 when it is called foo(345, 10) and foo(513, 2).
Calculate the minimum and maximum number of
element comparisons involved in 2 way merge 10
5 sort assuming n is power of 2.
Evaluate how many nodes (apart from s) does the
Depth First Search algorithm discover before
discovering t when starting from s.

10

6
Create an AVL tree by the following elements
in Lexicographic order: Jan, Feb, Mar, Apr,
10
May, Jun, Jul, Aug, Sep, Oct, Nov & Dec. Show
7 balance factors after insertion of each element.
Consider a sequence a of elements a0 = 1, a1 = 5,
a2 = 7, a3 = 8, a4 = 9, and a5 = 2.
The following operations are performed on a
stack S and a queue Q, both of which are initially
empty.
I: push the elements of a from a0 to a5 in that
order into S.
II: enqueue the elements of a from a0 to a5 in that
order into Q. III: pop an element from S.
IV: dequeue an element from Q. V: pop an
element from S. 10
VI: dequeue an element from Q.
VII: dequeue an element from Q and push the
same element into S. VIII: Repeat operation VII
three times.
IX: pop an element from S. X: pop an element
from S.
Show the stack and the queue at each intermediate
step.

8
The access time of a cache memory is 100 ns and
that of main memory is 1000 ns. It is estimated
that 70% of the memory requests are for read
and remaining 30% for write. The hit ratio for
read accesses only is 0.9. A write-through
procedure is used.
10
(a) What is the average access time of the system
considering only memory read cycles?
(b) What is the average access time of the system
for both read and write requests?
(C) What is the hit ratio taking into consideration
9 the write cycles also?
Consider a 2-way set associative cache
consisting of 256 blocks of 8 words each, and 10
10 assume that the main memory is addressable by
16-bit address and it consists of 4K blocks.
Calculate the number of bits in each of the TAG,
BLOCK/SET and word fields for different
mapping techniques?
A computer employs RAM chips of 256 × 8 and
ROM chips of 1024 × 16. The computer system
needs 2K bytes of RAM and 4K bytes of ROM
and four interface units each with four registers. 10
Draw a memory address map for the system and
give the address range in hexadecimal for RAM
11 and ROM chips.
A 4-way set-associative cache memory uses
blocks of four words. The cache can
accommodate a total of 1024 words from the
main memory. The main memory size is 128K ×
10
32.
(a) Formulate all pertinent information required
to construct the cache memory.
12 (b) What is the size of the cache memory?
Design a Turing machine to determine if a given
10
13 string is a palindrome.
Create a Turing machine to recognize the
language of all strings over {a, b} where the
10
number of occurrences of 'a' is twice the number
14 of occurrences of 'b'.
Create a Turing machine that computes the
10
15 Fibonacci sequence given an input number n.
Design a PDA to recognize the language of
balanced parentheses, where strings consist of '(' 10
16 and ')' symbols and are properly nested.
Implement a Turing machine that computes the
addition of two unary numbers represented as 10
17 strings of consecutive '1's.
A system has a writethrough cache with access
time of 100 ns and hit ratio of 90%. The main
memory access time is 500ns. 70% of memory
18 references are for read operations. Find out 10
average memory access time for read operations
only, Average memory access time for write
operations only, Average memory access time
for read-write operations both and Effective hit
ratio.
CPU referred to access the cache memory 200 times,
among them Cache hit is occurred for 160 times and
Cache miss is occurred for 40 times. For each hit
19 CPU requires 10 ns and for each miss CPU requires 10
100 ns. What will be the average memory access time
for CPU to access Cache memory? Explain the
working principle of Cache memory.

A 32-bit wide main memory unit with a capacity


of 1 GB is built using 256M ×4-bit DRAM
chips. The number of rows of memory cells in
the DRAM chip is 214. The time taken to
20 perform one refresh operation is 50 nanoseconds. 10
The refresh period is 2 milliseconds. What is the
percentage (rounded to the closest integer) of the
time available for performing the memory
read/write operations in the main memory unit?

Describe the interrupt handling process in a


typical computer system. Explain the steps
involved in responding to an interrupt request,
21 including interrupt recognition, vectoring, and 10
prioritization. Discuss the role of interrupt
service routines (ISRs) in handling interrupts.

String searching and pattern matching can be


done easily by finite automata. Design a machine
22 that accepts only strings containing 101 as a 10
substring. Now do the same (design a machine)
for the substring 00101.
Given the following database schema:
Employees(emp_id, emp_name,department_id,
salary)
Departments(department_id, department_name,
location)
23 Projects(project_id, project_name, emp_id, 10
start_date, end_date)
(a)Write an SQL query to retrieve the names of
employees who are working on more than one
project along with their department names.
(b)Write an SQL query to find employees whose
salary is greater than the average salary of their
respective department.

Given a sales database with the table


Sales(sale_id, product_id, customer_id,
sale_date, amount),
24 write a query to find the top 5 customers who 10
have spent the most on purchases in the last 6
months. Explain how your query ensures
efficiency.
Explain the architecture of the 8085 microprocessor
25 with a neat diagram. 10

Discuss in detail the design and working of a RISC


26 processor. 10

Analyze different types of memory mapping


27 techniques. 10

Demonstrate with a transition diagram that if


length of a string exceeds some specific value,
then pumping occurs.
28 On which characteristic of the machine does this 10
value depend?
Does pumping occur even otherwise?
Demonstrate.
Why BCNF is stricter than 3NF in RDBMS?
29 Justify your answer. 10

Show with an example that Canonical cover of a


30 set of Functional Dependencies may not be 10
unique.

Relation R has eight attributes (ABCDEFGH)


fields of R contains only atomic values. F = {CH
-> G, A -> BC, B -> CFH, E -> A, F -> EG} is a
31 set of functional dependencies (FDs). How 10
many candidate keys does the relation R have
(Need to show every steps) ?

Consider a relation scheme R = (A, B, C, D, E,


32 H) on which the following functional 10
dependencies hold: {A–>B, BC–> D, E–>C, D–
>A}. What are the candidate keys of R (Need to
show every steps)?
A table (R) has fields F1, F2, F3, F4, and F5
with the following functional dependencies:
F1->F3, F2->F4, (F1,F2)->F5
33 In terms of normalization, what is the highest 10
normal form this table (R) is in? Justify your
answer with proper explanation?

The relation schema Student_Performance


(name, courseNo, rollNo, grade) has the
following functional dependencies:
name,courseNo -> grade
rollNo,courseNo -> grade

34 name-> rollNo 10
rollNo-> name
What is the highest normal form of this relation
scheme (Student_Performance). Justify your
answer with proper explanation?

Define the use and difference of Primary Key,


35 Candidate Key, Foreign Key, Super Key, Unique 10
Key with proper example in RDBMS.
Write an algorithm to find the closure for a
36 given set of attributes of a relation R. 10

What is the need/application of 10


37 Canonical Cover in RDBMS .
When is it preferable to use a dense index
rather than a sparse index? Justify your 10
38 answer.
Compare and contrast I/O communication
techniques (Programmed I/O, Interrupt-driven I/O, 10
39 and DMA).
Evaluate different types of instruction formats 10
40 with examples.
Describe pipeline processing and suggest methods 10
41 to improve system performance.
Explain the concept of paging and segmentation in
virtual memory with advantages and 10
42 disadvantages.
Discuss RAID levels in computer storage with a 10
43 case study.
Design and analyze the working of a 10
44 multiprocessor system and its advantages.
Design a memory module with a total capacity of
64KB using 8KB chips. Calculate the number of 10
chips required and draw the memory
45 organization.
A system uses 4-way set-associative cache with a
total cache size of 16 KB. Each block is 64 bytes. 10
(a) Find the number of sets, (b) Determine the tag,
46 index, and offset bits for a 32-bit address.
Consider a CPU with a clock cycle time of 2 ns
and CPI values:

(a) Load: 5 cycles (30% instructions)

(b) Store: 4 cycles (20% instructions) 10


(c )Arithmetic: 2 cycles (40% instructions)

(d) Branch: 3 cycles (10% instructions)


Calculate the average CPI and CPU execution
47 time for 1 million instructions.
What is meant by Secondary Storage? Consider a
computer with four floating point pipeline
processors. Let each processor uses a cycle time of 10
40ns. How long will it take to perform 400
48 floating-point operations?
What is Programme Counter? Consider a
computer with four floating point pipeline
processors. Let each processor uses a cycle time of 10
50ns. How long will it take to perform 200
49 floating-point operations?
What is EPROM? Consider a computer with four 10
50 floating point pipeline processors. Let each
processor uses a cycle time of 10ns. How long will
it take to perform 200 floating-point operations?
The Pre-order traversal sequence of a Binary Search
Tree (BST) is 30, 20, 10, 15, 25, 23, 39, 35, 42. Find 10
the Post-order traversal sequence of the same BST?
51 (Need to show each steps).
Prove the below statement with proper diagram:
“Summation of degrees of all vertices in a graph is 10
52 twice the number of edges in graph.”
Post-order traversal of a given Binary Search Tree
(BST) produces the following sequence of keys: 3, 5,
7, 9, 4, 17, 16, 20, 18, 15, 14 . What will be the 10
sequences of keys for Pre-order traversal of the same
53 BST ? (Need to show each steps).
(a). String searching and pattern matching can
be done easily by finite automata. Design a
machine that accepts only strings containing
101 as a substring. Now do the same (design a
machine) for the substring 00101.

(b) Develop an algorithm to design finite 10


automata for substring searching.
The input should be the substring and the
output is a finite automaton state table. Be sure
to specify your data structures and intuitively
describe the algorithm.
54
(a). Design a Finite State Automaton which
reads binary strings and accepts only those that
end with 01. 10

(b). Convert the above NFA to a DFA


55
(a) Design a Finite State Automaton which
accepts all strings over {0,1} that contain at
least two 0s.
10
(b) Design a Finite State Automaton which
accepts all strings over {0,1} that do not end
56 with 01.
(a) Design a Finite State Automaton which
accepts all strings having even number
of 0s and even number of 1s
10
(b) Design a Finite State Automaton which
accepts all strings of the pattern anb:
n>=0
57
(a). DFA for integers divisible by 3.

(b). Draw NFA for 10


(0+1)*(010(0+1)*101 + 101(0+1)*010)(0+1)*
58
Let xR denote the reversal of the string x. (For
example, if x = 010011 then xR = 110010 and so
forth.) Prove that the sets accepted by finite
automata are closed under string reversal by 10
constructing for any finite automaton a new
machine that accepts the reversals of the
59 strings accepted by the original automaton.
(a). Suppose that the finite automata Mi and
Mk accept strings over the alphabet {0,1}.
Design an automaton which accepts strings of
the form x#y where x is accepted by Mi and y is
accepted by Mk.
10
(b). Prove that the class of sets accepted by
finite automata is closed under intersection. In
other words, given Mi and Mk construct the
finite automaton Mm such that:
T(Mm) = T(Mi) ∩ T(Mk)
60

You might also like