Download as pdf or txt
Download as pdf or txt
You are on page 1of 65

Unique Paper Code : 32341102

Name of the Paper : Computer System Architecture

Name of the Course : B.Sc. (H) Computer Science

Semester :I

Duration : 3 Hours Maximum Marks: 75

Attempt Any Four Questions


All Questions Carry Equal Marks.

Q1. A combinational circuit controls a light bulb using three binary switches. The bulb glows
whenever even number of switches is turned ON. Draw truth table for the said combinational
circuit and obtain an optimized Boolean expression in Sum Of Products (SOP) and Product
Of Sums (POS) forms using Karnaugh Maps. Also draw the logic diagrams for Boolean
expressions obtained in both SOP and POS forms.

Q2. Consider the following snapshot of a memory to answer the questions that follow:

Memory
200 600
.
.
.
400 MODE OPCODE
401 200
.
.
.
600 30

A two word instruction is stored at location 400 with its address field at location 401. Which
addressing mode is being used if the value of operand is 30, 200 and 600 respectively? If the
effective address obtained by using indexed register addressing mode is 300. What is the
content of index register? If the OPCODE of the instruction is BUN, what would be the value
of program counter before and after the execution of the instruction? What would be the
value of program counter before and after the execution of the instruction if the OPCODE is
ADD? Give the excitation table for a flip flop AB whose characteristic table is given as
follows:
A B Q(t+1)
0 0 Q’(t)
0 1 0
1 0 1
1 1 Q(t)
Q3. Perform the following operations as directed:
 Convert 4433₅ in the given radix to decimal number system and then to binary
number system
 CF6D16 to octal number system
 Add 648 and 358
 Subtract 7B₁₆ from C4₁₆ using signed 2’s complement form
 Give BCD representation of 5468.

Q4. Specify the number of bytes that can be stored in a 32M × 16 memory. How many
address lines and data lines are required for it? How many 32 × 8 chips are required to
provide a memory capacity of 1024 × 8. Show the interconnections required to construct a
256 × 8 ROM from 128 × 8 ROM chips and a decoder.
Identify the type of following I/O interface commands:
 check to see if a printer is ready for printing
 skip to the beginning of a tape
 check for an error during an I/O transfer
 write a block of data onto a magnetic disk.

Q5. A computer uses a memory unit of 256K words of 16 bits each. A binary instruction code
is stored in two words of memory. The instruction has four parts: an addressing mode field to
specify one of the two addressing modes, an operation code, a register code part to specify
one of the 256 registers and an address part. Calculate the number of bits in each part of the
instruction and indicate them by drawing the instruction format. Calculate the number of
operations that can be supported by the above mentioned instruction format.

Figure I. The Common Bus System


Consider the common bus system of a basic computer depicted in Figure I. The control inputs
given in Table I are active in the common bus system at a time instant t0. Give register
transfer statements to specify the register transfer that will be executed during the next clock
transition t1.
S2 S1 S0 LD of register Memory Adder
I. 1 0 1 PC - -
II. 1 0 0 DR Write -
III. 0 0 0 AC - Add
IV. 1 1 1 TR Read -
V. 0 1 1 OUTR -
Table I. Control Inputs active in Common Bus System at time instant t0

Q6. A non pipe line system takes 30 ns to process a task. The same task can be processed in
a four – segment pipe line with a clock cycle of 10ns. Determine the speedup ratio of the pipe
line for 100 tasks.

Explain briefly the following microoperations:


 M [AR] ← PC, PC ← AR+1
 If (FGI = 1) then PC ← AR
 E ← Cout
 If (AC(15) = 1) then S ← 0
 (IEN)(FGO+FGI): R←1

Using the appropriate operation codes listed in Table II, specify the 14-bit control word that
must be applied to the processor to implement each of the following microoperations:
R5←R4 ᴧ R1, R3 ← R2

OPR Select Operation


00000 Transfer A
00110 OR A and B
10100 ADD A and B
10110 Complement A
00100 Subtract A – B
01110 AND A and B
Table II. Encoding of ALU operations

Write a program to evaluate the arithmetic statement: (A – B) / C + D using one address


instructions.
Unique Paper Code : 32341102-OC
Name of the Paper : Computer System Architecture
Name of Course : B.Sc. Hons. Computer Science
Semester :I
Duration of Examination : Three Hours

Maximum Marks : 75 Marks

(For students admitted in 2015, 2016, 2017 & 2018)

Instructions for Candidates:

1. Answer any FOUR questions out of SIX.


2. All questions carry equal marks.
1. Design a combinational circuit with three binary inputs a, b & c and three binary outputs
x, y & z. When the binary input has even number of 1’s, then the output is one more
than the input. When the binary input has odd number of 1’s, then the output is one less
than the input. The output remains the same if the input is zero.
Redraw the above designed circuit using NAND gates only.
Explain the functionality and disadvantage of SR flip-flop.

2. A two-word instruction at address 300 and 301 is a “load to AC” instruction with an
address field equal to 400. The first word of the instruction specifies the operation code
and mode, and the second word specifies the address part. PC has the value 300 for
fetching the instruction. The content of processor register R1 is 500, and the content of
index register XR is 200. Consider the following memory state:
Address Memory
300 Load to AC | Mode
301 400

400 425

425 450

499 525
500 550
501 575

600 650

700 725
701 726
702 750

900 925
925 950

The content of R1 is incremented and decremented prior to the execution of the


instruction in case of autoincrement and autodecrement respectively. Show the content
of AC in case of following addressing mode:
• Indirect
• Relative
• Indexed
• Register
• Autodecrement
What would be the content of R1 after the execution of instruction Autoincrement?
3. The content of AC in hexadecimal is BF43 and the initial value of E is 1. The initial
value of PC in hexadecimal is 08F. The three instructions (CIR, SNA & CMA) will
execute in the following sequence:
CIR
SNA
CMA
Determine the contents of AC, E, PC, AR and IR in hexadecimal after the execution of
every instruction. [Hint: The operation code for CIR is 7080, SNA is 7008 & CMA is
7200.]

4. Perform the arithmetic operation (-54) - (-35) in binary using signed 2’s complement
representation for the negative numbers.
Perform the following conversions to the indicated bases:
• (973456)10 = ( ? )6
• (FE123)16 = ( ? )8
• (101110.101)2 = ( ? )10
Give the logic diagram and truth table of a 3-to-8-line decoder using NAND gates only.
Include an active low enable input.
5. In a certain scientific computation, it is necessary to perform the arithmetic operation
(Ai * Bi) + (Ci * Di) with a stream of numbers. Using a diagram of combinational
circuit, specify a pipeline configuration to carry out this task. Assuming that there are
6 tasks for the given computation, list the contents of all registers in the pipeline for i =
1 through 6 with the help of a table. Draw a space time diagram for this pipeline.

6. Assuming 5-bit registers that hold signed numbers, show the step-by-step
multiplication process using Booth algorithm when numbers
(-8) & (-12) are multiplied in binary.
Also perform the division of 0101010 by 111. (Both the dividend and divisor are fixed-
point binary number in signed magnitude representation)
[This question paper contains 3 printed pages.]
Your Roll No. …………….............
Unique Paper Code : 12365125_OC
Name of the Paper : Introduction to Operational Research and Linear Programming
Name of the Course : B.Sc. (Hons.) /B.A. (Hons.)
Semester : I

Duration : 3 Hours. Maximum Marks: 75

Instructions for Candidates

1. Attempt any four questions from Q1 to Q6.


2. All questions carry equal marks.
Q1. Show that the set C={(𝑥1 , 𝑥2 , 𝑥3 ): 2𝑥1 − 𝑥2 + 𝑥3 ≤ 4} ⊂ R3 is a convex set. Check whether
the vectors (2, 6, 3), (4, 3, 6) and (1, 4, 2) form a basis of R3?

Q2. A firm produces three products A, B and C. It uses two types of raw materials I & II.The
maximum availability of raw materials I & II is 5000 and 7500 units, respectively. The raw
material requirement per unit of products are given below:

Raw material Requirement per unit of Product


A B C
I 3 4 5
II 5 3 5

The labour time for each unit of product A is twice as that of product B and three times of
product C. The entire labour force of the firm can produce the equivalent of 3000 units. The
minimum demand for the three products are 600, 650, and 500 units respectively. The number of
units produced must be in ratio 2:3:4. Assuming the profit per unit of A, B, C is 50, 50 and 80
respectively, formulate the problem as a linear programming problem in order to determine the
number of units of each product which will maximize the profit. Use the simplex method to
obtain the optimal solution.
Q3. Find all possible basic solutions for the following system of linear equations:
2𝑥1 + 𝑥2 − 𝑥3 + 2𝑥4 = 2
3𝑥1 + 2𝑥2 + 𝑥3 + 6𝑥4 = 3
Classify them as feasible, infeasible, degenerate and non-degenerate.
Q4. Use the dual simplex method to solve the following LPP:
𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒 𝑍 = 3𝑥1 − 2𝑥2
𝑆𝑢𝑏𝑗𝑒𝑐𝑡 𝑡𝑜 𝑥1 + 𝑥2 ≥ 1
𝑥1 + 𝑥2 ≤ 7
𝑥1 + 2𝑥2 ≥ 10
𝑥2 ≤ 3
𝑥1 , 𝑥2 ≥ 0
Q5. Solve the following Linear Programming Problem using Big-M method:
𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒 𝑍 = 3𝑥1 + 2𝑥2 + 𝑥3
𝑆𝑢𝑏𝑗𝑒𝑐𝑡 𝑡𝑜 2𝑥1 + 5𝑥2 + 𝑥3 = 12
3𝑥1 + 4𝑥2 = 11
𝑥1 𝑖𝑠 𝑢𝑛𝑟𝑒𝑠𝑡𝑟𝑖𝑐𝑡𝑒𝑑 𝑖𝑛 𝑠𝑖𝑔𝑛 , 𝑥2, 𝑥3 ≥ 0
Q6. Consider the following LPP:
𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒 𝑍 = 3𝑥1 + 𝑐2 𝑥2 + 𝑐3 𝑥3
𝑆𝑢𝑏𝑗𝑒𝑐𝑡 𝑡𝑜 2𝑥1 + 3𝑥2 ≤ 8
2𝑥2 + 5𝑥3 ≤ 𝑏2
3𝑥1 + 2𝑥2 + 4𝑥3 ≤ 15
𝑥1 , 𝑥2 , 𝑥3 ≥ 0
Find an optimal solution to the above problem by taking c2=5, c3=4, and b2=10. Also, find the
range within which these three parameters must lie so that the current solution remains feasible
as well as optimal.

