4th Sem Midsems Paper
4th Sem Midsems Paper
Write the statement 'a sufficient condition for the warranty to be good is that you 2.5
2. (a)
bought the computer less than a year ago' in the form "if p, then q" in English. Then
state the converse and contrapositive of it.
2.5
(b) Show that (p ’ r) A(q ’ r) and (p Vq) ’ rare logically equivalent.
Determine whether the relation Ron the set of all realnumbers is reflexive, symmetric, 2.5
3. (a)
antisymmetric, and/or transitive, where (x,y) E R if and only if xy > 0.
Draw the Hasse diagram of the poset((2,4,5, 10, 12, 20, 25}, ). Is it a lattice? Justify your 2.5
(b)
answer.
Find transitive closure of the relation R= {(1,2), (2,1), (2,3)} on the set {1,2,3,4}. 2.5
4. (a)
Determinewhether the following argument is correct or incorrect and explain why. 2.5
(b) never lived in a
"Everyone enrolled in the university has lived in a dormitory. Mia has
dormitory. Therefore, Mia is not enrolled in the university."
differentiablefunctions on set of real numbers 2.5
5. (a) Showthat the relation Ron the set of all
numbers x is an
consisting of all pairs (f,g) suchthat f'(*) =g')for all real
class as the function
eguivalence relation. Which functions are in the same equivalence
f (x) = x2? 6. 2.5
(b) Prove that 3n < n!, if n is an integer greater than
Sinescr
Subject Name:- Operating Systems &Code:-CS20002
Branch (s): - CSE. I[. CSCE.CSSE
b) The following program consists of three concurrent processes and three binary
semaphores. The semaphores are initialized as S0=1, S1-0, and S2-0.
Process PO Process P1 Process P2
while (True){ wait (S1); wait (S2);
wait (S0); release(S0); release(S0);
print(0)
release(S1);
release(S2); }
How many times will the process PO print '0"? Justify your answer.
a) At least twice b) Exactly thrice c) Exactly twice d) Exactly Once
e) A system is having 3 user processes P1, P2 and P3, where Pl requires 21 units of
resource R, P2 requires 31l units of resource R, and P3 requires 41 units of resource R.
The minimum number of units of R that ensures no deadlock is
Semester: IVh
Subject Name:- Operating Systems & Code:-CS20002
Branch (s): -CSE. II. CSCE. CSSE
(1): Diffèrentiate between independent processes and cooperating processes. Explain race condition
in process synchronization.
3. Answer the following questions: [3+2=5 Marks|
): Explain Producer-Consumer problem and its solution using semaphores in details.
(ii): Briefly explain the four necessary conditions for the deadlock to occur.
4. Consider the following table consisting of Process ID, Arival Time (AT), Burst Time (BT), and
Input Output Burst (IOBT). The table describes that Process 1arrives at Ounit of time and requires 4
units of burst time, then goes for 5 units of VO wait. After that, it returns to the Ready Queue to
complete the remaining burst time, i.e., 3 units. Similarly, for Process 2 and Process 3. Compute the
Average Tumaround Time and Average Waiting Time using the Round Robin Scheduling Algorithm
with a time quantum of 2 units. [5 Marks ]
PID AT BT1 IOBT BT2
1 0 4 5
2 2 10 1
3 4 3 4
5. Explain various components of a Resource Allocation Graph (RAG). Consider the following RAG
with 4 processes (p1, p2, p3, and p4) and 2 resources (r1 and r2).
p1
r2
p3 p4
Based on the given RAG, check whether the system is in safe state or not? If yes, give the safe
sequence. [5 Marks ]
3. Explain the Database System Architecture and its significance of cach level, support your
explanation with a diagram. [5 Marks ]
Subject Name: ((OP& Cade(S200C
5. Consider two entity sets A and Bthat both have the attribute X (among others whose names are
not relevant to thisquestion).
a. If the two X's are completely unrelated. How should the design be improved?
b. If the two X's represent the same property and it is one that applies both to Aand to B.
How should the design be improved? Consider three sub-cases.
i. X is the primary key for A but not B
ii. X is the primary key for both A and B
iii. X is not the primary key for A nor for B
[2+3 Marks]
int fun() {
return 20;
2 [3+2-5 Marks ]
a) Write a Java program to create a class known as BankÁccount with the member variables account
number. account holder name, balance and member methods deposit(), withdraw(). Create a subclass
called Saving Account and RecuringAccount that overrides the withdraw() method to prevent
withdrawals if the account balance falls below one thousand for saving account and two thousand for
recuring account. Define the Driver class (a class that contains main method) to test and also to
display the current balance.
b) Write a class to create a copy of a previously existing object present for the same class.
[3+2-5 Marks ]
a) Define two user defined exception class named InvalidNameException and InvalidDOBException.
Create a class KIITEE2025 which holds data members name, dd, mm, yyyy and a method
getApplicantDetails() to accept name and date of birth of KIITEE2025 applicants, and display the
details. The getApplicantDetails() method should able to handle above user defined exceptions.
InvalidNameException is thrown, if length of name is less than 2 and InvalidDOBException is thrown,
if yyyy is greater than 2010 or less than 1970. Write a complete java program to implement the above
scenario.
b) Write aprogram in Java to create an interface Flyable with an abstract method fly) and Swimmable
is another interface with an abstract method swim(). Bird class implements both Flyable and
Swimmable interfaces, providing concrete implementations for fly) and swim) methods. n the Main
class, an object of Bird is created, and both fly) and swim) methods are called to demonstrate the
implementation of multiple interfaces.
4. [3+2-5 Marks ]
a) Write aprogram that prompts the user to input two numbers, frst and diff. The program then creates a
one dimensional array of 10elements and initializes them with an arithmetic sequence. The first number
of the sequence is the first value and the next number is generated by adding the diff to the number
preceding it. This formula is repeated for the rest of the sequence. E.g. if first =11 and diff= 4, then the
arithmetic sequence willbe 11, 15, 19, 23, 27, 31 ... and so on.
members
b) Create a package Department having a class Student. The students class is having the data
name, semester, branch, roll-no, and cgpa. The class is also having a constructor and a show) method
which is used to display the various attributes of student object. Finally design an application class
Demo where the above package is imported and functionality of Student class is tested.
5
[3+2=5 Marks ]
a class Bank having
a) Is dynamic method dispatch necessary in java? Write a program in java to Create
HDFC, ICICI, BOI with
ROI data member and find ROI) member function. Derive three classes
method dispatch
find ROI0 function and find the rate of interest of different Banks using dynamic
concept.
facilitates abstraction?
b) What is abstraction? How encapsulation, polymorphism and inheritance
Explain with proper examples.
Q.5 W.W. Rostow has given linear stages of Economic Growth that every 5
country has to pass through. In view of this, briefly explain these stages of
economic growth with their important characteristics.
k *** * **
Code:-CS21002
Subject Name:- (OA&
Branch (s): -CSE
1.
Answer all the questions. [1 Mark X5]
a) What is the final value of R5, R6, the carry flag and
the sign flag after executing the
instruction?
Compare RS, R6 // R6 is the destination
(Initially value of R5=100, R6-200]
b) What will be the value of PC, after the
branch instruction is executed?
(initial value of R1 = 90, R2 = -120)
3050 ADD R1,R2
3054 Branch<=01000
3058 Next Instruction
2. a) Represent a number (-111) in little endian and big endian format, where starting at
address 1000.
The machine is byte-addressable and each word consists of 2 bytes. 2 Marks]
b)Consider the stack pointer SP contains 6000 and keeping a value 500 in top of the stack. What are the
content of PC, SP, and the top of the stack, in the following conditions? Assume Memory Word Size is
of 4-bytes long and stack grows in decreasing order of addresses. [3 Marks]
i) After the subroutine call instruction is executed in the main program
Semester: 4"
Subject Name:- COA & Code:-CS21002
Branch (s): - CSE
3. a) Assume that each memory word consumes 4 bytes and the machine is byte addressable. The
memory stores numbers from 1to 20 sequentially starting from memory location 2000. The registers RI
and R2 contain values 10 and 20 respectively.
() Move #2000, RO
(i) Add R1,4(R0)
(ii) Add #4, RO
(iv) Add 4(R0), R2
(v) Move R2, 8(RO)
Find out the contents of the first five word locations starting at 2000 after executing the above
instructions. [2 Marks]
b) Explain the multi-bus CPU architecture, detailing all its components with a clear diagram. Also, write
the sequence of control steps required to execute the following instruction using a 3-bus CPU
architecture. [3 Marks]
MUL 40RI), R2, R3
4. a) Explain the following instructions with examples: [2 Marks]
i) Call ii) CMP ii) TST iv) Negate
a) Write an assembly language program to derive the expression X = C(O+M)+P*UT+(E*R) [3
Marks]
i) in a stack based computer with zero address instructions.
ii)in an accumulator based CPUwith one address instructions.
ii)in a RISC based computer with 2 address instruction
S.(a) Explain the working principle of Hardwired control unit design along with aneat diagram. What
are its advantages over the Microprogrammed control approach? [2 Marks]
(b) Write the sequence of control steps for the given instructions and design the logic function and
circuit for END controlsignal with reference to given instructions using Single-Bus CPU Organization.
|Assume the length of each instruction is 1word, Iword= 4bytes, machine is byte addressable. Assume
2Md operand is the destination]. [3 Marks]
BRANCH>0
ii) CALL SUB