Computer Science Engineering (CSE)

Consider the following two phase locking protocol. Suppose a transaction T accesses (for read or write operations), a certain set of objects {O1,...,Ok}. This is done in the following manner:
Step 1. T acquires exclusive locks to O1, . . . , Ok in increasing order of their addresses.
Step 2. The required operations are performed. 
Step 3. All locks are released. This protocol will
  • a)
    guarantee serializability and deadlock-freedom
  • b)
    guarantee neither serializability nor deadlock-freedom
  • c)
    guarantee serializability but not deadlock-freedom
  • d)
    guarantee deadlock-freedom but not serializability
Correct answer is option 'A'. Can you explain this answer?

SHAGUN RAJENDER answered  •  3 hours ago
The above scenario is Conservative 2PL(or Static 2PL). In Conservative 2PL protocol, a transaction has to lock all the items it access before the transaction begins execution. It is used to avoid deadlocks. Also, 2PL is  conflict serializable, therefore it guarantees serializability. Therefore option A Advantages of Conservative 2PL :
  • No possibility of deadlock.
  • Ensure serializability.
Drawbacks of Conservative 2PL :
  • Less throughput and resource utilisation because it holds the resources before the transaction begins execution.
  • Starvation is possible since no restriction on unlock operation.
  • 2pl is a deadlock free protocol but it is difficult to use in practice.

Consider a hash table of size seven, with starting index zero, and a hash function (3x + 4)mod7. Assuming the hash table is initially empty, which of the following is the contents of the table when the sequence 1, 3, 8, 10 is inserted into the table using closed hashing? Note that ‘_’ denotes an empty location in the table.
  • a)
    8, _, _, _, _, _, 10
  • b)
    1, 8, 10, _, _, _, 3
  • c)
    1, _, _, _, _, _,3
  • d)
    1, 10, 8, _, _, _, 3
Correct answer is option 'B'. Can you explain this answer?

SUMAN KUMARI answered  •  14 hours ago
Let us put values 1, 3, 8, 10 in the hash of size 7. Initially, hash table is empty
The value of function (3x + 4)mod 7 for 1 is 0, so let us put the value at 0
The value of function (3x + 4)mod 7 for 3 is 6, so let us put the value at 6
The value of function (3x + 4)mod 7 for 8 is 0, but 0 is already occupied, let us put the value(8) at next available space(1)
The value of function (3x + 4)mod 7 for 10 is 6, but 6 is already occupied, let us put the value(10) at next available space(2)

In programming languages like C, C++, Python . . . the memory used by a program is typically separated into two parts, the stack and the heap.
Consider the following statements:
1. A stack is efficient for managing nested function calls.
2. Stack space is limited while heap space is not.
3. The stack cannot be used for persistent data structures.
  • a)
    1 and 2 are true but 3 is false.
  • b)
    1 and 3 are true but 2 is false.
  • c)
    2 and 3 are true but 1 is false.
  • d)
    All three statements are true.
Correct answer is option 'B'. Can you explain this answer?

VIJAY KUMARI answered  •  14 hours ago
Because Size of heap and stack both are limited. There is nothing which is unlimited. Yes but Size of stack and Size of heap is constant. It means that If there is total size available is 10, and If i used 7 block for stack then i can only use 3 block for heap but not more than that. i.e Size of stack and size of heap are inversely proportional. I mean that if size of stack increases then size of heap decreases, and vice versa.

What will be the output of the following C program?
  • a)
    3 1 2 2 1 3 4 4 4
  • b)
    3 1 2 1 1 1 2 2 2
  • c)
    3 1 2 2 1 3 4
  • d)
    3 1 2 1 1 1 2
Correct answer is option 'A'. Can you explain this answer?

SAVITA THAKUR answered  •  14 hours ago
count(3) will print value of n and d. So 3 1 will be printed and d will become 2.
Then count(2) will be called. It will print value of n and d.
So 2 2 will be printed and d will become 3.
Then count(1) will be called. It will print value of n and d.
So 1 3 will be printed and d will become 4.
Now count(1) will print value of d which is 4. count(1) will finish its execution.
Then count(2) will print value of d which is 4.
Similarly, count(3) will print value of d which is 4.
So series will be A.