.
Unique Paper Code : 32341303
Name of the Course : B.Sc. (H) Computer Science
Name of the Paper : Computer Networks
Semester : III
Duration : 3 Hours
Maximum Marks : 75
Year of Admission : 2019

Instructions for Candidates:

Attempt any Four out of Six questions.


All Questions carry equal marks.

Q1 What are the three flow control/Error recovery protocols used for noisy channel?
Compare and contrast the Go-Back-N ARQ with Selective Repeat ARQ. Consider that
a 1Mbps satellite link connects two ground stations. The altitude of the satellite is
36,504 km and speed of the signal is 3 × 108 m/s. Assume that the acknowledgment
packets are negligible in size and that there are no errors during communication. What
should be the packet size for a channel utilization of 25% for the satellite link using go-
back-127 sliding window protocol? Further consider that a message M = 1010001101
needs to be transmitted over this link. Cyclic redundancy check (CRC) with divisor
polynomial x5 + x4 + x2 + 1 is used for error detection. What will be the final message
transmitted over the link?

Q2 Explain the circuit switching and packet switching techniques. How is virtual circuit
approach different from datagram approach? A message of size 500 bytes has to be sent
in a network having bandwidth 10Mbps. Assume that each packet contains a header of
100 bytes and packet switching technique is used. If the message is divided into 5
packets, what would be the transmission delay?

Q3 What characteristics of the carrier signal are changed to represent the digital signal in
each of the following modulation techniques: - ASK, FSK, PSK and QAM?
Which of the four digital to analog modulation techniques (ASK, FSK, PSK, QAM) is
most susceptible to noise? Defend your answer.
In a QAM modulation scheme, there are 4 amplitude levels and 16 phase levels and bit
rate is 72 Kbps. Calculate the baud rate.
Q4 The following character encoding is used in a data link protocol:

A: 11010101; B: 10101001; FLAG: 01111110; ESC: 10100011.

Show the bit sequence transmitted (in binary) for the five character frame. A ESC B
ESC FLAG when each of the following framing methods are used:

i. Character count
ii. Flag bytes with byte stuffing.
iii. Starting and ending flag bytes, with bit stuffing

Also find the original data for the given output obtained after applying byte-stuffing
technique:

FLAG A B ESC ESC C ESC ESC ESC FLAG ESC FLAG D E FLAG.

Q5 What is Count to infinity problem? Explain it in brief with suitable example.


Consider a network with 6 routers R1 to R6 connected with links having weights as
shown in the following diagram.

All the routers use the distance vector routing algorithm to update their routing tables.
Each router starts with its routing table initialized to contain an entry for each neighbor
with the weight of the respective connecting link. After all the routing tables stabilize,
how many links in the network will never be used for carrying any data? Also show the
distance vector maintained at each router.

Q6 The network 200.1.2.30 has been subdivided into 4 subnets.

(i) Which class the given IP address belongs to?


(ii) Give the subnet mask for the given IP address.
(iii) Give the IP addresses of these 4 subnets.
(iv) How many hosts can be on each subnet?
(v) Determine the starting IP address and the last IP address of each subnet.
(vi) Determine which network the IP address 200.1.2.130 belongs to.
(vii) Determine the limited broadcast address for each subnet.
This Question Paper contains 3 page(s)

Unique Paper Code : 32341302


Name of the Course : B.Sc. (H) Computer Science CBCS
Name of the Paper : Operating System
Semester : III
Duration : 3 hours
Maximum Marks : 75
Year of Admission : 2015-2018

Attempt any four questions. All Questions carry equal marks.


Q 1. Given memory partitions of 110 KB, 450 KB, 290 KB, 350 KB and 700 KB (in
order), how would each of the first-fit, best-fit and worst-fit algorithms place
processes of 200 KB, 410 KB, 110 KB and 420 KB (in that order) ? Which algorithm
makes the most efficient use of memory?

Consider a paging system with the page table stored in memory. If a memory
reference takes 100 nanoseconds how long does a paged memory reference take? If
we add a TLB and 70 % of all page-table references are TLB hits, what is the
effective memory reference time? (Assume that finding a page-table entry in the TLB
takes 10 nanoseconds, if the entry is there.)

Assuming a 2-KB page size, what are the page numbers and offsets for the following
address references (provided as decimal numbers): 5378, 15300, and 20500. Show
calculation at each step.

Q 2. Consider a system consisting of four resources of the same type that are shared by
three processes, each of which needs at most two resources. Show that the system is
deadlock free using resource allocation graph. What is the effect of multithreading on
deadlock?

At a particular time of computation the value of a counting semaphore is 10. Then 8


wait ( ) operations and 5 signal ( ) operations were completed on this semaphore.
Determine the resulting value of the semaphore? Show the execution at each step.

A program has just read the fifth record. It next wants to read the eleventh record.
How many records must the program read to input the eleventh record using Direct
Access and Sequential Access methods? Explain your answer.

Q 3. Consider the following page-reference string: 3,1,2,4,2,3,1,5,6,2,1,2,3,7,6,3,2,1,2,3


How many page faults would occur for Optimal and Least recently used replacement
algorithms, assuming three and four frames? Note that all frames are initially empty,
and first unique pages will all cost one fault each.

Assume we have a demand-paged memory. The page table is held in registers. It


takes 10 milliseconds to service a page fault if an empty page is available or the
replaced page is not modified and 30 milliseconds if the replaced page is modified.
Memory access time is 100 nanoseconds. Assume that the page to be replaced is
modified 80 percent of the time. What is the maximum acceptable page-fault rate for
an effective access time of no more than 100 nanoseconds?

If the total number of frames in main memory is 120 and there are 4 processes in the
system with the demand as 40, 10, 90 and 60 frames, respectively. What will be the
number of frames allocated using the equal and proportional allocation strategies?

Q 4. Consider the following set of processes, with the length of the CPU burst times given
in milliseconds:
Processes Burst Time Priority Arrival Time
P1 12 3 0
P2 10 4 1
P3 2 2 2
P4 3 1 3
P5 5 2 4

Draw four Gantt charts illustrating the execution of these processes using FCFS, pre-
emptive SJF (equal burst length processes are scheduled in FCFS), a pre-emptive
priority (small priority number means high priority, equal priority processes are
scheduled in FCFS), and a RR (quantum=3) scheduling.
And calculate average waiting and turnaround time for all above mentioned
scheduling algorithms.

Which of the following scheduling algorithms could result in starvation: Shortest-job


first, Round robin and Priority. Justify your answer.

Q 5. Suppose that a disk drive has 3000 cylinders, numbered 0 to 2999. The drive is
currently serving a request at cylinder 140, and the previous request was at cylinder
120. The queue of pending requests, in FIFO order, is

500, 1400, 910, 1700, 940, 1509, 1022, 170, 1300

Starting from the current head position, what is the total distance (in cylinders) that
the disk arm moves to satisfy all the pending requests, using SSTF, C-LOOK and
SCAN disk scheduling algorithms?

What will happen if a user program to get stuck in an infinite loop and never return
control to the operating system. Explain how operating system deals with such
problem?

Q 6. Consider the following code fragment executed by a process. What will be the output
of this code? Justify your answer.
#include < unistd.h >
int main ()
{
int i ;
for (i=0; i<8; i++)
if (i%2 == 0) fork ( ) ;
return 0 ;
}

List three major activities of an operating system with regard to File Management
and Memory Management. Give justification for your answer.
Explain what may happen if setting the values of Base and Limit registers are not
privileged instructions? Also why is it easy to add a new service in microkernel
approach?
Unique Paper Code : 32341301-OC
Name of the Paper : Data Structures
Name of the Course : B.Sc. (H) Computer Science
Semester : Third (III)
Duration of Examination : Three Hours
Maximum Marks : 75 marks

Instructions for candidates:


Attempt any 4 questions out of 6 questions.

Q1 Write a recursive function ‘reverse()’ to input a line and print in


reverse order. State whether the function is using Tail recursion or non-tail
recursion? Show the status of run time stack when ‘abcd\n’ is given as
input in the reverse() function. Convert the reverse() function
into non-recursive function using Stack. State whether Stack is a LIFO or
a FIFO structure.
Following definition of a recursive function is given:

