Log In

Answers by Arjun

1 vote
Consider the following $\text{ANSI C}$ code segment: z=x + 3 + y->f1 + y->f2; for (i = 0; i < 200; i = i + 2) { if (z > i) { p = p + x + 3; q = q + y->f1; } else { p = p + y->f2; q = q + x + 3; } } Assume that the variable $y$ points to ... the form $\textsf{ y ->f1}$ or $\textsf{y ->f2}$) in the optimized code, respectively, are: $403$ and $102$ $203$ and $2$ $303$ and $102$ $303$ and $2$
answered Feb 21 in Compiler Design 537 views
4 votes
Consider the following multi-threaded code segment (in a mix of C and pseudo-code), invoked by two processes $P_1$ and $P_2$, and each of the processes spawns two threads $T_1$ and $T_2$: int x = 0; // global Lock L1; // global main () { create a thread to execute foo( ... will print the value of $y$ as $2.$ Both $T_1$ and $T_2$, in both the processes, will print the value of $y$ as $1.$
answered Feb 21 in Operating System 573 views
9 votes
There are $6$ jobs with distinct difficulty levels, and $3$ computers with distinct processing speeds. Each job is assigned to a computer such that: The fastest computer gets the toughest job and the slowest computer gets the easiest job. Every computer gets at least one job. The number of ways in which this can be done is ___________.
answered Feb 19 in Combinatory 466 views
2 votes
Consider the following instruction sequence where registers $R1, R2$ and $R3$ are general purpose and $\text{MEMORY}[X]$ denotes the content at the memory location $X$ ... format. Assume that the memory is byte addressable. After the execution of the program, the content of memory location $3010$ is ____________
answered Feb 19 in CO and Architecture 197 views
1 vote
What can be said about a regular language $L$ over $\{ a \}$ whose minimal finite state automaton has two states? $L$ must be $\{a^n \mid n \ \text{ is odd}\}$ $L$ must be $\{a^n \mid n \ \text{ is even}\}$ $L$ must be $\{a^n \mid n \geq 0\}$ Either $L$ must be $\{a^n \mid n \text{ is odd}\}$, or $L$ must be $\{a^n \mid n \text{ is even}\}$
answered Feb 14 in Theory of Computation 4.3k views
25 votes
What is the worst case time complexity of inserting $n$ elements into an empty linked list, if the linked list needs to be maintained in sorted order? $\Theta(n)$ $\Theta(n \log n)$ $\Theta ( n)^{2}$ $\Theta(1)$
answered Feb 18, 2020 in DS 10.4k views
21 votes
Consider a paging system that uses $1$-level page table residing in main memory and a TLB for address translation. Each main memory access takes $100$ ns and TLB lookup takes $20$ ns. Each page transfer to/from the disk takes $5000$ ns. Assume that the TLB hit ... is read from disk. TLB update time is negligible. The average memory access time in ns (round off to $1$ decimal places) is ___________
answered Feb 13, 2020 in Operating System 15.2k views
3 votes
I want to clearly understand the difference between compulsory miss, conflict miss and capacity miss what I understood is compulsory miss: when a block of main memory is trying to occupy fresh empty line of cache, it is called compulsory miss conflict miss: when ... set-associative cache. Because in associative mapping, no block of main memory tries to occupy already filled line. is this correct?
answered Jan 3, 2020 in CO and Architecture 13.1k views
8 votes
The population of a new city is $5$ million and is growing at $20\%$ annually. How many years would it take to double at this growth rate? $3-4$ years $4-5$ years $5-6$ years $6-7$ years
answered Nov 8, 2019 in Quantitative Aptitude 4.5k views
11 votes
In a binary tree, for every node the difference between the number of nodes in the left and right subtrees is at most $2$. If the height of the tree is $h > 0$, then the minimum number of nodes in the tree is $2^{h-1}$ $2^{h-1} + 1$ $2^h - 1$ $2^h$
answered Oct 19, 2019 in DS 8k views
3 votes
answered Sep 10, 2019 in Set Theory & Algebra 371 views
6 votes
2 votes
Why this statement Turing Machine accepts the null string epsilon ? is not Decidable ? explain with an example.
answered Aug 7, 2019 in Theory of Computation 935 views
4 votes
A concurrent system consists of $3$ processes using a shared resource $R$ in a non-preemptible and mutually exclusive manner. The processes have unique priorities in the range $1 \dots 3$, $3$ being the highest priority. It is required to synchronize the processes such ... priority]:=true; else begin V(proceed [priority]); busy:=true; end V(mutex) Give the pseudo code for the procedure release_R.
answered Jul 15, 2019 in Operating System 917 views
4 votes
In the program scheme given below indicate the instructions containing any operand needing relocation for position independent behaviour. Justify your answer. ...
answered Jul 15, 2019 in CO and Architecture 1.4k views
12 votes
If the state machine described in figure should have a stable state, the restriction on the inputs is given by $a.b=1$ $a+b=1$ $\bar{a} + \bar{b} =0$ $\overline{a.b}=1$ $\overline{a+b} =1$
answered Jul 14, 2019 in Digital Logic 3.8k views
5 votes
Assume that there are $3$ page frames which are initially empty. If the page reference string is $\text{1, 2, 3, 4, 2, 1, 5, 3, 2, 4, 6}$ the number of page faults using the optimal replacement policy is__________.
answered Jul 14, 2019 in Operating System 3.5k views
5 votes
A number of processes could be in a deadlock state if none of them can execute due to non-availability of sufficient resources. Let $P_i, 0 \leq i \leq 4$ represent five processes and let there be four resources types $r_j, 0 \leq j \leq 3$. Suppose the following data structures have been used ... Is the system currently in a safe state? If yes, explain why.
answered Jul 14, 2019 in Operating System 1.2k views
6 votes
Following floating point number format is given $f$ is a fraction represented by a $6-bit$ mantissa (includes sign bit) in sign magnitude form, $e$ is a $4-bit$ exponent (includes sign hit) in sign magnitude form and $n=(f, e) = f. 2^e$ is a floating point ... point addition of $A$ and $B.$ What is the percentage error (up to one position beyond decimal point) in the addition operation in (b)?
answered Jul 13, 2019 in Digital Logic 1.1k views
11 votes
The value of a $\text{float}$ type variable is represented using the single-precision $\text{32-bit}$ floating point format of $IEEE-754$ standard that uses $1$ $\text{bit}$ for sign, $\text{8 bits}$ for biased exponent and $\text{23 bits}$ for the ... $−14.25$. The representation of $X$ in hexadecimal notation is $C1640000H$ $416C0000H$ $41640000H$ $C16C0000H$
answered Jul 13, 2019 in Digital Logic 6.1k views
8 votes
The Karnaugh map of a function of (A, B, C) is shown on the left hand side of the above figure. The reduced form of the same map is shown on the right hand side, in which the variable C is entered in the map itself. Discuss, The methodology by which the reduced map has been derived and the rules (or steps) by which the boolean function can be derived from the entries in the reduced map.
answered Jul 13, 2019 in Digital Logic 616 views
43 votes
In a permutation \(a_1 ... a_n\), of n distinct integers, an inversion is a pair \((a_i, a_j)\) such that \(i < j\) and \(a_i > a_j\). If all permutations are equally likely, what is the expected number of inversions in a randomly chosen permutation of \(1. . . n\)? \(\frac{n(n-1)}{2}\) \(\frac{n(n-1)}{4}\) \(\frac{n(n+1)}{4}\) \(2n[\log_2n]\)
answered Jul 6, 2019 in Algorithms 9.3k views