r1 = {b* ab* ab* ab*)*, r2 = (b* ab* ab*)*. What is L(r1) ∩ L(r2)?
  • a)
    [(b* ab* ab* ab*)*]
  • b)
    [(b* ab* ab*)*]
  • c)
    [(if ab* a b*)6]
  • d)
    [(b* ab* ab* ab* ab* ab* ab*)*]
Correct answer is option 'D'. Can you explain this answer?

PRIYANKA KUMARI answered  •  14 hours ago

r1, denotes multiple of 3 a’s, with any number of b’s.
r2 denotes multiple of 2 a’s, with any number of b’s. L(r1) ∩ L(r2) denotes multiple of 6 a’s, with any number of b’s. Hence,

An ordered n-tuple (d1, d2, … , dn) with d1 >= d2 >= ⋯ >= dn is called graphic if there exists a simple undirected graph with n vertices having degrees d1, d2, … , dn respectively. Which of the following 6-tuples is NOT graphic?
  • a)
    (1, 1, 1, 1, 1, 1)
  • b)
    (2, 2, 2, 2, 2, 2)
  • c)
    (3, 3, 3, 1, 0, 0)
  • d)
    (3, 2, 1, 1, 1, 0)
Correct answer is option 'C'. Can you explain this answer?

SEEMA DEVI answered  •  14 hours ago
The required graph is not possible with the given degree set of (3, 3, 3, 1, 0, 0). Using this 6-tuple the graph formed will be a Disjoint undirected graph, where the two vertices of the graph should not be connected to any other vertex ( i.e. degree will be 0 for both the vertices ) of the graph. And for the remaining 4 vertices the graph need to satisfy the degrees of (3, 3, 3, 1).
Let's see this with the help of a logical structure of the graph :
Let's say vertices labelled as <ABCDEF> should have their degree as <3, 3, 3, 1, 0, 0> respectively.
 
Now E and F should not be connected to any vertex in the graph. And A, B, C and D should have their degree as <3, 3, 3, 1> respectively. Now to fulfill the requirement of A, B and C, the node D will never be able to get its degree as 1. It's degree will also become as 3. This is shown in the above diagram.
Hence tuple <3, 3, 3, 1, 0, 0> is not graphic.

The reference polynomial used in a CRC scheme  is x4 + x3 + 1. A data sequence 1010101010 is to be sent, Determine the actual bit string that is transmitted.
  • a)
    10101010100011
  • b)
    10101010101110
  • c)
    10101010100110
  • d)
    10101010100010
Correct answer is option 'D'. Can you explain this answer?

MONIKA SOM answered  •  14 hours ago
Reference polynomial x4 + r3 + 1 =11001
Datasequence = 1010101010
On dividing 1010101010 by 11001,
We get CRC (i.e. remainder) = 0010
On appending this CRC on data sequence, we get the actual message transmitted i.e. 10101010100010.

1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4...... In the above sequence what is the number of the position 2888 of the sequence
  • a)
    1
  • b)
    4
  • c)
    3
  • d)
    2
Correct answer is option 'C'. Can you explain this answer?

HARSH SINGH answered  •  yesterday
First if we count 1223334444. they are 10
In the next term they are 20
Next they are 30 and so on
So Using n(n+1)2×10≤2888
For n = 23 we get LHS as 2760. Remaining terms 128.
Now in the 24th term, we have 24 1's, and next 48 terms are 2's. So next 72 terms are 3's.

The degree sequence of a simple graph is the sequence of the degrees of the nodes in the graph in decreasing order. Which of the following sequences can not be the degree sequence of any graph?
I. 7, 6, 5, 4, 4, 3, 2, 1
II. 6, 6, 6, 6, 3, 3, 2, 2
III. 7, 6, 6, 4, 4, 3, 2, 2
IV. 8, 7, 7, 6, 4, 2, 1, 1
  • a)
    I and II
  • b)
    III and IV
  • c)
    IV only
  • d)
    II and IV
Correct answer is option 'D'. Can you explain this answer?

RAJAT KUMAR answered  •  yesterday
A generic algorithm or method to solve this question is 1: procedure isV alidDegreeSequence(L) 2: for n in list L do 3: if L doesn’t have n elements next to the current one then return false 4: decrement next n elements of the list by 1 5: arrange it back as a degree sequence, i.e. in descending order 6: if any element of the list becomes negative then return false 7: return true Rationale behind this method comes from the properties of simple graph. Enumerating the f alse returns, 1) if L doesn’t have enough elements after the current one or 2) if any element of the list becomes negative, then it means that there aren’t enough nodes to accommodate edges in a simple graph fashion, which will lead to violation of either of the two conditions of the simple graph (no self-loops and no multiple-edges between two nodes), if not others. 
... more