h(n) = 0 if n=0;
= n if n > 4
= h(2+h(2n)) if n <=4

What is the value of h(n) if n = 1?

Q2 The following list of numbers is given

3, 28, 45, 23, 12, 26, 90, 56, 76

To search a given number in the above list, which of the searching


technique (linear/binary) is best suited. What is the time complexity of the
suggested technique? Does hashing the above numbers improve the search
efficiency. Draw a hash table with open addressing and a size of 11. Use
the hash function “k%11” and linear probing for collision resolution.
Insert the above keys into your table (in that order). Show the status of
table after each insertion.
Sort the above numbers using a divide and conquer algorithm. Specify the
algorithm and show each step of the algorithm.

Q3 If a triangular matrix of n x n dimension is stored as a 1D array, how


many elements will be there in 1D array? Suppose the following
triangular matrix is given:
2 0 0 0
3 8 0 0
4 0 6 0
0 5 2 0
Show the elements of the 1D array if the matrix is stored by
i) rows ii) columns iii) diagonals (lowest diagonal first) iv) diagonals
(highest diagonal first). Write the code of get(int i, int j)
function which returns the element stored at ith row and jth column
of the given matrix. Give the necessary class definitions. If the matrix is
sparse, is it a better idea to use linked lists? Justify.

Q4 Draw a binary search tree for the following sequence:

55, 45, 89, 35, 99, 23, 78, 12, 0, 25, 69, 49

Show each step separately. Is it a complete binary tree? Justify. Next,


delete the node having value 55. Use delete by merging method. What is
the effect on the height of the resulting tree? Write a function to perform
the following operations on a binary search tree
i) Count the number of leaves
ii) Calculate the height of the tree
Give the necessary class definitions.

Q5 Draw the binary search tree corresponding to the following traversals

Preorder traversal: JCAEGFMR


Inorder traversal: ACEFGJMR

Give the post order traversal of the constructed tree. What are the
advantages of B-tree over binary search tree? Construct a B tree of order
5 by inserting the following keys:

9,14,3,16,4,1,17,6,5,28

Show the B tree diagrammatically after each key insertion

Q6. Write a template function to insert a new node p into a single linked list
before the node q where p and q are the node pointers. The function takes
p and q as input. Give the necessary class definitions. Describe the
situation in which double linked list has an advantage over single linked
list. Does self-organising the list helps in searching? What are the different
ways of self-organizing lists? For a given linked list having A, B, C, D as
nodes, show the list after each step using Move to Front method. Steps
are:
i) search D, ii) search D iii) search B iv) search A v) search B vi) search D
vii) search A viii) search B
Unique Paper Code : 32347506
Name of the Course : B. Sc. (Hons.) Computer Science (CBCS)
Name of the Paper : Advanced Data Structures and Algorithms
Semester : V
Duration : 3 Hours
Maximum Marks : 75
Year of Admission : (Admission of 2015, 2016, 2017 & 2018)

Instructions for candidates:


Attempt any four questions.
All questions carry equal marks.

Q1.
a) List the trade off between choosing a binary heap vs a Fibonacci heap to implement priority
queue.

b) Suppose we implement increase_key function in a min heap using Fibonacci heap as follows:

increase_key(node, new_key)
1. Increase the key of node to new_key
2. Concatenate the child-list of node to root-list, update the parent of all children
to NULL. Erase the mark attribute (if present) of child nodes.
3. Cut the node from its parent z and insert it to root list. Apply cascading cut to z
similar to the decrease_key() function of Fibonacci heaps. Reset (erase) the
mark attribute on node.

i) Is this algorithm correct?

ii) What is the amortized cost of this algorithm?

iii) If we add an additional step of consolidating the root list after step 3, would the
amortized cost change, explain?

Q2.
a) Suppose a document is composed of six unique characters A-F. Probabilities of occurrence of
the characters are given as:

A: 0.45, B: 0.12, C: 0.09, D: 0.13, E:0.16, F=0.05

Compression ratio of a document is defined as the ratio of average code length in Huffman code
to average code length in fixed length code. What is the compression ratio achieved by Huffman
algorithm for this document?

b) Let Z be an alphabet. We associate a frequency with each character of Z. Let x, y ∈ Z be two


characters having the least frequencies. Show that there exists an optimal prefix code where the
codewords of x and y have same length and differ only in their rightmost bit.
Q3.
a) Due to ongoing pandemic of covid19, a student will be given a set of n assignments by her
teachers through online mode. The student has the following information in advance for each
assignment:
1. Starting time- the time when a teacher will upload an assignment.
2. Ending time- the submission deadline by which student needs to upload her
solution.
3. Marks- the marks associated with the assignment.
The duration between the starting and the ending time of an assignment is just sufficient time to
work on that assignment alone. Therefore if the student chooses to begin working on one
assignment, she can not work on another assignment simultaneously. Moreover partial
submissions will fetch zero marks, so she always chooses an assignment that can be completed.
The good news is that for every complete submission, she always gets full marks. She has to
select a subset of assignments to work on so as to maximize her total marks. A dynamic
programming solution to this problem first sorts the assignments in the increasing order of their
starting times. Let Opt[i] denote the optimal marks obtained by considering the first i assignments
in the sorted list of assignments.

i) Give a recurrence for Opt[i] when ith assignment is included in the selection.
ii) Give a recurrence for Opt[i] when ith assignment is not included in the selection.
iii) Give the final recurrence for Opt[i].
iv) Give the base cases for the recurrence.
v) Derive the time complexity of the approach and explain.

b) Using a dynamic programming approach, identify if there is any negative cycle in the following
graph. Show all steps.

Q4.
a) Given a min heap of n positive integers. Consider the following strategies to find largest integer
in this heap.

Strategy 1: Treating the heap as an unordered array, do a sequential search for the largest integer.

Strategy 2: Now consider the following divide and conquer strategy:


find_max(root):
if root == NULL:
return -1
l=find_max(root.left)
r=find_max(root.right)
return(max(l, r, root.key))
i. What is the time complexity of strategy 1?
ii. Is the strategy 2 correct? Give the recurrence for running time and the solution of
recurrence.
iii. Give an algorithm which makes no more than n/2 comparisons for finding the maximum
element in the min-heap? Justify the time complexity of the approach.

b) Write the recurrence relation for time complexity of Karatsuba’s algorithm of fast integer
multiplication for multiplying two large integers in O(n 1.59) time. Using your recurrence compute
the number of single digit multiplications for the product 1552×2374. Compare this to the number
of single digit multiplications required in basic multiplication method.

Q5.
a) A k-coloring of a graph G = (V,E) is a function f: V→{1, 2, ... k} so that for every edge (u, v),
we have f(u) ≠ f (v). The available colors here are named 1, 2, ... k, and the function f represents
our choice of a color (or a label) for each node. The k-coloring problem is defined as follows:
“Given a graph G and a bound k, does G have a k-coloring?”

i. What is the lower bound on k for a complete graph having n vertices?


ii. What is the lower bound on k for a bipartite graph having n vertices?
iii. Show that 3-coloring problem is in NP.
iv. Show that 2-coloring problem is in P.

b) Ankit and Neha have been debating about two optimization problems X and Y. Both X and Y
are known to be in NP. Ankit shows a polynomial time reduction from the set-packing problem to
X, and Neha shows a polynomial time reduction from Y to vertex cover.

Ankit infers: X is NP complete while nothing can be said whether Y is NP complete or not.
Neha infers: Y is NP complete while nothing can be said whether X is NP complete or not.

i. Determine whether Ankit/Neha is/are correct or not. Justify.


ii. Is Y ≤P X? Justify your claim.
iii. If we assume that class P = class NP, then which of the following classes do each of X and
Y belong to: P, NP, NP complete? Justify briefly.

Q6.
Consider the problem of finding the maximum flow in a network graph G = (V, E), with capacity
ce on each edge e, source vertex s and sink vertex t. Let f be the flow through the graph at i-1th
iteration of Ford-Fulkerson’s max flow algorithm. Let f’ be the flow in ith iteration. Given that
initially, the flow is zero which is a valid flow in terms of both capacity and conservation
constraints, argue along the following points regarding validity of flow at each iteration. Let the s-
t path selected in ith iteration be P.
a) Show that in following two cases for an arbitrary edge e = (u,v) on path P, the capacity
constraint is satisfied i.e. 0 ≤ f’(e) ≤ ce:
i) Argue that if e = (u, v) is a forward edge, the capacity constraint is satisfied.
ii) Argue that if e = (u, v) is a backward edge on path P, the capacity constraint is satisfied.

b) Let v be a node on P, argue that in each of following four cases, the conservation constraint is
satisfied on v, i.e., fin(v) = fout(v).
i) Show that if both e and e0 are forward edges, the conservation constraint is satisfied at v.
ii) Argue that if both e and e0 are backward edges, the conservation constraint is satisfied
at v.
iii) Show that if e is a forward edge and e0 is a backward edge, the conservation constraint
is satisfied at v.
iv) Argue that if e is a backward edge and e0 is a forward edge, the conservation constraint
is satisfied at v.
Unique Paper Code : 32347501
Name of Course : B.Sc. Hons. Computer Science
Name of the Paper : Systems Programming
Semester :V
Duration of Examination : 3 Hours

Maximum Marks : 75 Marks

Students admitted in the year : 2015-2018

