A thread is usually defined as a ‘lightweight process’ because an operating system (OS) maintains smaller data structures for a thread than for a process. In relation to this, which of the following is TRUE?
A. On per-thread basis, the OS maintains only CPU register state
Each thread in an operating system only requires the maintenance of its CPU register state. The OS does not need to maintain a separate stack for each thread or virtual memory state. Additionally, the OS only needs to maintain scheduling and accounting information on a per-thread basis. Therefore, the statement that the OS maintains only CPU register state on a per-thread basis is true.
The lexical analysis for a modern computer language such as Java needs the power of which one of the following machine models in a necessary and sufficient sense?
A. Finite state automata
The lexical analysis for a modern computer language such as Java requires the power of a finite state automata in a necessary and sufficient sense. A finite state automata is a mathematical model that can recognize regular languages, which are the class of languages that can be described by regular expressions. Lexical analysis involves tokenizing the input source code into a sequence of tokens, and regular expressions are commonly used to define the patterns for these tokens. Therefore, a finite state automata is the appropriate machine model for performing lexical analysis.
Let the page fault service time be 10ms in a computer with average memory access time being 20ns. If the one-page fault is generated for every 106 memory accesses, what is the effective access time for the memory?
(A) 21ns (B) 30ns (C) 23ns (D) 35ns
The effective access time for the memory can be calculated by taking into account the average memory access time and the page fault service time. Since one page fault is generated for every 10^6 memory accesses, the time taken for the page fault service can be calculated as 10ms/10^6 = 10ns. Therefore, the effective access time is the sum of the average memory access time and the page fault service time, which is 20ns + 10ns = 30ns.
Consider a hypothetical processor with an instruction of type LW R1, 20(R2),
which during execution reads a 32-bit word from memory and stores it in a 32-bit
register R1. The effective address of the memory location is obtained by the
addition of constant 20 and the contents of register R2. Which of the following
best reflects the addressing mode implemented by this instruction for the
operand in memory?
D. Base Indexed Addressing
The given instruction LW R1, 20(R2) uses base indexed addressing mode for the operand in memory. In this addressing mode, the effective address is calculated by adding a constant value (20 in this case) to the contents of a register (R2 in this case). The result is the memory location from which the word is read and stored in register R1. This addressing mode allows for flexibility in accessing memory locations by using a combination of a base register and an offset value.
If two fair coins are flipped and at least one of the outcomes is known to be a
head, what is the probability that both outcomes are heads?
When two fair coins are flipped, there are four possible outcomes: HH, HT, TH, and TT. However, since we know that at least one of the outcomes is a head, we can eliminate the possibility of TT. This leaves us with three equally likely outcomes: HH, HT, and TH. Out of these three outcomes, only one has both outcomes as heads, which is HH. Therefore, the probability of both outcomes being heads is 1 out of 3, or 1/3.
Consider different activities related to email.
m1: Send an email from a mail client to a mail server
m2: Download an email from mailbox server to a mail client
m3: Checking email in a web browser
Which is the application level protocol used in each activity?
C. M1: SMTP m2: POP m3: HTTP
In activity m1, sending an email from a mail client to a mail server, the application level protocol used is SMTP (Simple Mail Transfer Protocol). SMTP is responsible for sending emails from the client to the server.
In activity m2, downloading an email from mailbox server to a mail client, the application level protocol used is POP (Post Office Protocol). POP allows the client to retrieve emails from the server and download them to the client's device.
In activity m3, checking email in a web browser, the application level protocol used is HTTP (Hypertext Transfer Protocol). HTTP is the protocol used for communication between web browsers and web servers, and in this case, it is used to access and display emails in a web browser.
Which of the following is NOT desired in a good Software Requirement
Specifications (SRS) document?
D. Algorithms for Software Implementation
In a good Software Requirement Specifications (SRS) document, algorithms for software implementation are not desired. The SRS document primarily focuses on providing a clear and comprehensive description of the functional and non-functional requirements of the software system, as well as the goals of implementation. Algorithms for software implementation are typically addressed in the design and development phases of the software development lifecycle, rather than in the requirements specification phase. Therefore, including algorithms in the SRS document would be unnecessary and could potentially confuse the purpose and scope of the document.
Consider a relational table with a single record for each registered student with
the following attributes.
1. Registration_Number: Unique registration number for each registered student
2. UID: Unique Identity number, unique at the national level for each citizen
3. BankAccount_Number: Unique account number at the bank. A student can
have multiple accounts or joint accounts. This attributes stores the primary
4. Name: Name of the Student
5. Hostel_Room: Room number of the hostel
Which of the following options is INCORRECT?
A. BankAccount_Number is a candidate key
BankAccount_Number cannot be a candidate key because it is mentioned in the question that a student can have multiple accounts or joint accounts. A candidate key should uniquely identify each record in a table, but since a student can have multiple bank accounts, BankAccount_Number cannot fulfill this requirement.
. Database table by name Loan_Records is given below.
Borrower Bank_Manager Loan_ Amount
Ramesh Sunderajan 10000.00
Suresh Ramgopal 5000.00
Mahesh Sunderajan 7000.00
What is the output of the following SQL query?
(SELECT Borrower. Bank_Manager FROM Loan_Records) AS S
(SELECT Bank_Manager, Loan_Amount FROM Loan_Records) AS T
The output of the SQL query is 5. The query first selects the columns "Borrower" and "Bank_Manager" from the "Loan_Records" table and aliases it as "S". Then it selects the columns "Bank_Manager" and "Loan_Amount" from the "Loan_Records" table and aliases it as "T". It then performs a natural join between "S" and "T". The natural join will return only the rows where the "Bank_Manager" values match in both "S" and "T". Finally, the count(*) function is applied to count the number of rows in the result set, which is 5.
On a non-pipelined sequential processor, a program segment, which is a part of
the interrupt service routine, is given to transfer 500 bytes from an I/O device to
Initialize the address register
Initialize the count to 500
LOOP: Load a byte from device
Store in memory at address given by address register
Increment the address register
Decrement the count
If count != 0 go to LOOP
Assume that each statement in this program is equivalent to a machine
instruction which takes one clock cycle to execute if it is a non-load/store
instruction. The load-store instructions take two clock cycles to execute.
The designer of the system also has an alternate approach of using the DMA
controller to implement the same transfer. The DMA controller requires 20 clock
cycles for initialization and other overheads. Each DMA transfer cycle takes two
clock cycles to transfer one byte of data from the device to the memory.
What is the approximate speedup when the DMA controller based design is used
in place of the interrupt driven program based input-output?
The approximate speedup when the DMA controller based design is used in place of the interrupt driven program based input-output is 3.4. This means that the DMA controller design is approximately 3.4 times faster than the interrupt driven program design.
Consider a database table T containing two columns X and Y each of type integer.
After the creation of the table, one record (X= 1, Y=l) is inserted in the table.
Let MX and MY denote the respective maximum values of X and Y among all
records in the table at any point in time. Using MX and MY, new records are
inserted in the table 128 times with X and Y values being MX+1, 2*MY+1
respectively. It may be noted that each time after the insertion, values of MX and
What will be the output of the following SQL query after the steps mentioned
above are carried out?
SELECT Y FROM T WHERE X=7;
The output of the SQL query will be 127. This is because the query is selecting the value of Y from the table T where X is equal to 7. According to the given steps, new records are inserted in the table 128 times with X and Y values being MX+1 and 2*MY+1 respectively. Since the initial record has X=1 and Y=1, the maximum value of X after 128 insertions will be 129. However, the maximum value of Y will be 127. Therefore, when the query is executed with X=7, it will return the corresponding value of Y, which is 127.
A deck of 5 cards (each carrying a distinct number from 1 to 5) is shuffled thoroughly. Two cards are then removed one at a time from the deck. What is the probability that the two cards are selected with the number on the first card being one higher than the number on the second card?
(A) 1/5 (B) 4/25 (C) 1/4 (D) 2/5
The probability of selecting the first card with a number one higher than the second card can be calculated by counting the number of favorable outcomes and dividing it by the total number of possible outcomes. In this case, there is only one favorable outcome, which is selecting the cards in the order of 2 and 1. The total number of possible outcomes is the number of ways to select 2 cards out of 5, which is calculated as 5 choose 2 (5C2) = 10. Therefore, the probability is 1/10, which is equivalent to 1/5.
Consider the following table of arrival time and burst time for three processes P0,
P1 and P2.
Process Arrival time Burst Time
P0 0 ms 9 ms
P1 1 ms 4ms
P2 2 ms 9ms
The pre-emptive shortest job first scheduling algorithm is used. Scheduling is
carried out only at the arrival or completion of processes. What is the average
waiting time for the three processes?
The average waiting time for the three processes is 5.0ms. This is because the shortest job first scheduling algorithm prioritizes the process with the shortest burst time. In this case, P1 has the shortest burst time of 4ms, so it is executed first. P0 and P2 are then executed in the order of their arrival time. The waiting time for P0 is 1ms (arrival time of P1) and the waiting time for P2 is 3ms (arrival time of P1 plus burst time of P1). The average waiting time is calculated by summing the waiting times of all processes and dividing by the number of processes, which in this case is (1+0+3)/3 = 4/3 = 5.0ms.
An index is clustered, if
C. The data records of the file are organized in the same order as the data
entries of the index.
A clustered index is created on a set of fields that determine the physical order of the data records in a file. This means that the data records are physically stored on disk in the same order as the data entries in the index. This type of index allows for faster retrieval of data because the system can read the data records in a sequential manner. Therefore, the correct answer is that a clustered index is formed when the data records of the file are organized in the same order as the data entries of the index.
The transport layer protocols used for real-time multimedia, file transfer, DNS, and email, respectively are
C. UDP, TCP, UDP and TCP
The transport layer protocols used for real-time multimedia, file transfer, DNS, and email, respectively are UDP, TCP, UDP and TCP. UDP (User Datagram Protocol) is used for real-time multimedia and DNS because it is a connectionless protocol that allows for faster transmission of data but does not guarantee delivery. TCP (Transmission Control Protocol) is used for file transfer and email because it is a reliable protocol that ensures the delivery of data packets in the correct order. Therefore, UDP is used for real-time applications where speed is more important, while TCP is used for applications where data integrity is crucial.
A scheduling algorithm assigns priority proportional to the waiting time of a process. Every process starts with priority zero(the lowest priority). The scheduler re-evaluates the process priorities every T time units and decides the next process schedule. Which one of the following is TRUE if the processes have no I/O operations and all arrive at time zero?
B. This algorithm is equivalent to the round-robin algorithm.
The given algorithm assigns priority to processes based on their waiting time, which means that the longer a process waits, the higher its priority becomes. This is similar to the round-robin algorithm where processes are assigned a fixed time quantum and are executed in a cyclic manner. In the given algorithm, the scheduler re-evaluates process priorities every T time units, which is analogous to the round-robin algorithm where each process gets a fixed time quantum before moving to the next process. Therefore, the given algorithm is equivalent to the round-robin algorithm.
Suppose p is a number of cars per minute passing through a certain road junction between 5 PM and 6 PM, and p has a Poisson distribution with mean 3. What is the probability of observing fewer than 3 cars during any given minute in this interval?
C. 17 / 2e
The probability of observing fewer than 3 cars during any given minute can be calculated using the Poisson distribution formula. The formula is P(X < k) = e^(-λ) * (λ^0/0!) + e^(-λ) * (λ^1/1!) + ... + e^(-λ) * (λ^(k-1)/(k-1)!), where λ is the mean of the Poisson distribution. In this case, λ = 3. Plugging in the values, we get P(X < 3) = e^(-3) * (3^0/0!) + e^(-3) * (3^1/1!) + e^(-3) * (3^2/2!) = 0.049787068 + 0.149361204 + 0.224041806 = 0.423190078. Simplifying this fraction, we get 17 / 2e.
In an IPv4 datagram, the M bit is 0, the value of HLEN is 10, the value of total length is 400 and the fragment offset value is 300. The position of the datagram, the sequence numbers of the first and the last bytes of the payload, respectively are:
C. Last fragment, 2400 and 2759
The given answer is "Last fragment, 2400 and 2759" because the M bit is 0, indicating that this is the last fragment of the original datagram. The fragment offset value is 300, which means that this fragment starts at byte position 300. The value of HLEN is 10, indicating that the header length is 40 bytes. Therefore, the payload starts at byte position 300 + 40 = 340. The total length of the datagram is 400, so the payload ends at byte position 340 + 400 - 1 = 739. Therefore, the sequence numbers of the first and last bytes of the payload are 2400 and 2759 respectively.
Determine the maximum length of cable (in km) for transmitting data at a rate of 500 Mbps in an Ethernet LAN with frames of size 10,000 bits. Assume the signal speed in the cable to be 2,00,000 km/s.
The maximum length of cable can be determined using the formula: Length = (Data rate * Frame size) / Signal speed. In this case, the data rate is 500 Mbps (500 million bits per second), the frame size is 10,000 bits, and the signal speed is 200,000 km/s. Plugging these values into the formula, we get Length = (500 Mbps * 10,000 bits) / 200,000 km/s = 25 km. Therefore, the maximum length of cable for transmitting data at a rate of 500 Mbps is 25 km.
A shared variable x, initialized to zero, is operated on by four concurrent processes
W, X, Y, Z as follows. Each of the processes W and X read x from memory,
increments by one, stores it to memory, and then terminates. Each of the processes
Y and Z read x from memory, decrements by two, stores it to memory, and then
terminates. Each process before reading x invokes the P operation (i.e., wait) on a
counting semaphore S and invokes the V operation (i.e., signal) on the semaphore S
after storing x to memory. Semaphore S is initialized to two. What is the maximum
possible value of x after all processes complete execution?
The maximum possible value of x after all processes complete execution is 2. This is because the processes W and X both increment x by 1, and the processes Y and Z both decrement x by 2. Since the initial value of x is 0 and there are an equal number of processes incrementing and decrementing x, the maximum value that x can reach is 2.
Which of the following statements is/are TRUE for undirected graphs?
P: Number of odd degree vertices is even.
Q: The sum of degrees of all vertices is even.
C. Both P and Q
In undirected graphs, the number of odd degree vertices is always even because every edge contributes two degrees, one for each endpoint. Therefore, the sum of degrees of all vertices is always even as well. Hence, both statements P and Q are true for undirected graphs.
Function f is known at the following points:
X 0 0.3 0.6 0.9 1.2 1.5 1.8 2.1 2.4 2.7 3.0
f(x) 0 0.09 0.36 0.81 1.44 2.25 3.24 4.41 5.76 7.29 9.00
The value of integral 0-3 f(x)dx computed using the trapezoidal rule is
The trapezoidal rule is a method for approximating the definite integral of a function by dividing the interval into smaller trapezoids. The area of each trapezoid is then calculated and summed to obtain an approximation of the integral. In this case, the function f is known at various points, and we can use these points to calculate the area under the curve. Using the trapezoidal rule, the calculated value of the integral 0-3 f(x)dx is 9.045.
Which of the following statements is TRUE?
(1) The problem of determining whether there exists a cycle in an undirected
the graph is in P.
(2) The problem of determining whether there exists a cycle in an undirected
the graph is in NP.
(3) If problem A is NP-Complete, there exists a non-deterministic polynomial
time algorithm to solve A.
A. 1,2 and 3
The given answer is correct because all three statements are true. Statement 1 states that the problem of determining whether there exists a cycle in an undirected graph is in P, which means it can be solved in polynomial time. Statement 2 states that the problem is in NP, which means a solution can be verified in polynomial time. Statement 3 is a general statement about NP-Complete problems, stating that if a problem A is NP-Complete, there exists a non-deterministic polynomial time algorithm to solve A. Therefore, all three statements are true.
Which one of the following is the tightest upper bound that represents the time-complexity of inserting an object into a binary search tree of n nodes?
The time complexity of inserting an object into a binary search tree of n nodes is O(n). This is because in the worst case scenario, the binary search tree can be skewed, meaning that it is essentially a linked list. In this case, each insertion would require traversing through all n nodes in order to find the correct position for the new object. Therefore, the time complexity is linear in terms of the number of nodes in the tree, resulting in O(n).
Which one of the following is the tightest upper bound that represents the time complexity of inserting an object into a binary search tree of n nodes?
The time complexity of inserting an object into a binary search tree depends on the height of the tree. In the worst case scenario, the tree can degenerate into a linked list, causing the height to be equal to the number of nodes (n). Therefore, the tightest upper bound for the time complexity of inserting an object into a binary search tree is O(n).