1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4...... In the above sequence what is the number of the position 2888 of the sequence
  • a)
    1
  • b)
    4
  • c)
    3
  • d)
    2
Correct answer is option 'C'. Can you explain this answer?

ARYAN CHATURVEDI answered  •  yesterday
First if we count 1223334444. they are 10
In the next term they are 20
Next they are 30 and so on
So Using n(n+1)2×10≤2888
For n = 23 we get LHS as 2760. Remaining terms 128.
Now in the 24th term, we have 24 1's, and next 48 terms are 2's. So next 72 terms are 3's.

If a DFA is represented by the following transition table, then how many states does the corresponding minimal DFA contains?
  • a)
    2
  • b)
    3
  • c)
    4
  • d)
    5
Correct answer is option 'C'. Can you explain this answer?

ADITYA ANMOL answered  •  yesterday
Drawing the DFA corresponding to the given transition table:

Use DFA minimization algorithm
The corresponding minimum state DFA for this language can be constructed as

Only 4 states are needed.

Linked lists are not suitable for implementing
  • a)
    insertion sort
  • b)
    Binary search
  • c)
    Radix sort .
  • d)
    Polynomial manipulation
Correct answer is option 'B'. Can you explain this answer?

ANMOL BANSAL answered  •  yesterday
In case of using link list, one cannot randomly access the data or only serial data access is there. But, in case of binary search one needs to jump randomly either to first half or other half, which is not possible with linked list.

Which language does the following PDA accept   and b is given by
  • a)
  • b)
  • c)
  • d)
Correct answer is option 'D'. Can you explain this answer?

ANKIT SINGH answered  •  yesterday

So, strain at least contain 011, push 0, skip 1st 1 then POP 0 for second 1, the accept by ∈, z0, t transition.

Level order traversal of a rooted tree can be done by starting from the root and performing
  • a)
    Preorder traversal
  • b)
    Inorder traversal
  • c)
    Depth first search
  • d)
    Breadth first search
Correct answer is option 'D'. Can you explain this answer?

AYUSH ASWAL answered  •  yesterday
Level order traversal of rooted tree can be done by starting from root and visiting all node at k level before visiting any node at k + 1 level, which is nothing but breadth first search.

If for non-zero x,  where a
  • a)
  • b)
  • c)
  • d)
Correct answer is option 'A'. Can you explain this answer?

SMIT LOKHANDWALA answered  •  yesterday

Integrating both sides,




 (2) and (3) by multiplying (2) by  and (3) by  and subtracting

If L1, is regular and L2 is CFL over ∑* which of the following statement is incorrect?
  • a)
     L1 ∪ L2 is CFL
  • b)
    L1 ∩ L2 is regular
  • c)
     L1* is regular
  • d)
    None of these
Correct answer is option 'B'. Can you explain this answer?

TEJASVI PALIYA answered  •  yesterday
Since L1 and L2 are regular and context free languages respectively CFL are closed under regular ∪, ∩, therefore
(a) L1 ∪ L2 is CFL and therefore regular too.
(b) L1 ∩ L2 is not regular
(c) L1 * is regular

Sparse matrices have
  • a)
    Many zero entries
  • b)
    Many non-zero entries
  • c)
    Higher dimension
  • d)
    None of the above
Correct answer is option 'A'. Can you explain this answer?

HEMANT KUMAR answered  •  2 days ago
Sparse matrices are those matrices in which most of the elements are zero.
In contrast, if most of the elements are non-zero then the matrix is considered DENSE.

At a particular time of ocmputation the value of a counting semaphore is 7. Then 20 P operations and 15 V operation were completed on this semaphore. The resulting value of the semaphore is
  • a)
    42
  • b)
    2
  • c)
    7
  • d)
    12
Correct answer is option 'B'. Can you explain this answer?

RITWIK SAINI answered  •  2 days ago
Number of wait process = 20 i.e. decrement Number of signal process = 15 i.e. increment Therefore value of semaphore at the end of program execution
= Initial value - Number of P(C) + Number of V(C)
= 7 - 20 + 15 = 2