Instructions for Candidates:

1. Answer any FOUR questions.


2. All questions carry equal marks.

1. Assume
1 that three object files b.obj, c.obj and a.obj are given to the Pass I of the
linker in the order specified. Consider the following section and symbol tables for the
three object files. Construct the combined section table (CST) and public definition
table (PDT) generated during Pass I of linking process showing all intermediate steps.
Also draw the layout of final executable file generated after Pass II of linking process
(show all the intermediate steps in CST).

Name Size Align Name Location Section-id


.branch1 630 8 P1 39 1
.branch2 12 4 Symbol table for a.obj
.branch3 68 16
Section table for a.obj

Name Size Align Name Location Section-id


.branch1 800 8 P2 28 1
.branch3 340 16 P3 67 3
.branch4 41 4 Symbol table for b.obj
Section table for b.obj

Name Size Align


.branch3 315 16
.branch4 60 4
.branch5 160 8
Section table for c.obj
2. Describe the calling and return sequence between the procedure calls for the
following selection sort program on the given input. Also show the division of task
between the caller and the callee at each step.

void swap(int arr[], int i, int j) {


int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp; }

void selectionSort(int arr[ ], int i, int n) {


int min = i;
for (int j = i + 1; j < n; j + +) {
if (arr[j] < arr[min])
min = j; }
swap(arr, min, i);
if (i + 1 < n) {
selectionSort(arr, i + 1, n); }
}

void printArray(int arr[ ], int n) {


//print the sorted array }

main( ) {
int arr[ ] = { 9, −8, 4, 42, −5 };
int n = sizeof(arr) / sizeof(arr[0]);
selectionSort(arr, 0, n);
printArray(arr, n); }

3. Write a Lex program that checks whether the given name of a URL (Uniform
Resource Locater) is in the correct format. The program should also identify the
protocol, domain name and path name as well as file name, if any, in the URL.

4. Consider the following grammar with set of non-terminals as {S,P,Q,R} and set of
terminals as {=,+,int,(,),id }. S is the start symbol.

𝑆→𝑃=𝑄
𝑄 →𝑅|𝑄+𝑅
𝑅 → 𝑃 | 𝑖𝑛𝑡 | (𝑄)
𝑃 → 𝑖𝑑

Construct LR (1) set of items and GOTO graph (DFA) for the above grammar. Also,
construct LALR parsing table for the above grammar by compacting states formed in
LR (1) set of items.
5. Consider the following grammar:

𝑆 → 𝑆(𝐸) | 𝐸
𝐸 → (𝑆)𝐸 | 0 | 1| ∈

Determine five strings of length greater than five that can be parsed by the above
grammar and draw the corresponding parse trees. Is the above grammar ambiguous?
Justify your answer.

6. Construct a syntax directed definition that generates correct three-address code for C-
style for-statements and do-while statements.
Unique Paper Code : 32341502
Name of Course : B.Sc. Hons. Computer Science
Name of the Paper : Theory of Computation
Semester :V
Duration of Examination : 3 Hours

Maximum Marks : 75 Marks

Students admitted in the year : 2015, 2016, 2017, 2018

Instructions for Candidates:

1. Answer any FOUR questions.


2. All questions carry equal marks.
3. Assume ∑ = {𝑎, 𝑏} for all the questions unless specified otherwise.

1. Construct
1 a regular expression and corresponding deterministic finite automaton
(DFA) defining a language comprising all strings of length 5 or more such that the
letter appearing just before the last is same as the second letter of the string.

2. Construct a finite automaton (FA) for 𝐹𝐴1 + 𝐹𝐴2 , 𝐹𝐴1 . 𝐹𝐴2 , and 𝐹𝐴1 ∗ .

𝐹𝐴1 𝐹𝐴2

3. For languages, 𝐿1 : (𝑎𝑎 + 𝑎𝑏 + 𝑏𝑎 + 𝑏𝑏)∗ and 𝐿2 : (𝑎 + 𝑏)∗ 𝑎𝑎(𝑎 + 𝑏)∗ , construct


respective DFA’s and derive a finite automaton that defines 𝐿1 ∩ 𝐿2 . Also, construct a
regular expression for the resultant DFA.

4. Prove that the language 𝐿 = {𝑎𝑛 𝑏 2𝑚 𝑎2𝑚 𝑏 𝑛 : 𝑛 ≥ 1} is non-regular and construct a


Pushdown Automaton (PDA) that accepts 𝐿. Trace the working of PDA on the string
aabbbbaaaabb.
5. Consider the following context free grammar (CFG):

𝑆 →0𝐴0|1𝐵1|𝐵𝐵
𝐴→𝐶
𝐵 →𝑆|𝐴
𝐶 →𝑆| ∈

Eliminate ∈ − productions, followed by the elimination of unit productions, and then


remove all the useless symbols. Also, put the resultant grammar into Chomsky
Normal Form (CNF). Here, ∈ represents the null string.

6. Considering ∑ = {𝑎, 𝑏, , }, design a Turing Machine (TM) (single tape or multi-


tape as you prefer) that transforms w to ww . Show the trace of TM on
the string abb .
Unique Paper Code : 32345103
Code of the Paper : GE-III (Old Course)
Name of the Paper : Computer Networks and Internet Technologies
Name of the Course : B.Sc. (H)
Semester : Semester - I
Duration of Examination : 3 Hours
Maximum Marks : 75

Instructions for Candidates:

i. Attempt any four questions from Question 1 to Question 6.


ii. Each Question carries equal marks.
1. With the help of an example, differentiate between a URI and URL. Also explain the
components of a URL.
Further, discuss the various ways in which CSS code can be incorporated in an HTML
document. Provide a CSS code to format the paragraph, body and h1 tags so that they
display text with different colors, different fonts and sizes.
2. Compare the characteristics of different types of guided media. Which is the preferred
guided media for deployment under the oceans?

Also, write an HTML code to create a part of Periodic Table as given below.

3. Discuss the role of DNS in the Internet.

Also write a code to create the following form in HTML


4. Explain the layers in which following tasks are performed in the ISO-OSI reference model.
◦ Physical addressing
◦ Logical addressing
◦ Routing
◦ Session Management
◦ Encryption/Decryption

What are frames? Discuss the Frameset tag and the iframe tag used in HTML to create
frames and write HTML code to create the following layout using them.
FRAME 1 FRAME 2

FRAME 3

FRAME 4

5. Write short notes on FTP, TELNET and SMTP.

Also write a Javascript code to swap the value of two variables. (Swap means interchange. If
a = 10 and b = 20 then after swapping a = 20 and b = 10).

6. Write short notes on different types of network topologies (Bus, Ring, Mesh, Star). Which
topology is the best for broadcasting? Justify your answer.

Write a HTML code to create the table below as it is:

Find x using the formula, x = a2 + b2 – 4ab Put an


a b x Image in
this Cell
Roll No. ……………….

Unique Paper Code : 32341101-OC


Name of the Paper : Programming Fundamentals using C++
Name of the Course : B.Sc(H) Computer Science, DSC-1
Semester :1
Duration : 3 hrs
Maximum Marks : 75
Instructions for Candidates
1. Write your Roll no. on top immediately on receipt of this question paper.
2. Answer any FOUR questions out of SIX given in the question paper.
3. All questions carry equal marks.

1 Write a C++ program/ function/ program segment to do each of the following tasks:

• Write a temperature-conversion program that gives the user the option of


converting Fahrenheit (F) to Celsius (C) or Celsius to Fahrenheit where F= 9C/5
+32. Then carry out the conversion. Use floating-point numbers. Interaction with
the program might look like this:
Input: -
Type 1 to convert Fahrenheit to Celsius,
Type 2 to convert Celsius to Fahrenheit: 1
Enter temperature in Fahrenheit: 70
Output: -
In Celsius that’s 21.111111.

• Write a function to generate the given sequence. For example, if n=4 your
function should produce output as follows: 1, 2, 2, 3, 3, 3, 4, 4, 4,
4, ….
You may assume that n is a positive integer.

• Raising a number x to a power p is the same as multiplying x by itself p times.


Write a function called power() that takes a double value for x and an int
value for p, and returns the result as a double value. Use a default argument of
2 for p, so that if this argument is omitted, the number x will be squared. Write a
main() function that gets values from the user to test this function.
• Given two strings, write a function to check whether two given strings are reverse
of each other. For example, "bat" and "tab" are reverse strings of each other.

2 Create an abstract class called Vehicle that defines the characteristics of an object of
Vehicle class using data members vehicle_id, engine_capacity and
no_of_wheels. The Vehicle has a member function enginecapacity()also.
Further,
• Create a derived class from class Vehicle called FourWheeler from base
Vehicle class with data member no_of_seats.
• Create two more derived classes Car and Bus using single inheritance from
class Vehicle. The derived class Car has a member function
enginecapacity() that displays the engine_capacity in cubic
centimeters.
• Use the FourWheeler derived class to further create the derived class Truck
to show multilevel inheritance with data member loading capacity in
kgs.
• If the access modifiers for Car's data members is set to private, which
functions/ data members will now become inaccessible?

3 Rewrite the following while loops using for loops and vice versa wherever applicable:

• while( next < limit / 2 ) {


cout << last << “ “;
long sum = next + last;
next = last;
last = sum;
}

• int x= 0;
int y = 10
while(x < y)
{
cout<< x << endl;
x++;
}

• #include <iomanip>
using namespace std;
int main()
{
int numb;
for(numb=1; numb<=10; numb++)
{
cout << setw(4) << numb;
int cube = numb*numb*numb;
cout << setw(6) << cube << endl;
}
return 0;
}

• #include <iostream>
using namespace std;
int main()
{
int j; //define a loop variable
for(j=0; j<15; j++)
cout << j * j << “ “;
cout << endl;
return 0;
}

• Rewrite this code as a call by value: -

#include <iostream>
using namespace std;
int x;
int& setx();
int main()
{
setx() = 92;
cout << “x=” << x << endl;
return 0;
}

int& setx()
{
return x;
}
4 Find error(s)(if any) in each of the following program segments:

• class du{
private:
...;
public:
void~du (void);
}

• #include <iostream>
#define PI=3.14
int main( )
{
float r, a;
cout<<"enter any radius";
cin>>r;
a=PI*pow(r,2);
cout<<"Area="<<a;
return 0;
}

• int base(int x,y)


{
int z;
cout<< z;
}

• #include
main( )
{
first = 10, second = 30;
Jumpto(First; Second);
Jumpto(Second);
}

void JumpTo(int N1, int N2 = 20)


{
N1=N1+N2;
cout <<N2;
}
• #include <iostream.h>
void main()
{
const int i =20;
const int * ptr=&i;
(*ptr)++;
int j=15;
ptr =&j;
}

5 Given class Distance below: -

class Distance //English Distance class


{
private:
int feet;
float inches;
public:
Distance() : feet(0), inches(0.0)
{ }
Distance(int ft, float in) : feet(ft), inches(in)
{ }
void getdist()
{
cout << “\nEnter feet: “; cin >> feet;
cout << “Enter inches: “; cin >> inches;
}
void showdist() const
{
cout << feet << “\’-” << inches << ‘\”’;
}

Distance operator + (Distance) const;


};

Define a main() function which creates three objects of class Distance and
implements the four member functions given below.
• Write a function to overload (--) operator (both prefix & postfix),
• Write a function to overload operator (+) (to add two distances),
• Write a function to overload operator (==) (to check equality of two distances),
• Write a function to overload (=) Assignment operator.
6 Write a C++ program that calls the functions given below on an array entered by the user
in the main function. The program should present a menu to the user and ask for one of the
options. The menu should also include options to re-enter array and to quit the program:
i) Print the even-valued elements
ii) Print the odd-valued elements
iii) Calculate and print the sum and average of the elements of array
iv) Print the maximum and minimum element of array
v) Print the array in reverse order.
Note for the typesetter:
1. Please DO NOT Change Courier font to any
other font.
2. Please do not change alignment of the text that
has been set in courier.
Unique Paper Code : 32347504
Name of the Paper : Microprocessor (DSE)
Name of Course : B.Sc. (H) Computer Science
Semester :V
Duration of Examination : Three Hours

Maximum Marks : 75 Marks

Attempt any four questions


All questions carry equal marks

1. How does the real mode memory addressing scheme work? Explain using an example.
What is the first and the last address that can be accessed in the Data segment when DS =
0008H?
Given DS = 3200H, BX = 0120H, SI = 0020H, ARRAY = 0015H. Determine the data
addressing mode used and the source address accessed by each of the following
instructions, considering real mode memory addressing scheme:
a) MOV AX, [BX+SI+140H]
b) MOV AX, [34H]
c) MOV AX, ARRAY[SI+3H]

Explain how the following descriptor stored in the global descriptor table can be used to
find the first and last address that can be accessed when DS = 0008H in protected mode
memory addressing scheme of 80286. Find the requested privilege level (RPL) and the
descriptor privilege level (DPL). Explain the access control provided for this segment,
given the value of the access right byte provided in the descriptor.

00
00
92
20
00
00
00
0008 FF

DS Global Descriptor Table


2. Write the machine language instruction format for the 16 bit instruction mode. Convert
the assembly language instruction MOV AX, BX into corresposnding machine language
form for 16 bit instruction mode. What will be the value of the MOD field in the machine
language instruction for MOV BL, [SI+4]?

Given below are some instructions. If the instruction is valid, explain the function
performed by it; if not valid, justify.
a) JMP [4]
b) POP CS
c) MOV AX, BL
d) MOV AX, ‘RX’
e) MOV [SI], [AX]
f) MOV AX, OFFSET DX

3. Differentiate between JMP SI, JMP [SI] and JMP FAR PTR [SI] instructions. How does
the CALL instruction differ from the JMP instruction? Explain the working of Near and
Far call instructions using an example. Also, show how RET instruction is used to return
from a procedure.
What are the steps followed whenever a software interrupt instruction INT executes?
How is it different from a Far CALL?

4. Give the functions of the following pins of 8088 microprocessor:


a) ̅̅̅̅
𝑅𝐷
b) DT/𝑅̅
c) DEN
d) IO/𝑀 ̅

Using a diagram, illustrate the minimum mode 8088 bus timing for a Read operation and
show the signals for the pin connections a) to d) given above. Name the pins of 8088
microprocessor which are available in minimum mode but not in maximum mode.

Describe the error correction and detection circuit built using 74LS636 with the help of a
diagram.

5. Explain Mode 2 operation of the 82C55 programmable peripheral interface. Which Port
is used for this mode and what bit combination in the Command Byte A register is used
to select this mode?
Explain two conditional software interrupt instructions available to the microprocessor.
Differentiate between the two hardware interrupt inputs NMI and INTR. Describe the
Operation Command Words (OCW) for Programmable Interrupt Controller 8259A.
Which OCW should be programmed to read the interrupt request register and what
should be the required bit values in the OCW for the same?
6. Describe the improvements brought in by the Pentium Pro microprocessor when
compared with the earlier microprocessors. Explain with the help of diagram how
dynamic execution architecture of Pentium Pro functions.

Discuss the three software commands used to control the operation of the 8237 DMA
controller. How is memory to memory DMA transfer accomplished?
UNIQUE PAPER CODE : 62361101

NAME OF THE PAPER : Introduction to Operational Research and Linear Programming

NAME OF COURSE : B.A. (Prog.)

SEMESTER : I

DURATION : 3 hours

MAXIMUM MARKS : 75

INSTRUCTIONS FOR CANDIDATES

All Questions carry equal marks.


Attempt any four Questions in all.
.
1. “Executive at all levels in business and industry come across the problems of making a decision at
every stage in their day to day activities. Operational Research provides them with various
quantitative techniques for decision making and enhances their ability to make long-range plans and
solve everyday problems of running a business and industry greater efficiency, competence and
confidence”. Comment with examples.
2. A firm is engaged in producing two products A and B. Each unit of product A requires 2 Kgs of raw
material and four labor hours of processing, whereas each unit of product B requires 3 Kgs of raw
material and three labor hours for the same type. Every week the firm has an availability of 60 Kgs
of raw material and 96 labor hours. One unit of product A sold yields Rs 40 and one unit of product
B sold gives Rs 35 as profit. Formulate and solve this as a Linear Programming Problem to determine
as to how many units of each of the products should be produced per week so that the firm can earn
maximum profit.
3. Solve the following linear programming using simplex method
Maximize Z = 3x1+9x2
Subject to x1+4x2≤ 8
x1+2x2 ≤ 4
x1, x2≥0
4. For the following LPP, solve for (x1, x2) using Two Phase Simplex Method
Minimize Z = 4x1+x2
Subject to 3x1+x2 = 3
4x1+3x2 ≥ 6
x1+2x2 ≤ 3
x1, x2 ≥ 0

5. What is duality in LPP? Give Economic Interpretation of duality. Find the dual of the following
linear programming problem
Maximize Z = x1 + x2 + x3
Subject to x1 – 3x2+4x3 = 5
x1 – 2x2 ≤ 3
2x2 – x3 ≥ 4
x1, x2 ≥ 0, x3 unrestricted

6. What is meant by ‘Sensitivity Analysis’ in Linear Programming Problem? Consider the LPP
Maximize Z = 5x1 + 12x2 + 4x3
Subject to x1 + 2x2 + x3 ≤ 5
2x1 -x2 + 3x3 = 2
x1, x2, x3≥0
Solve the LPP and Discuss the effect of changing the requirement vector [5, 2]T to [7,2]T on the optimum
solution. (Where T indicates transpose of a vector). Which resource should be decreased and by how
much to achieve the best marginal increase in the value of the objective function?
Unique paper Code : 62373904_OC
Name of the Paper : Data Analysis using Spreadsheet ( SE-1)
Name of the Course : B.A.(Programme)
Semester : III
Duration : 2 Hours
Maximum Marks : 50

Instructions for Candidates


1. Attempt any FOUR questions.
2. Each question carries 12.5 marks each
1. Differentiate between Histogram and bar diagram. Discuss an ogive and give its
advantages. Why standard deviation is most widely used as a measure of variation.
Describe the steps to calculate cumulative frequency distribution.

2. State advantages of stem and leaf presentation with example in a spreadsheet.


3. How can you use scatter diagram to obtain an idea of the extent and nature of the
correlation coefficient.
4. Define Regression. Explain the regression of Y on X and X on Y. At what point do the
two regression lines intersect?
5. A group of 25 individuals have been surveyed on the number of hours
devoted each day to sleeping and watching TV. The responses are given
in the following table:
No. of sleeping hours (x) 6 7 8 9 10
No. of hours of watching TV (y) 4 3 3 2 1
Absolute frequencies (f i ) 3 4 10 7 1