In question number 25, if the number of available page frames is increased to 4 then the number of page transfer
  • a)
    Decreases
  • b)
    Increases
  • c)
    Remains the same
  • d)
    None of the above
Correct answer is option 'B'. Can you explain this answer?

VISHNU M answered  •  2 days ago
We find the required number of page transfer is 10. So, increasing the number of pages need not necessarily reduce the number of page faults. It is the actual sequences of references that decides.

If half adders and full adders are implemented using gates, then for the addition of two 17 bit numbers (using minimum gates) the number of half adders and full adders required will be 
  • a)
    0,17
  • b)
    16,1
  • c)
    1 , 1 6
  • d)
    8 , 8
Correct answer is option 'C'. Can you explain this answer?

AKSHAZ SOOD answered  •  2 days ago
As we know that n bit full adder circuit can represent (n + 1) bits sum. In order to represent addition of two 17 bits numbers we require minimum of 16 full adder and 1 half adder.
Note: For the first bit we can use either HA or FA. Hence, for addition of two 17 bit numbers inspire of 17 full adders we can perform the same task using 16 FA and 1 HA.
Hence (c) is the correct option.

The following bit pattern represents a floating point number in IEEE 754 single precision format:

The value of the number in decimal form is 
  • a)
    - 10
  • b)
    - 13
  • c)
    - 26
  • d)
    None of these
Correct answer is option 'C'. Can you explain this answer?

SHUBHAM VINAY answered  •  2 days ago
Sign bit is 1 implies number is negative. Exponent bits: 10000011 Exponent is added with 127 bias in IEEE single precision format.
So, Actual exponent
= 10000011 - 127 
= 131 - 127 = 4
Mantissa bits: 101000000000000000000000
In IEEE format, an implied 1 is before mantissa.
Hence the Number is -1.101*24
= - (11010)2 = - 26

The main function of shared memory is to
  • a)
    Use primary memory efficiently
  • b)
    Do intra process communication
  • c)
    Do inter process communication
  • d)
    None of these
Correct answer is option 'C'. Can you explain this answer?

ROHIT KUMAR answered  •  2 days ago
Shared memory is that memory that can be simultaneously accessed by multiple programs with an intent to provide communication among them or to avoid redundant copies. Shared memory is a way of interchanging data between programs.

Page fault occurs when
  • a)
    The page is corrupted by application software
  • b)
    The page is in main memory
  • c)
    The page is not in main memory
  • d)
    The tries to divide a number by 0
Correct answer is option 'C'. Can you explain this answer?

LUIS ALDRIGE answered  •  2 days ago
Page fault occurs when required page that is to be needed is not found in the main memory. When the page is found in the main memory it is called page hit, otherwise miss.

Overlay is
  • a)
    A part of an operating system
  • b)
    A specific memory location
  • c)
    A single contiguous memory that was used in the olden days for running large programs by swapping
  • d)
    Overloading the system with many user files 
Correct answer is option 'C'. Can you explain this answer?

JYOTI RAJ answered  •  2 days ago
Overlay means “the process of transfers a block of program code or other data into internal memory, replacing what is already stored". Overlaying is a programming method that allows programs to be large than the computer’s main memory.

  • a)
    K4 is planar while Q3 is not
  • b)
    Both K4 and Q3 are planar
  • c)
    Q3 is planar while K4 is not
  • d)
    Neither K4 nor Q3 are planar
Correct answer is option 'B'. Can you explain this answer?

SANKHA SUVRA answered  •  2 days ago
A Graph is said to be planar if it can be drawn in a plane without any edges crossing each other. Following are planar embedding of the given two graph

Suppose we are sorting an array of eight integers using heapsort, and we have just finished some heapify (either maxheapify or minheapify) operations. The array now looks like this: 16 14 15 10 12 27 28 How many heapify operations have been performed on root of heap?
  • a)
    1
  • b)
    2
  • c)
    3 or 4
  • d)
    5 or 6
Correct answer is option 'B'. Can you explain this answer?

PIYUSH THAKUR answered  •  2 days ago
In Heapsort, we first build a heap, then we do following operations till the heap size becomes 1. a) Swap the root with last element b) Call heapify for root c) reduce the heap size by 1. In this question, it is given that heapify has been called few times and we see that last two elements in given array are the 2 maximum elements in array. So situation is clear, it is maxheapify whic has been called 2 times.

Fetching relevant content for you
Ask a question