Calculate the correlation coefficient. Determine the equation of the


regression line of y on x. If a person sleeps eight hours, then
determine the expected number of hours of watching TV.

6. Explain the step of creating boxplot and pie chart in spreadsheet. What is standard error
of regression? How do you determine the goodness of regression? Explain the process
of running a regression in a excel spreadsheet.
Unique Paper Code: 42344304
Name of the Course: B.Sc. Physical Science/Mathematical Science
Name of Paper: Operating Systems
Semester: III
Duration: 3 Hours
Maximum Marks: 75
Year of Admission: 2019
Attempt any four out of six questions. All questions carry equal marks.

Q1. What are the various difficulties that a user can face while interacting with a computer
system, which is without an operating system? Differentiate between the two types of
user interfaces provided by the operating system. What are the advantages of dual mode
operations of operating system? Explain the problems that may arise due to the lack of a
hardware-support of dual mode in an operating system.

Q2. Consider a set of 5 processes, with the length of the CPU-burst time given in
milliseconds. The processes are assumed to have arrived in the order P1, P2, P3, P4,
P5, all at time 0.

Process Burst Time Priority


P1 5 2
P2 13 3
P3 8 1
P4 4 5
P5 10 1

 Explain the life cycle experienced by process P3 in terms of process states.


 Briefly explain the various schedulers the process P3 would encounter at each
stage.
 Draw four Gantt charts illustrating the execution of the above processes using
FCFS, SJF, a non-preemptive priority (a smaller priority number implies a higher
priority), and RR (quantum = 1) scheduling.
 What is the turnaround time waiting time and average waiting time of each
process for each of the scheduling algorithms in part a?
Q3. What are system calls? Why would an application programmer prefer programming
according to a library API rather than invoking actual system calls? Explain briefly how
operating system handles a system call. What are the general methods used to pass parameters
to the operating system?

Q4. Explain briefly paging memory management scheme. Consider user program (executing
under paging memory) of logical address of size 6 pages and page size is 4 bytes. The
physical address contains 300 frames. The user program consists of 22 instructions a, b,
c, . . . u, v. Each instruction takes 1 byte. Assume at that time the free frames are 7, 26,
52, 20, 55, 6, 18, 21, 70, and 90. Find the following?

 Draw the logical and physical maps and page tables?


 Allocate each page in the corresponding frame?
 Find the physical addresses for the instructions m, d, v, r?
 Calculate the fragmentation if exist?

Q5. What is a shell? Write a Shell Script to find the largest among the 3 given numbers using
‘nested if’ commands. Write the commands that does the following actions:
 to know the shell that is running on your system.
 to get a one-line manual page descriptions.
 to print second, fifth and seventh character from each line of the file F1
 to print only duplicate lines in a file F1.
 to convert from lower case to upper case

Q6. Explain the following:


 Virtual address space
 Address binding
 Translation look aside buffers
 Dynamic Loading

Consider six memory partitions of size 200 KB, 400 KB, 600 KB, 500 KB, 300 KB and 250
KB. These partitions need to be allocated to four processes of sizes 357 KB, 210 KB, 468 KB
and 491 KB in that order. Perform the allocation of processes using First Fit, Best Fit and
Worst Fit Algorithm.
Unique Paper Code : 42347902
Name of Course : B.Sc Prog. Computer Science/ B.Sc Mathematical Science
Name of the Paper : Analysis of Algorithms and Data structures
Semester :V
Year of Admission : Upto 2018

Duration: 3 Hours Maximum Marks: 75

Instructions for Candidates:


1. Answer any FOUR questions.
2. All questions carry equal marks.

1. Which data structure would you chose for the following tasks and Why? Justify your answer
in each of the following case: Case 1: to implement undo/redo operation in a text editor;
Case 2: bookmarks tab of a web-browser; Case 3: you need to get out of a maze (without
using recursion), for which you are required to store the path that you are currently
exploring and be able to go back one step in case of a dead-end and then explore a new
possibility from there; Case 4: to store two sorted lists of strings and support their merging
into one, in-place (i.e., without creating a copy of the lists); Case 5: write a software for a
call center, in which whenever a client calls, his call record should be stored if there is no
free operator to pick it up; Case 6: to store the stations of a public transportation line in
which new stations can be added at both ends of the line but not between existing stations.
Transportation line can be traversed in both the directions; Case 7: create table of contents,
i.e., index page of a book. It must show every chapter, its sections and corresponding sub-
sections, to all levels.

2. Given a binary search tree and the following pseudocode to traverse the tree. Determine in
what order is the function traversing the tree? Modify it to count the number of nodes in the
tree.
fun traverse(Node t)
if t==NULL
return
else
traverse(right child of t)
print(value of t)
traverse(left child of t)

Also, determine which of the following statements is/are false about tree traversals?
Justify your answer.
a. If values 1,2,3,4,5,6 are inserted in the given order in a Binary search tree, then in-
order, pre-order and level-by-level traversal are all same.
b. If values 6,5,4,3,2,1 are inserted in the given order in a Binary search tree, then in-
order and pre-order traversal are same.
c. If values 6,5,4,3,2,1 are inserted in the given order in a Binary search tree, then pre-
order and level-by-level traversal are same.
d. If values 6,5,4,3,2,1 are inserted in the given order in a Binary search tree, then in-
order and post-order traversal are same.

3. We want to sort an array of 1000 integers, in which every element in its correct place except
10 elements. Arrange the following sorting techniques in decreasing order of preference for
sorting: Insertion, Quick, Merge, Count. Justify your preference with suitable arguments.
Suppose the condition now reverses, i.e., only 10 elements are in their correct place. Specify
the order of preference again with justifications.

4. Consider the following modification in (binary) search algorithm on an array A[1...n], sorted
in increasing order. The array is divided into three equal parts. Instead of finding one middle
index, we find two middle indices, mid1 and mid2. If element at mid1 or mid2 equals the
element ‘x’ that we are trying to search, we stop. Else, we do either of the following: search
x from A[1...mid1 -1] if x is less than element at mid1 or search x from A[mid1 +1...mid2 -1] if
x is greater than element at mid1 but less than element at mid2 or search x from A[mid2 +1 ...
n] if element at mid2 is less than x. Write an iterative algorithm for the above mentioned
search strategy. What should be the running time of the algorithm? Also, write the recursive
version of the algorithm.

5. What value should be chosen as pivot in the following array so that when we apply quick
sort to it, the first call to partition should belong to worst-case scenario?
-5,-3,1,4,2,-6,1,5
Justify your answer. Also, show steps in partitioning the array around the chosen pivot.
Can you use Count sort to sort the above array? If yes, modify the algorithm to do so. If no,
justify your answer by giving suitable arguments.

6. Write algorithms to implement the following operations on a circular doubly linked list:
i. Search for an element x in the linked list.
ii. Using the function implemented in part (i) above, insert an element x after an element y
in the linked list.
iii. Using the function implemented in part (i) above, replace an element x with an element
y in the linked list.
iv. Remove ith element from the linked list.

Using the algorithms above, perform the following functions. Also, specify which
algorithms (out of above mentioned) along with their parameters, would you use for
performing the tasks mentioned below.
Insert every character of the word “ALGORITHMS AND DATA STRUCTURES” as a node
in an initially empty list. Now, scan the list and replace ‘ ’ (space) character with a ‘#’.
Change the case of value of every alternate node, i.e., AlGoRiThMs and so on. Delete ith
node of the list where i = (length of list)%10 from back. Print the final list.
Unique Paper Code : 62353325_OC
Name of the Paper : SEC : Latex and HTML
Name of the Course : B. A. (Prog.) (CBCS)
Semester : III
Time : 2 Hrs
Maximum Marks : 38

Attempt any four questions. All questions carry equal marks.

1. Write codes in Latex to draw a circle with shaded sector. Also label its radius.
Write codes in Latex to create a beamer presentation on the Pythagorean Theorem (with at least
three slides). Be sure to include diagrams of right triangles.
Write codes in HTML to create a web page showcasing some of your mathematical interests (at
least three interests). Make one of your interests in the list a hyperlink.

2. Write codes in Latex to typeset the following


𝑎 𝑎𝑏 𝑎𝑏 − 2𝑐𝑑

𝑏 𝑐𝑑
= 𝑎 𝑐 .
4 3 6 + 4𝑎𝑐

𝑎𝑏 𝑐 𝑑 𝑏 𝑑
Write codes in Latex to typeset the following
sin 𝜃 cos 𝜃
.
cos 𝜃 sec 𝜃
Write codes in HTML to create a web page with a numbered list displaying titles of three papers
(having different colors) of your curriculum.

3. Write codes in Latex to typeset the following


∫ 𝑒 𝑑𝑥 = √𝜋 and sin 𝛼 ± sin 𝛽 = 2 sin (𝛼 ± 𝛽) cos (𝛼 ∓ 𝛽).

Write codes in Latex to draw a square and an equilateral triangle using PSTricks and mark
their vertices.
Write codes in Latex to create a beamer presentation on the circumference of a circle (with at
least three slides), with first slide being the title slide. Use Latex’s picture environment to draw
the image of a circle on the second slide while labelling its circumference.

4. Write codes in Latex to plot the functions sin 𝑥 and sin 3𝑥 over −2𝜋 ≤ 𝑥 ≤ 2𝜋. Show the
function sin 𝑥 as a solid curve and sin 3𝑥 as a dotted curves.
Write codes in HTML to create a web page containing a numbered list of five universities. One of
the universities in the list should have big font size.
Write codes in Latex to create a beamer presentation of at least three slides on Prime numbers.

1
5. Write codes in Latex for the following
( )
(1 + 𝑥) = 1 + + + ⋯.
! !

Write codes in Latex to draw the following


r

Write codes in Latex to create a beamer presentation of (at least three slides) on a mathematical
topic of your choice excluding the Pythagorean Theorem and Prime numbers. Also include
diagrams.

6. Write codes in Latex for the following


1 1 1 1 1
𝑥 = 1 + + + + ⋯+ +⋯+
2 3 4 2 2
1 1 1 1 1
> 1 + + + + ⋯+ + ⋯+
2 4 4 2 2
1 1 1
= 1 + + + ⋯+
2 2 2
𝑛
= 1+ .
2
Write codes in Latex for the following
𝑓(𝑥) = 𝑎 + 𝑎 cos + 𝑏 sin .

Choose a theorem or a problem and write codes in HTML to create a web page showing its proof
or solution.

2
Sr. No. of Question Paper : Your Roll No....................

Unique Paper Code : 62363324 (OC)

Name of the Paper : Operation Research Application (OR: SEC)

Name of the Course : B.A.(Programme) (admissions before 2019)

Semester : III

Duration : 3 Hours Maximum Marks: 75

Instruction for Candidates

1. Attempt any four questions

2. All questions carry equal marks

3. Show you working clearly in your answer


1. The Megacity Power Company wishes to schedule its work force for the coming month.
Employees work in an 8-hour shift beginning at 8 a.m., 12 p.m., 4 p.m., 8 p.m. and 12 a.m.
All but the late shift (12 a.m. to 8 a.m.) overlap the next shift by 4 hours. Based on past
experience, the following number of workers will be needed during the time shown:

Hours Workers required


12 a.m. – 8 a.m. 6
8 a.m. – 12 p.m. 10
12 p.m. – 4 p.m. 16
4 p.m. – 8 p.m. 18
8 p.m. – 12 a.m. 8

How many workers should be scheduled to report for each of the five shifts if the
company wishes to minimize its total work force? Formulate and solve this problem as a
linear programming problem.

2. Define media and its different types. What is the difference between traditional and online
media? What role do media play in our daily life?
3. Ram is planning to produce at least 2000 widgets on three machines. The minimum lot size
on any machine is 500 widgets. The following table gives the pertinent data of the situation:

Machine Cost Production cost/unit Capacity(units)


1 250 5 500
2 145 10 600
3 175 8 1000

Formulate the problem as an integer programming problem, and find the optimum solution.

4. A truck can carry 20 tons of loads. Four types of products are to be loaded. Their per unit
weights in tons and values in thousand of rupees are given below:

Type Weights Value/unit


A 1 20
B 2 30
C 3 50
D 4 85

At least one unit of each type of load is to be shifted. Determine the loading which will
maximize the value of the load.
5. A transport company has trucks available at four different localities A, B, C and D; the
number of trucks at these localities is 5,10,7 and 3 respectively. The three stores at
destinations P, Q and R require 5, 8 and 10 trucks respectively. Variable costs (hundred of
rupees) of getting trucks to the destinations are given below. Find the optimum
transportation cost.

From/To P Q R
A 7 3 6
B 4 6 8
C 5 8 4
D 8 4 3

6. Write short notes on the following:


(i) Simulation,
(ii) Production scheduling Problem,
(iii) Media Allocation Problem.
Unique Paper Code : 62347502
Name of Course : B.A. Programme CBCS (2015 Onwards)
Name of the Paper : Programming with Python (DSE)
Semester :V
Duration: 3 Hours

Maximum Marks: 75

NOTE FOR TYPESETTER: Please do not change the font and spacing of text written in
courier.

Instructions for Candidates

Attempt any Four Questions. All Questions carry equal marks.

1. Differentiate between (i) class and object (ii) constructor and destructor.

Is a data member accessible outside the class? If yes, how to access the data
member? If not, why?

Define a class Box that has the three data members Width, Height and
Depth and following methods:

Methods:
• Constructor to initialize the data members Width, Height and
Depth
• Volume – This computes volume of the box
• __str__ function to generate a string that may be used to display
the data members of the box.

Also, write Python statements to:


• Create an object of the class Box with suitable values.
• Invoke the method Volume
• Print all the data members of the class

2. Apply the Bubble Sort scheme of sorting on the following list to sort it in
ascending order. Show the content of the list after applying each iteration of
Bubble sort: =[74, 31, 82, 25, 63, 96, 49, 11].
How many iterations are required to sort the list? What is the number of
comparisons performed in each iteration?
Apply Binary search to search for the item 50 in the sorted list. You should show
the computation of the index at which the value is compared with 50. When will
you prefer to use binary search over linear search? Justify your answer.
3. • The following operations are performed on a stack in the sequence given
here (assume stack is initially empty): push('Red'),
push('Green'), pop(), push('White'), pop(),
pop(). Show the content of the stack after each operation. What will
happen if one more pop operation is performed on the stack? Can this
condition be prevented?

• A print application processes the print jobs in the first come, first served
manner. Suggest a suitable data structure for the print application. What
are the permissible operations on the suggested data structure?

4. • Write a Python function moveOdd(L1,L2)that accepts two lists L1 and


L2. List L1 consists of integers and list L2 is initially empty. The function
moveOdd removes the odd integers from the list L1 and moves them to
the list L2. Write python statements to apply the function moveOdd on
the list L1: [31, 28, 63, 86, 15, 79, 44, 52]. What will be
the content of list L1 and L2 after the execution of moveOdd function for
the list L1?

• Use modified list L1 and write the python command to:


o display last three elements,
o middle two elements
o delete element at index 1
o reverse the order of the elements in the list
o insert the list [21, 56] at the end of the list

5. • Write a Python function smallerXY(X,Y)that accepts two integers X


and Y and returns the smaller of two. Write another function
smallerXYZ(X,Y,Z)that uses the function smallerXY to find
minimum of three numbers X,Y,Z.

• Give the output that will be produced on execution of following code


segment :
a = 12 # 12 in binary: 0000 1100
b = 7 # 7 in binary: 0000 0111
b = a & b
print(b)
a = a | b
print(a)
b = a ^ b
print(b)
a = ~b
print(a)
print(b<<3)
• Give the output that will be produced on execution of following code
segment :

def add(a=3, b=5, c=7):


return(a+b+c)

print(add())
print(add(7))
print(add(6,8))
print(add(2,4,5))
print(add(c=9))

6. • Write a Python program that contains function main and function


occurs(s,ch). Function occurs(s,ch)accepts a string s and a
character ch as arguments and returns the number of occurrences of
character ch in the string s. The main function reads a string and a
character from the keyboard, calls function occurs and prints the
number of occurrences of the character. Do not use a built-in function to
find occurrence of the character.

• Give the output that will be produced on execution of following code


segment:
s1 = 'I am an instance of a string!!'
print(s1[-13:-21])
print(s1.title())
print(s1.find('of'))
print(s1.isalpha())
print(s1.count('a'))

• Consider:
set1 = set(['P','Q','M','O' ])
set2 = set(['R','P','N','S','O' ])

Give the output that will be produced on execution of the following code
segment:

print(set2 | set1)
print(set2 - set1)
print(set2 & set1)
print('X' in set2)
Unique paper Code : 42347901
Name of the Course : B.Sc. (Programme): DSE 1A
Name of the Paper : Programming in JAVA
Semester : V
Year of Admission : 2015, 2016, 2017 & 2018
Maximum Marks : 75
Duration : Three hours

Instructions for candidates:


Attempt any four questions. All questions carry equal marks.

1
Q1. Is JVM a compiler or interpreter? Give justification. How does polymorphism promote
extensibility? Explain with an example.

What will be the output of the following Java program?

1. class Test {
2. public static void main(String[] args)
3. {
4. int i = 0, j = 9;
5. do {
6. i++;
7. if (j-- < i++) {
8. break;
9. }
10. } while (i < 5);
11. System.out.println(i + "" + j);
12. }
13. }
What are the two control structures used in Java for making decisions? Explain with
suitable example.

How many elements will be allocated in the array twoD after the execution of following
statements?
int twoD[][] = new int [2][];
twoD[0] = new int [2];
twoD[1] = new int [4];

Q2. Write a Java program to create a user defined exception MyException and use this to
signal an error condition if the number is negative. Write a method MySqrt(int num)
to compute the square root of a number which raises an exception of type
MyException if the input (i.e. num) is a negative number. Explain the terms try,
catch, throw and finally with respect to exception handling in your program.
Write a program in Java to replace a substring in a string by another one. Make use of
indexOf()and substring() methods.

What do you mean by applets? Explain its types. How do applets differ from application
Q3. program? Write a program in Java using AWT to display a string message “Stay Safe Stay
Healthy” in an applet window with pink as background colour and blue as text colour.
Write a program in Java to read a file named A.txt and copy the contents in another file
named B.txt after removing the vowels.
Name the two types of I/O streams available in Java. What is the difference between the
two types of streams?

2
Q4. Write a program in Java to create a class CountAndPrintArgs to print the number of
arguments passed on the command line as well as the first character of each argument
passed. For example, if the command line arguments are “Mango Cucumber Apple” then
the output will be:

No. of Arguments – 3 MCA

What are the properties of a constructor? Why are the overloaded constructors needed?
Explain the use of overloaded constructors with the help of an example.

Referring to the following Java code snippet, what data type could be returned by the
method check()and why?

if (check(storeNum)!= Null) {}

Q5. What is the significance of the CLASSPATH environment variable in creating/using a


package? Write a program in Java to create an interface Shape that contains a method
Perimeter to calculate the perimeter of an object. Define two classes-Circle and
Rectangle with suitable fields and methods. Implement the interface Shape in these
classes. Write the appropriate main() method to create object of each of the above
mentioned classes and test all the methods.
How an interface is different from a class? Show how we can create an instance of an
interface. What type of variables can be declared inside an interface definition? Give
examples.

Q6. Write a program in Java to create a class BankAccount that represents a bank account
including appropriate data members. Construct the methods to:
Assign initial values to data members
Deposit an amount
Withdraw amount after checking balance
Display the name, balance and interest earned.
Do you need to use static keyword for the above bank account program? Explain.
What is the purpose of final keyword in context of variable, method and class?
Explain with the help of suitable examples.

3
Unique paper Code : 42347901
Name of the Course : B.Sc. (Programme): DSE 1A
Name of the Paper : Programming in JAVA
Semester : V
Year of Admission : 2015, 2016, 2017 & 2018
Maximum Marks : 75
Duration : Three hours

Instructions for candidates:


Attempt any four questions. All questions carry equal marks.
Q1. How is encapsulation implemented in Java? What will be the output when following
files are run? If there are any compilation errors, correct them and find the output,
when each one of them is run?

CL1.java
package P1;
public class CL1 {
private int x;

CL1(int inp){ x=inp; }

public static void main(String args[]){


CL1 qq=new CL1(123);
System.out.println(" X = " +qq.x);
System.out.println("Converted X = "+qq.convert());
}

int convert(){
return (x/10) + (x%10);
}
}

CL2.java
package P1;
public class CL2 {
CL1 qq;

public static void main(String args[]){


qq=new CL1(12);
System.out.println(" X = " +qq.x);
System.out.println("Converted X = "+ qq.convert());
}
}

CL3.java
package P2;
import P1.*;
public class CL3 {
public static void main(String args[]){
CL1 qq;
qq=new CL1(45);
System.out.println(" X = " +qq.x);
System.out.println("Converted X = "+qq.convert());
}
}

Q2. Write a Java program that counts the words and the occurrences of each of the vowels
(a, e, i, o, u) in the strings entered as command line arguments. The program will
output the input strings in upper case, number of words and occurrences of each of
the vowels in the input string. When are the StringBuffer objects preferred over
String objects? What is meant by immutable objects?
Q3. Create a class Fraction to represent the fraction numbers. It should have data
elements for numerator and denominator of a fraction number. Include two
constructors – one default and the other parameterized. Include a method that
determines whether it is a proper fraction or an improper fraction. A fraction is proper
if its value is strictly less than one, otherwise it is improper. For example, 4/3 is
improper, whereas 2/3 is proper. Whenever an object of type Fraction is passed as
parameter to System.out.println(), display a proper fraction as b/c and for an improper
fraction number, display its mixed fraction in the form of a+b/c if b % c is not zero;
otherwise, display only the integer. For example, 4/3 should printed as 1+1/3.
Write a program that prompts the user to enter the positive integer numerator and
denominator of a fraction number and determines whether it is a proper fraction and
improper fraction and prints the fraction number.

Q4. How do static binding and dynamic binding of methods help to achieve
polymorphism? Explain with appropriate examples. Mohan has code of two
abstract classes each with two abstract methods. He needs to create a new class with
the properties of both these classes. Can this new class inherit from both the
classes? Justify your answer. Why a class that extends an abstract class need to
override all the abstract methods of the super class? Explain how we can create a
class which inherits properties and methods from multiple sources?

Q5. Create a class PlayWithNums, with a static method LargerNums that accepts
two integer arrays and returns an array such that the ith element of the resulting
array contains the number that is greater between the elements at the same ith
index in input arrays. If the sizes of the input arrays are not same, the method
should throw SizeMismatchException. (Assume there is a user-defined
SizeMismatchException class available with the relevant data members and
methods in it). Show the use of LargerNums method in main() method of
PlayWithNums class. For example, LargerNums([2,7,3,12],
[3,1,2,16]) will result in [3,7,3,16].
What happens to your program if you do not declare LargerNums as static? What
is the significance of declaring a static data member in a class?

Q6. You are provided with a package pkgInt having a class clsInt. It has a method
Average() that takes variable number of integers as parameters and returns the
average of these integers.
package pkgInt;
public class clsInt{
float Average(int … Ints)
{ //Returns the average of the input integers

}
}
Write the code of the method Average(int … Ints). Use this function to
report average of integers read from a file.
Write a program in Java, to create an applet that prints the unique paper code and
the subject of this examination in the centre.
Set-A

Unique Paper Code : 62413326_OC

Name of the Paper : Computer Applications in Business

Name of the Course : B.A.Prog.

Semester : III

Duration : 3 hours

Maximum Marks : 75 Marks

Instructions for candidates

Attempt any four questions. All questions carry equal marks.

1. Rajni is a student. Due to lockdown she has to make arrangement for attending her
online classes and solve the practice questions at home. When she made online search
she came to know about micro-computers, mainframes and supercomputers. You are
required to compare these type of computers based on their features and utility and
finally suggest Rajni which type of computer she should buy.

2. What do you understand by the computer software? Differentiate between system


software and application software and also give two examples of each types of the
software.

3. What do you mean by a computer network? How does wired networking differ from
wireless networking? What are the challenges associated with wireless networking?

4. In what ways word processing is helpful to university students? Describe different


features of word processing you would like to apply while preparing your project
report?

5. What is an electronic spreadsheet? What are the important features of spreadsheet


software? Explain any two types of charts that you use for data representation.

6. Do you agree that database management system is better than traditional file system
as data management model? Give at least six points of differences between both the
data management models.
Unique Paper Code : 62347501

Name of the Course : B.A. Programme (Computer Applications)

Name of the Paper : Visual Programming

Semester : V

Duration : 3 Hours

Maximum Marks : 75

Year of Admission : 2015 - 2018

Instructions for Candidates

All questions carry equal marks. Attempt any FOUR questions.

Q. 1) For each of the control names given below, identify the type of controls and
specify one property: lblAddress, cmdExit, txtName and optTextBlue. Write VB
statement to change a Label lb1 Caption to italic at run time. For Image Control
img1 in VB, write steps to make a graphic appear in it. Write VB statements to
hide the image and to ensure that it fills the Image Control completely. Find the
value of the variable sum in the following VB code:
sum = 0
count = 1
For count = 1 to 10
sum = sum + count
If sum >= 10 Then
Exit For
EndIf
Next
Q. 2) Write VB code to search an element in a Two-Dimensional array. The VB code
should display the index if the element is found, otherwise it should display -1.
Explain with the help of an example how to convert a For/Next structure to
Do/Loop structure. Write VB code to change the text color of the form depending
on the selection from the three colors given in the form.

Q. 3) Write a VB code to calculate and display the area and circumference of a circle
using the relation Area = πr2 and Circumference = 2πr where π = 3.14 and r is user
input. What will be the value of K on execution of the following VB statements:
K = y ^ (x * z) + 2 and K = y ^ (x * z + 2) / y (Assume that x = 3, y = 2 and z = 2).
What will be the output of the following VB code, assuming that a = 10, b = 20
and c = 30?
If a >= 10 And b > 20 Then
Print “Hello”
ElseIf a >= 10 And c > 30 Then
Print “Hi”
Else
Print “Bye”
End If
Rewrite the If statement using Select Case statement. Write steps to create a
breakpoint at Else. How does it affect the execution of the VB program?

Q. 4) Write steps to design a VB form that takes inputs: principal amount (P), rate of
interest (R) and number of years (N). The form contains the Command Button
cmd1 that calculates and displays compound interest as per the given formula
I = P * (1 + R/100)N
The form also contains Command Button cmd2 that clears the input fields. Write
VB code to implement Command Button cmd1 and cmd2. Write VB statement to:
Append “OBE” to the content of a Text Box txt1; Centrally align the content of a
Label lb1.
Q. 5) Write the output of the following VB statements:
FormatDateTime(“1/1/2001”, vbGeneralDate)
FormatNumber(2356.789, 2)
FormatPercent(.123, 2)
Printer.Print 45, 71, 34, 12, 58, 4
Printer.Print 45; 71; 34; 12; 58; 4
Write VB procedure to print a table showing the temperature in centigrade from
0° to 100° and the corresponding values in Fahrenheit using the relation
C / 5 = F - 32 / 9
Write steps required to convert a project prj1 into an .exe file.

Q. 6) Write VB code to calculate and display the Gross Salary and Net Salary of an
employee based on the given criteria:
Gross Salary = Basic Salary + Allowances
Net Salary = Gross Salary – Deductions
Draw the user interface (form) for the above scenario and label the controls.
Declare an array of size 30 for a user defined datatype Bank in VB for the
following customer data: Cust_ID, ACC_Number, Cust_Name, Age, Amount,
Address and Phone_No. Write VB code to display the list of customers having age
greater than 60.

You might also like