Complete “We ___ our friend’s birthday and we ___ how to make it up to him.” A completely forgot / don’t just know; B forgot completely / don’t just know; C completely forgot / just don’t know; D forgot completely / just don’t know.
Your answer
Answer & solution
Official answer: C
Completely naturally modifies forgot before the verb; just modifies the negative phrase do not know. Thus completely forgot / just do not know, C. In D, completely interrupts the verb-object phrase; placing it before forgot is the neutral order.
The adverb completely measures the extent of forgetting and naturally stands before forgot. The second clause means simply that the speakers do not know what to do, so just precedes the entire negative phrase. “Don’t just know” instead suggests a contrast with merely knowing, such as also acting, which is not the intended meaning. Placing completely between forgot and its object disrupts the neutral verb–object order. C supplies the intended grammatical pair.
Choose correct use of personnel: A The industrialist had a personnel jet. B I write my experience in my personnel diary. C All personnel are being given the day off. D Being religious is a personnel aspect.
Your answer
Answer & solution
Official answer: C
Personnel means staff, so all personnel are being given the day off is correct, C. The other sentences require personal.
Distinguish the noun personnel, meaning employees or staff, from the adjective personal, meaning belonging or relating to an individual. A private jet, a diary and an individual aspect each need personal. In C, the word names the people being given time off and works as a collective plural noun with are. The correct choice is determined by grammatical role and meaning, not pronunciation.
Generic term for garments such as skirt, trousers, shirt: A fabric; B textile; C fibre; D apparel.
Your answer
Answer & solution
Official answer: D
Apparel is the collective term for clothing. Fabric, textile and fibre refer to materials rather than the named garments, so D.
The examples are finished clothing items. Apparel names that category directly. Fibre is a raw thread-like constituent, fabric is material made from fibres, and textile is likewise a material/product class rather than the best collective name for the listed garments. Moving from raw material to finished item clarifies why D is the appropriate generic term.
Ten poles have equal weight. Which information suffices for their total weight? I One quarter of a pole’s weight is 5 kg. II Ten poles weigh 160 kg more than two poles. A I alone insufficient; B II alone insufficient; C either alone sufficient; D even both insufficient.
Your answer
Answer & solution
Official answer: C
I gives each pole 20 kg and total 200 kg. II gives 10w−2w=160, again w=20 kg. Either statement alone suffices, C.
Let one pole weigh w. Statement I yields w/4=5, so w=20 and 10w=200 kg. Independently, statement II says 10w−2w=160, so 8w=160 and the same w follows. Because either statement alone determines a unique total, there is no need to combine them. This is a data-sufficiency question, not merely a request to compute the total.
For f(x)=1−|x| on −1≤x≤1, choose maximizing x and maximum value: A(0, −1), B(−1, 0), C(0, 1), D(−1, 2).
Your answer
Answer & solution
Official answer: C
Since |x|≥0, 1−|x|≤1, with equality at x=0. Hence maximum 1 at 0, C.
Absolute value is minimized at 0 and is always nonnegative. Subtracting it from 1 therefore gives a value at most 1, with equality exactly at x=0. Equivalently, the graph is the inverted V formed by 1+x on the negative half and 1−x on the positive half. Both pieces meet at the maximum(0, 1); the endpoints have value 0.
Select the most grammatical sentence: A Since the report lacked needed information, it was of no use to them. B The report was useless to them because there were no needed information in it. C Since the report did not contain the needed information, it was not real useful to them. D Since the report lacked needed information, it would not had been useful to them.
Your answer
Answer & solution
Official answer: A
A has correct agreement and idiom. B needs was rather than were with uncountable information; C needs really rather than real; D needs would not have been. Thus A.
Check each proposed error rather than relying on overall sound. In B, information is uncountable and takes singular was, not were. In C, the adjective useful needs the adverb really, not the adjective real. In D, a modal perfect requires have followed by a past participle, “would not have been,” not “would not had been.” A has agreement, tense and idiom consistent throughout.
In triangle PQR, PS bisects angle QPR and angle QPS=60°. S lies on QR, with PQ=r and PR=q. Find PS: A(q+r)/(qr), B qr/(q+r), C√(q²+r²), D(q+r)²/(qr).
Your answer
Answer & solution
Official answer: B
The angle-bisector length is 2 qr cos(P/2)/(q+r). Here P/2=60 degrees, so cos=1/2 and length qr/(q+r), B. The formula follows by summing the two triangle areas on either side of the bisector.
Let l=PS. The whole triangle has area(1/2)qr sin 120°. Splitting along the bisector gives two areas(1/2)rl sin 60° and(1/2)ql sin 60°. Equate the sum to the whole: l(q+r)sin 60°=qr sin 120°. Since sin 120°=sin 60°, cancel the common nonzero factor to obtain l=qr/(q+r). This derives the formula directly instead of assuming the bisector is also a median or altitude.
For distinct integers, f returns their maximum, g their minimum, and h returns the remainder when the larger product pq or rs is divided by the smaller. Combined fg means the product of f and g. Evaluate fg(h(2, 5, 7, 3), 4, 6, 8).
Answer & solution
Official answer: 8
The products are 2·5=10 and 7·3=21, so h=21 mod 10=1. On(1, 4, 6, 8), f=8 and g=1. Thus fg=8·1=8.
Evaluate the nested h first. Its products are 2×5=10 and 7×3=21. Dividing 21 by 10 leaves remainder 1, so the outer argument list is 1, 4, 6, 8. Its maximum is 8 and minimum is 1. The requested combined operation fg multiplies those two outputs, 8×1=8; it does not apply h again or multiply all four input values.
P, R, S, T, U form an arithmetic sequence. Which transformed sequences must also be arithmetic? I 2P, 2R, 2S, 2T, 2U; II P−3, R−3, S−3, T−3, U−3; III P², R², S², T², U². A I only; B I and II; C II and III; D I and III.
Your answer
Answer & solution
Official answer: B
For original common difference d, multiplying every term by 2 gives difference 2d and subtracting 3 preserves d. Squaring does not generally preserve equal differences: successive squared differences change by 2d². Therefore I and II are guaranteed, B.
Write the original terms as a, a+d, a+2d, a+3d, a+4d. Multiplying by 2 changes the common difference to 2d, while subtracting 3 leaves it d. Squaring gives successive differences 2 ad+d², 2 ad+3d², and so on, which differ by 2d². Unless d=0, this is not arithmetic. Because the question asks what is guaranteed, I and II qualify; a special constant-sequence exception does not establish III generally.
M is 4 km north of N; P is 2 km south of O; N is 1 km southeast of O. Find MP: A5.34, B6.74, C28.5, D45.49 km.
Your answer
Answer & solution
Official answer: A
Place O=(0, 0), P=(0, −2). Southeast by 1 km puts N=(1/√2, −1/√2), and M=(1/√2, 4−1/√2). Thus MP²=1/2+(6−1/√2)²=37−6√2≈28.515, giving MP≈5.34 km, A.
Use east as positive x and north as positive y. Southeast at distance 1 has components(1/√2, −1/√2), not(1, −1). Set O=(0, 0), so P=(0, −2), N=(1/√2, −1/√2), and M=(1/√2, 4−1/√2). The displacement from P to M is(1/√2, 6−1/√2). Pythagoras yields 37−6√2 under the square root, approximately 5.34 km. Option 28.5 is approximately the squared distance, not the distance.
S1: if a candidate is known to be corrupt, he will not be elected. S2: if a candidate is kind, he will be elected. Which follows? A known to be corrupt implies kind; B not known to be corrupt implies not kind; C kind implies not known to be corrupt; D not kind implies not known to be corrupt.
Your answer
Answer & solution
Official answer: C
Let C mean known to be corrupt, E elected, K kind. From C→¬E obtain E→¬C by contraposition. Composing K→E gives K→¬C, option C.
Contraposition is valid: C→¬E is equivalent to E→¬C. Combine it with K→E to get K→¬C. Neither converse C←¬E nor inverse ¬C→E follows automatically. A person who is not kind may or may not be known to be corrupt; the premises only constrain kind persons through their election consequence. C therefore follows without adding an unstated converse.
Find the cardinality of the power set of{0, 1, 2, …, 10}.
Answer & solution
Official answer: 2048
The set has 11 elements, each independently included or omitted in a subset. Its power set therefore has 211=2048 members.
The set includes both endpoints 0 and 10, so its size is 11, not 10. A subset is determined by 11 independent yes/no inclusion decisions. There are 2 choices for each element, so multiplication gives 211=2048. This counts the empty subset and the full subset as well as all intermediate sizes; equivalently, sum the binomial coefficients C(11, k).
On positive integers, aRb iff a≠b and a, b share a divisor other than 1. Which properties? A symmetric/reflexive/not transitive; B reflexive/not symmetric/not transitive; C transitive/not reflexive/not symmetric; D symmetric/not reflexive/not transitive.
Your answer
Answer & solution
Official answer: D
Common-divisor sharing and distinctness are symmetric. No aRa is allowed, so the relation is not reflexive. For example 2R6 and 6R3 hold, but 2R3 fails. Thus symmetric, nonreflexive, nontransitive, D.
If a, b share a nonunit divisor, then b, a share the same divisor, and distinctness is also symmetric. Reflexivity fails for every a because the definition expressly excludes a=b. For transitivity, use 2, 6, 3:2 and 6 share 2, and 6 and 3 share 3, but 2 and 3 are coprime. A single triple disproves transitivity. Thus D lists exactly the verified properties.
Prime factorization is 2100=21×100=2²·3¹·5²·7¹. Every positive divisor uniquely selects an exponent for each prime, no larger than the original exponent. Choices are 3 for the power of 2, 2 for 3, 3 for 5, and 2 for 7. Multiply 3×2×3×2=36. This includes 1(all exponents 0)and 2100(all maximal); negative divisors are not included in the conventional count.
Find the larger eigenvalue of matrix[[4, 5], [2, 1]].
Answer & solution
Official answer: 6
For[[4, 5], [2, 1]], the characteristic polynomial is λ²−5λ−6=(λ−6)(λ+1). The larger eigenvalue is 6.
Eigenvalues satisfy det(A−λI)=0. Here (4−λ)(1−λ)−10=λ²−5λ−6. Factor it as(λ−6)(λ+1), giving 6 and−1. Their sum 5 matches the matrix trace and their product−6 matches its determinant, providing independent consistency checks. The larger real eigenvalue is 6.
An unordered list has n distinct elements. What is the asymptotic number of comparisons needed to find an element that is neither maximum nor minimum? AΘ(nlogn), BΘ(n), CΘ(logn), DΘ(1), assuming n≥3.
Your answer
Answer & solution
Official answer: D
Assuming n≥3, inspect any three distinct elements and return their median using at most three comparisons. It has a smaller and larger element within those three, so cannot be the global minimum or maximum. A constant positive number of comparisons suffices and is necessary, Θ(1), D.
Choose any three distinct list elements and compare them to identify their middle value. That value is larger than one chosen element and smaller than another, so it cannot be an extreme of the full list. This uses at most three comparisons regardless of n. At least some information is needed to certify a nonextreme value on arbitrary unsorted data, so the asymptotic requirement is constant. For n<3 no such value exists, which is why that natural premise is stated.
Minimum JK flip-flops for synchronous count output sequence 0, 0, 1, 1, 2, 2, 3, 3, 0, 0, …?
Answer & solution
Official answer: 3
The repeated output at each count needs an internal phase bit: the two appearances of 0 must have different next outputs eventually and cannot be the same deterministic state. The sequence has period 8, requiring eight states and at least 3 bits. A3-bit modulo 8 counter with the low bit suppressed in the output realizes it, so 3 JK flip-flops suffice.
Although only four output values appear, the repeated occurrences need different internal states. If the two consecutive zeros were the same state of an autonomous deterministic counter, they would have the same successor and could not later advance to 1. The complete repeating pattern has period 8, so at least 8 internal states and ceil(log 2 8)=3 flip-flops are required. A modulo 8 counter outputs its two upper bits, holding each value for two clocks, which attains the bound.
A read takes 50 ns on a cache miss or 5 ns on a hit. Hit rate 80%. Find mean read time in nanoseconds.
Answer & solution
Official answer: 14
The stated miss time is the entire request time, not an extra penalty. Average=0.8·5+0.2·50=14 ns.
The random read time takes only two stated values:5 with probability.8 and 50 with probability.2. Its expected value is the probability-weighted sum, .8×5+.2×50=4+10=14 ns. Do not add 5 to the miss case: the prompt already says the entire request takes 50 ns on a miss. If it had called 50 an additional miss penalty, the formula would differ.
Virtual addresses 40 bits, page size 8 KB, TLB128 entries arranged 32 sets×4 ways. No process ID in tag. Find minimum TLB tag width.
Answer & solution
Official answer: 22
Step through it (6 steps)
An8 KiB page contributes 13 offset bits, leaving 27 virtual page-number bits. The 32 TLB sets use 5 index bits. Without a process identifier, the tag uses 27−5=22 bits.
Split the virtual address into tag, set index, and page offset. An8KiB page has 213 bytes, so 13 bits select the byte. The remaining 40−13=27 bits form the virtual page number. Thirty-two sets need log 2 32=5 index bits; the four ways do not consume address bits because their tags are compared associatively. The tag therefore needs 27−5=22 bits. No process-ID bits are added because the prompt excludes them.
Assess I complement of every decidable language is decidable; II some language is in NP but undecidable; III every NP language is decidable. A II only; B III only; C I and II; D I and III.
Your answer
Answer & solution
Official answer: D
A decider halts on every input, so exchanging accept and reject decides the complement. An NP computation has a finite polynomially bounded certificate/search tree, which a deterministic machine can exhaust, so every NP language is decidable. I and III hold, II fails: D.
A language in NP has a polynomially bounded certificate verifier. A deterministic decider can enumerate every certificate up to that finite bound and run the verifier, halting with yes if one works and no otherwise. This may be exponential but still terminates, so III is true and II is false. A decider for a complement simply reverses the yes/no outcomes of a halting decider, so I is also true. Distinguish decidability from efficient decidability.
C function foo(char*a){if(*a && *a!=' '){foo(a+1); putchar(*a); }}. Output for string “ABCD EFGH”? A ABCD EFGH; B ABCD; C HGFE DCBA; D DCBA.
Your answer
Answer & solution
Official answer: D
Recursion stops at the first space without advancing beyond it. Each earlier character is printed only after its recursive call returns, reversing ABCD and producing DCBA, D.
The condition stops recursion when the pointer reaches either the terminator or the first space. Starting at A, the function calls on B, C, D and then the space, where it returns without printing. Printing occurs after each recursive call, so unwinding emits D, C, B, A. No invocation reaches EFGH. Had putchar preceded the recursive call, the first word would print forward instead.
A complete binary tree has both root subtrees already max-heaps. What lower bound describes operations to turn it into a heap? AΩ(logn), BΩ(n), CΩ(nlogn), DΩ(n²). The intended interpretation is worst-case repair work, not a lower bound for every instance.
Your answer
Answer & solution
Official answer: A
Our answer: A for worst-case heap repair
Sift the root down, swapping with the larger child until order is restored. The path can have Θ(log n) levels, and a smallest root with heap-ordered descendants realizes that worst case. Thus the intended worst-case lower bound is Ω(log n), A. It is not a per-instance lower bound: a root already exceeding its children needs only constant checking.
Only the root can violate heap order because its subtrees already satisfy it. Compare the root with its larger child and swap downward as needed; each swap moves the offending value one level. A complete n-node tree has height Θ(logn), and placing a sufficiently small value at the root can force a descent to a leaf. That is the intended worst-case lower bound matched by sift-down. If the root already dominates its children, constant work is enough, so the statement cannot mean every instance requires logarithmic work.
Similar questions4 more → · asked again: GATE 2015 Set 3, Q21, GATE 1995, Q1.17
Tree Properties & Traversals
Tap to enlarge
A binary tree has 20 leaves. How many nodes have exactly 2 children?
Answer & solution
Official answer: 19
Let n0, n1, n2 count nodes with 0, 1, 2 children. Counting edges gives n1+2n2=n0+n1+n2−1, so n2=n0−1=19, regardless of one-child nodes.
Let L, U, B count leaves, one-child nodes, and two-child nodes. The total nodes are L+U+B, and a tree has one fewer edges. Counting edges by parents instead gives U+2B. Equating U+2B=L+U+B−1 cancels U and gives B=L−1. Hence 20 leaves imply 19 two-child nodes, regardless of how many unary nodes occur.
Let F1=1 and Fn=1+sum(Fk F(n−k), k=1..n−1). Then F2=2, F3=5, F4=15, F5=1+15+10+10+15=51. Values fit int in this call.
The function’s accumulator begins at 1 on every call. Its recurrence is F(n)=1+Σ F(k)F(n−k), with F(1)=1. Compute bottom-up: F(2)=1+1=2; F(3)=1+2+2=5; F(4)=1+5+4+5=15. For n=5, the four products are 15, 10, 10, 15, and the initial 1 makes 51. Forgetting the initial 1 would incorrectly substitute a different recurrence.
An SRS should avoid discussing which? A user-interface issues; B nonfunctional requirements; C design specification; D third-party software interfaces.
Your answer
Answer & solution
Official answer: C
An SRS describes required behavior, interfaces and nonfunctional constraints, not the internal design used to implement them. Therefore design specification, C.
Requirements state what externally observable behavior and constraints must be met; design specifies how the implementation will realize them. User-interface behavior, performance or reliability constraints, and required external interfaces can all be legitimate requirements. Selecting internal modules, algorithms or architecture belongs in design rather than being unnecessarily prescribed by the SRS. Thus C is the category to avoid, not all discussion of interfaces.
Q1≤p3-SAT≤pQ2. Which is “consistent” with this? A Q1 in NP, Q2 NP-hard; B Q2 in NP, Q1 NP-hard; C both in NP; D both NP-hard. Official choice interprets the question as what is necessarily implied.
Your answer
Answer & solution
Official answer: A
Our answer: A is guaranteed; all choices can be consistent
A polynomial reduction Q1≤p3-SAT implies Q1∈NP, by composing the reduction with a 3-SAT verifier. The reduction 3-SAT≤pQ2 makes Q2 NP-hard. Thus A is necessarily implied. The literal word consistent is weaker: taking Q1=Q2=3-SAT satisfies all four options simultaneously. The key A requires reading the question as asking what is guaranteed, not merely possible.
A reduction from Q1 to 3-SAT converts a Q1 instance in polynomial time and lets an NP verifier check the resulting formula certificate, so Q1 belongs to NP. A reduction in the other direction from an NP-complete problem to Q2 shows Q2 is at least as hard as every NP problem, so it is NP-hard; it need not belong to NP. These are directional implications, not equivalence. Literal consistency is weaker than logical entailment: choosing both problems equal to 3-SAT makes every listed classification possible, which is why the source wording is explicitly qualified.
Match P lexical analysis, Q parsing, R register allocation, S expression evaluation with 1 graph colouring, 2 DFA minimization, 3 postorder traversal, 4 production tree. A P2Q3R1S4; B P2Q1R4S3; C P2Q4R1S3; D P2Q3R4S1.
Your answer
Answer & solution
Official answer: C
Lexical analysis uses minimized DFAs; parsing constructs production/parse trees; register allocation uses interference-graph coloring; expression evaluation visits operands before operators in postorder. Therefore P-2, Q-4, R-1, S-3, C.
Lexical patterns are recognized by finite automata, which can be minimized without changing recognized tokens. Parsing uses grammar productions organized into a parse tree. Register-allocation interference graphs put simultaneously live variables at adjacent vertices, so colouring assigns nonconflicting registers. To evaluate an expression tree, children must be evaluated before their operator parent, which is postorder. Combining all four gives the single complete matching C.
About AST and CFG, which is true? A successors always correspond to later source code; B neither can contain a cycle; C maximum successors can depend on input program; D each node corresponds to at most one statement.
Your answer
Answer & solution
Official answer: C
AST node arity can vary with program constructs, and CFG successor counts can vary with multiway branches such as switch. Thus C under the general AST/basic-block CFG representation. CFGs can contain loop cycles, successors need not follow source order, and a basic block can contain several statements.
An AST can represent a construct with a variable number of operands or children, while a CFG can give a multiway branch many successor blocks. Thus a fixed universal successor count does not follow from the general names. CFG loop back-edges directly disprove B, and also disprove A’s assumption that all successors appear later in source. A basic-block CFG node can contain several sequential statements, disproving D. Different fixed-arity normalized intermediate representations are possible, but are not specified here.
Basic COCOMO uses effort E, development time D, KLOC and constants a_b, b_b, c_b, d_b. Choose formulas: A E=a_b KLOC^b_b, D=c_b E^d_b; B D=a_b KLOC^b_b, E=c_b D^d_b; C E=a_b exp(b_b), D=c_b KLOC^d_b; D E=a_b exp(d_b), D=c_b KLOC^b_b. Source writes “exp” after bases to denote powers; literal exp notation is qualified in solution.
Your answer
Answer & solution
Official answer: A
Our answer: A under exponent notation convention
Basic COCOMO uses E=ab·KLOCbb and D=cb·Edb. The source writes exp(bb) and exp(db) after the bases, intending exponentiation; with that convention A. If exp literally denotes e raised to its argument, the printed formulas would not be the standard model.
COCOMO first estimates person-month effort from code size using a calibrated power law E=ab·KLOCb_b. It then estimates calendar duration from effort by D=cb·Ed_b. The constants depend on project mode. Swapping E and D changes the model: effort and elapsed months are different quantities and not interchangeable. The printed exp notation must be read as the intended exponent placement; the conventional exponential function ex would yield different equations.
A system has 6 identical resources, N processes, each claiming at most 2 resources. Which N could deadlock? A1, B2, C3, D4. Published answer D conflicts with literal total-claim premises.
Your answer
Answer & solution
Official answer: D
Our answer: None under maximum-total-claim reading; official D
With maximum claim 2, a blocked process can hold at most 1 resource. If all N≤4 processes are blocked, at most 4 of the 6 resources are held, leaving enough to satisfy at least one pending request. Hence deadlock is impossible for every listed N. Six processes each holding 1 and requesting 1 provide the first possible deadlock. Official D (N=4) conflicts with the stated 6 resources/max 2 total claim; do not silently change either premise.
If a process has obtained both resources it needs, it can finish and release them. A blocked unfinished process therefore holds at most one unit. With N≤4, even if every process holds one, at most 4 of 6 units are occupied, leaving spare units to let a process finish. In general, R≥N(maxclaim−1)+1 guarantees this progress for identical reusable units. For maxclaim 2, the first deadlock configuration is 6 processes each holding 1 and waiting for 1. None of the four offered counts realizes it; preserve the published D only as a conflicting score, not the mathematical conclusion.
Transaction transfers 50 from x to y: read(x); x:=x−50; write(x); read(y); y:=y+50; write(y). Preserving x+y is which ACID property? A atomicity; B consistency; C isolation; D durability.
Your answer
Answer & solution
Official answer: B
Preserving the invariant x+y across the transaction is consistency, B. Atomicity is all-or-nothing execution, isolation concerns concurrent visibility, and durability concerns persistence after commit.
The declared invariant defines which database states are valid. Subtracting 50 from one account and adding 50 to the other preserves the invariant x+y, so this is consistency. Atomicity would ensure both changes occur or neither does. Isolation concerns interference between concurrent transactions, and durability concerns survival after commit. The invariant is not itself a claim about failure recovery or scheduling.
A B+ tree has root separator 9; left internal separator 5 and right internal separators 13, 17. Ordered linked leaves are[1, 3], [5, 7], [9, 11], [13, 15], [17]. Count minimum index nodes fetched, including root, for keys≥7 and<15.
Answer & solution
Official answer: 5
Search from root 9 to internal 5, then leaf[5, 7]. Follow leaf links to[9, 11] and[13, 15], stopping at 15. These are root, one internal node and three leaves: 5 index nodes. Fetches of actual record pages are outside the stated index-node count.
To find the first qualifying key 7, fetch root 9, then the internal node 5, then leaf[5, 7]. Continue using leaf sibling pointers rather than returning to the root: fetch[9, 11], then[13, 15]. The final leaf must be inspected to return 13 and discover the stopping boundary 15, which is excluded. Total distinct index nodes are 2 above-leaf nodes plus 3 leaves=5. The query asks index nodes, not how many record/data pages are subsequently read.
Order UNIX listening-server calls: A listen, accept, bind, recv; B bind, listen, accept, recv; C bind, accept, listen, recv; D accept, listen, bind, recv.
Your answer
Answer & solution
Official answer: B
A listening server binds its local address, listens for connections, accepts one, then receives on the accepted connected socket. Thus bind, listen, accept, recv, B.
Binding associates the socket with its local address/port. Listening converts it into a passive connection endpoint. Accept waits for and returns a connected socket for one client. Receive then reads data on that connected socket. Calling accept before listen or before binding a specified listening address does not implement the requested server sequence. The original listening socket and the accepted connection socket have different roles.
Stop-and-wait link rate 10^6 bits/s, 1000-byte data packets, negligible ACK transmission/processing, and equal forward/back propagation. Efficiency 25%. Find one-way propagation delay in ms.
Answer & solution
Official answer: 12
Step through it (3 steps)
Transmission time is 8000/106=8 ms. Efficiency 8/(8+2Tp)=1/4 gives 8+2Tp=32, hence Tp=12 ms.
Data transmission time is 1000×8/106=.008 seconds=8 ms. One complete stop-and-wait cycle is 8+2t_pms when ACK transmission and processing are negligible. Efficiency is useful transmission time divided by cycle time, so 8/(8+2t_p)=.25. Multiply through to get 8+2t_p=32 and tp=12 ms. The two propagation traversals explain why the leftover 24 msmust be halved.
Which cookie claim is NOT correct? A a cookie is executable code capable of compromising user security; B cookies arrive via HTTP headers; C a cookie has expiry date/time; D cookies can track browsing at a site.
Your answer
Answer & solution
Official answer: A
A cookie is stored data, not executable code, so A is false. Servers set cookies through HTTP headers and they can support tracking. Persistent cookies have expiration metadata; session cookies can instead omit an explicit expiration and expire with the session, qualifying the blanket wording of C.
A cookie is an HTTP state value stored and resent by the user agent, not a script executed as a program. It can still carry sensitive identifiers or enable tracking, so “not code” does not imply “no privacy/security risk.” Set-Cookie is an HTTP response header, and subsequent Cookie headers return applicable values. The expiry statement needs a distinction: persistent cookies have an expiry/max-age, whereas session cookies may omit that field. The intended false definition is A, but C is not universal as literally worded.
Routing entries:128.96.170.0/23→interface 0; 128.96.168.0/23→interface 1; 128.96.166.0/23→R2; 128.96.164.0/22→R3; default→R4. Destinations i128.96.171.92, ii 128.96.167.151, iii 128.96.163.151, iv 128.96.165.121. Labels ainterface 0, binterface 1, cR2, dR3, eR4. A i-a, ii-c, iii-e, iv-d; B i-a, ii-d, iii-b, iv-e; C i-b, ii-c, iii-d, iv-e; D i-b, ii-c, iii-e, iv-d.
Your answer
Answer & solution
Official answer: A
Step through it (6 steps)
Longest-prefix matching sends 171.92 through 170.0/23 to interface 0; 167.151 matches 166.0/23 and 164.0/22, choosing the longer/23 to R2; 163.151 matches only default R4; 165.121 matches 164.0/22 to R3. Thus i-a, ii-c, iii-e, iv-d, A.
A /23 mask covers two adjacent third-octet values, so 170.0/23 covers 170–171 and 166.0/23 covers 166–167. A /22 mask starting 164 covers 164–167. Thus 171 uses interface 0; 167 matches both R2 and R3 but the longer/23 wins; 163 matches neither specific block and uses default R4; 165 matches only 164/22 and uses R3. Never stop at the first matching broad prefix without checking whether a more specific one exists.
UDP user data 8880 bytes, UDP header 8 bytes, IPv4 header 20 bytes, no options, Ethernet MTU1500. Find number of IPv4 fragments and final fragment offset: A6, 925; B6, 7400; C7, 1110; D7, 8880.
Your answer
Answer & solution
Official answer: C
Step through it (4 steps)
IP payload includes the 8-byte UDP header, totaling 8888 bytes. Each full fragment holds 1500−20=1480 bytes, a multiple of 8. Six hold 8880 bytes, leaving 8 bytes for a seventh. Its offset is 8880/8=1110. Thus 7 fragments and 1110, C.
Fragmentation splits the IP payload, which already includes the entire UDP header:8880+8=8888 bytes. Each fragment gets its own 20-byte IP header, leaving 1480 payload bytes within the 1500MTU.1480 is divisible by 8, so six full payloads consume 8880 bytes and an 8-byte remainder requires a seventh fragment. The final fragment begins after 8880 original-IP-payload bytes; divide by the 8-byte offset unit to get 1110. Omitting the UDP header incorrectly gives only six fragments.
At TCP bandwidth 1048560 bits/s, find RTT threshold α(in nearest integer ms)above which the unscaled receive window limits full use, and largest scaled window β. Options combine α63 or 500 ms with β65535×2^14 or 65535×2^16 bytes; correct-labelled C pairs 500 with 2^14.
Your answer
Answer & solution
Official answer: C
An unscaled window holds 65535 bytes=524280 bits. At1048560 bits/s this spans 0.5s=500 ms. The maximum scale shift is 14, giving 65535·214 bytes. Therefore C, for sustaining the stated bandwidth without receive-window limitation.
The 16-bit unscaled advertised receive window represents at most 65535 bytes. To sustain rate R over round-trip time T, the flight capacity must be at leastRT. Express the window as 524280 bits, then T=524280/1048560=.5 seconds. Larger RTT requires scaling for full bandwidth use. TCP’s maximum permitted scale shift is 14, not 16; therefore maximum represented window is 65535×214 bytes. The threshold is a receive-window capacity calculation, not a claim that congestion control always sends at that rate.
Simple checkpoint log: startT4; writeT4 y2→3; startT1; commitT4; writeT1 z5→7; checkpoint; startT2; writeT2 x1→9; commitT2; startT3; writeT3 z7→2; crash. Choose undo/redo lists: A undoT3, T1/redoT2; B same undo/redoT2, T4; C no undo/redo all four; D undoT3, T1, T4/redoT2.
Your answer
Answer & solution
Official answer: A
T4 committed before the completed checkpoint and needs no redo. T2 committed after it and must be redone. T1 and T3 are incomplete at crash and must be undone, including T1 begun before the checkpoint. Hence Undo{T3, T1}, Redo{T2}, A, under the stated simple checkpoint model.
Classify transactions by completion relative to the checkpoint and crash. T4 committed before the completed checkpoint, so the simple model treats its effects as safely checkpointed. T2 committed later and needs redo to ensure its updates appear. T1 and T3 have no commit record, so their changes must be undone, even though T1 started before the checkpoint. Starting before a checkpoint does not automatically make an unfinished transaction safe. More elaborate recovery protocols may scan different worklists, but this is the stated simple model.
R1(A, B)={(1, 5), (3, 7)}, R2(A, C)={(1, 7), (4, 9)}. Full natural outer join candidates a(1, 5, NULL), b(1, NULL, 7), c(3, NULL, 9), d(4, 7, NULL), e(1, 5, 7), f(3, 7, NULL), g(4, NULL, 9). A a, b, e, f, g not c, d; B all seven; C e, f, g not a, b; D e but not f, g.
Your answer
Answer & solution
Official answer: C
Matching A=1 yields(1, 5, 7). Unmatched left row gives(3, 7, NULL); unmatched right row gives(4, NULL, 9). Only e, f, g occur, C. Matched rows do not additionally produce null-padded variants.
Join on the common attribute A. The A=1 rows match and produce one combined row(1, 5, 7), without extra null-padded versions. The A=3 left row has no right match, so retain it as(3, 7, NULL). The A=4 right row has no left match, so retain it as(4, NULL, 9). Values from different unmatched keys cannot be combined into(3, NULL, 9)or(4, 7, NULL). Thus e, f, g are the complete result.
Free partitions 200, 400, 600, 500, 300, 250 KB. Allocate processes 357, 210, 468, 491 KB in order using bestfit. Which original partitions stay unused? A200, 300; B200, 250; C250, 300; D300, 400.
Your answer
Answer & solution
Official answer: A
Best fit assigns 357 to 400, 210 to 250, 468 to 500, and 491 to 600. Original partitions 200 and 300 remain unused, A. Splitting residual space does not alter these choices.
At each request choose the smallest remaining partition large enough.357 fits 400, 500, 600; choose 400.210 fits 250, 300, 500, 600; choose 250.468 fits 500 or 600; choose 500.491 then uses 600. The unused original partitions are 200 and 300. If partitions are split, the resulting remnants 43, 40, 32 and 109 are all too small to change these subsequent choices, so the answer remains the same.
Disk 15000 RPM, transfer 50×10^6 bytes/s. Average seek is twice average rotational delay; controller transfer time is 10 times disk transfer time. Find total average read/write time for 512 bytes in ms.
Answer & solution
Official answer: 6.1 to 6.2
Our answer: 6.11264
A revolution takes 60000/15000=4 ms, hence average rotational delay 2 ms and seek 4 ms. Disk transfer is 512/(50·106)s=0.01024 ms. Controller transfer adds ten times that, 0.1024 ms. Total 4+2+0.01024+0.1024=6.11264 ms, within 6.1 to 6.2.
One revolution takes 60/15000=.004 seconds=4 ms. A uniformly random angular position gives mean rotational waiting of half a revolution, 2 ms, and the stated seek is 4 ms. Transferring 512 bytes at 50 million bytes/s takes.01024 ms; controller work adds.1024 ms. Sum 4+2+.01024+.1024=6.11264 ms. Keep units consistent: confusing seconds with milliseconds or using a full revolution instead of an average half revolution changes the result drastically.
Physical addresses 32 bits, pages 8 KB. PTE has valid bit, dirty bit, 3 permission bits, and frame translation. Maximum page table 24 MB. Under packed entries, find virtual address width.
Answer & solution
Official answer: 36
An8 KiB page uses 13 offset bits. A physical frame number needs 32−13=19 bits, and the five status/permission bits make a 24-bit (3-byte) packed PTE. A24 MiB table then holds 223 entries, giving 23+13=36 virtual address bits. This assumes the entries are packed into 3 bytes rather than padded and the maximum table maps the full virtual page space.
An8KiB page needs 13 offset bits. From 32 physical bits, 19 remain for the physical frame number. Add 1 valid+1 dirty+3 permission bits to obtain 24 bits=3 bytes per packed entry. A24MiB table holds 24×220/3=8×220=223 entries, one per virtual page. Therefore the virtual address has 23 page-number bits plus 13 offset bits=36. Alignment that padded entries to 4 bytes would define a different organization, so packing is an explicit assumption.
Leaders split the code into blocks[1], [2], [3..9], [10..11]. Add separate entry and exit nodes: 6 nodes. Edges are entry→B1, B1→B2, B2→B3, B3→B3, B3→B4, B4→B2, B4→exit: 7. Thus B. Without explicit entry/exit nodes, counts differ; the official choice uses them.
Leaders are statement 1, start 2(target of 11), start 3(target of 9), and 10(after conditional 9). Group straight-line instructions until each branch: B1=[1], B2=[2], B3=[3…9], B4=[10…11]. B3 has a self-loop when j≤5 and a fallthrough to B4; B4 returns to B2 when i<5 and otherwise exits. Add entry→B1, B1→B2, B2→B3 and the two B4 edges: seven edges over four blocks plus entry/exit=6 nodes. State the node-count convention rather than hiding these extra nodes.
How many states does the minimal DFA for(0+1)*(10)have?
Answer & solution
Official answer: 3
Step through it (2 parts)
The language consists of binary strings ending 10. Track no matching suffix, suffix 1, and suffix 10 (accepting). On0 the transitions are q0, q2, q0; on 1 all go to q1. These three states are distinguishable: q2 accepts empty suffix, and suffix 0 distinguishes q1 from q0. Thus 3.
Track the longest suffix that is also a prefix of target 10: empty, 1, and 10. Reading 1 always leaves suffix 1. Reading 0 moves from suffix 1 to accepting 10, and otherwise to empty. These three states suffice. They are also necessary: accepting 10 differs from both nonaccepting states on ε, and suffix 1 differs from empty on continuation 0. This distinguishability proof prevents merely guessing the count from the pattern length.
Which languages are regular? L1={wxw^R:w, x∈{a, b}*, |w|, |x|>0}; L2={a^n b^m:m≠n, m, n≥0}; L3={a^p b^q c^r:p, q, r≥0}. A L1, L3; B L2 only; C L2, L3; D L3 only.
Your answer
Answer & solution
Official answer: A
L1 consists exactly of length≥3 strings with equal first/last symbols: choose the one-symbol w and nonempty interior x. Its regex is a(a+b)(a+b)*a + b(a+b)(a+b)*b, so regular. If L2 were regular, subtracting it from a*b* would make{an bn} regular, contradiction. L3=a*b*c* is regular. Thus L1, L3, A.
In L1, the first and last symbols must agree because w and its reversal surround x. Conversely, any length≥3 string with equal ends can choose a one-symbol w and the nonempty middle as x, so that simple description is exact and regular. L2 is the unequal-count complement within a*b*. If it were regular, subtracting it from regular a*b* would make the equal-count language regular, contradicting its pumping argument. L3 has the direct regular expression a*b*c*. Thus A contains exactly the regular choices.
Match algorithms 1Dijkstra, 2Floyd–Warshall, 3 binary search, 4 backtracking with i divide/conquer, ii dynamic programming, iii greedy, iv DFS, v BFS. A1i2 iii 3i4v; B1 iii 2 iii 3i4v; C1 iii 2 ii 3i4 iv; D1 iii 2 ii 3i4v.
Dijkstra commits the currently smallest tentative distance using a greedy safe-choice argument. Floyd–Warshall improves paths by allowing successively larger sets of intermediate vertices, which is dynamic programming. Binary search reduces the search interval to one half, matching divide-and-conquer here. Backtracking explores one partial-choice path before undoing it and trying another, so its traversal is depth-first rather than breadth-first. The complete matching is 1 iii, 2 ii, 3i, 4 iv.
Young tableau rows[1, 2, 5, 14], [3, 4, 6, 23], [10, 12, 18, 25], [31, ∞, ∞, ∞], increasing rows/columns. Remove 1 and move other entries so that the result remains a Young tableau, allowing unfilled entries to be marked ∞. What is the minimum number of other entries shifted? The solution below uses the conventional adjacent-hole deletion algorithm.
Answer & solution
Official answer: 5
Standard Young-tableau deletion moves the smaller right/down neighbor into the hole. Removing 1 successively shifts 2, 4, 6, 18, 25, then places infinity at(3, 4), giving five moved entries. At each step selecting a larger adjacent neighbor would violate the row/column inequality with the smaller one, so this is the forced minimum adjacent-shift deletion path.
In conventional adjacent-hole deletion, after removing 1 the hole at the top-left must receive the smaller of its right/down neighbors to preserve both monotonic directions. The forced choices are 2, then 4, then 6, then 18, then 25; the hole finally reaches a position that may become∞. Moving the larger neighbor at an earlier step would leave a smaller value below or to the right of the moved entry, violating order. This proves minimality for the conventional adjacent-hole sliding model, not by itself for arbitrary whole-table rearrangement; the source does not explicitly restrict movements to adjacent cells.
partition(a, n)moves first-element pivot to end of left part and prose says it returns left part COUNT. Skeleton sets p=partition(a, n); if(p+1==k)return a[p]; if(p+1>k)return kth_smallest(…); else return kth_smallest(…). Missing calls: A(a, p, k), (a+p+1, n−p−1, k−p−1); B(a, p, k), (a, n−p−1, k−p−1); C reverse A calls; D(a, n−p−1, k−p−1), (a, p, k). The fixed code instead requires pivot INDEX.
Your answer
Answer & solution
Official answer: A
Our answer: A only if partition returns zero-based pivot index
With pivot index p, its rank is p+1. The left recursive call uses(a, p, k); the right uses(a+p+1, n−p−1, k−p−1), giving A. However the prose explicitly says partition returns the left-part COUNT, which is p+1. The fixed skeleton then compares the wrong rank and accesses the wrong element; no option repairs that. Correct by assigning left_end=partition(a, n)−1 or changing the function contract to return the pivot index. Official A retains this index interpretation.
If p were the zero-based pivot index, its rank would be p+1. Recursing left keeps the same base pointer and k but changes length to p. Recursing right advances past the pivot byp+1 and subtracts that many elements from both length and rank. These are A’s arguments. But the prose-returned count is p+1 already; assigning it to p makes the fixed equality and a[p] off by one before either missing call runs. Thus no choice repairs the literal contract. A applies only after changing the contract or subtracting 1 on assignment.
Which hash best distributes integers i=0…2020 over buckets 0…9? A i²mod 10; B i³mod 10; C11i²mod 10; D12 imod 10.
Your answer
Answer & solution
Official answer: B
Cubing permutes decimal residues: 0, 1, 8, 7, 4, 5, 6, 3, 2, 9. Therefore each block of 10 consecutive keys places one in each bucket. Among 2021 keys bucket 0 gets 203 and every other bucket 202, optimally balanced. Squares use only six residues, 11i² is identical modulo 10, and 12i only reaches even buckets. Thus B.
Only the last decimal digit matters modulo 10. Cubes of residues 0 through 9 give 0, 1, 8, 7, 4, 5, 6, 3, 2, 9, which is a permutation. Each full ten-key block therefore hits every bucket once. The 2021 keys consist of 202 full blocks plus one extra key 0 mod 10, giving counts 203, 202, …, 202, as balanced as possible. Squaring collapses residues, 11i²has the same residues as i², and 12i≡2i can only reach even buckets.
A root-finding procedure stores successive estimates xa, xb and fb=f(xb). Each iteration computes xt, then sets xa=xb, xb=xt, fb=f(xb). Identify the secant update among the displayed alternatives. The correct candidate C is xb−(xb−xa)fb/[fb−f(xa)]. Options: A xb−(fb−f(xa))fb/(xb−xa); B xa−(fa−f(xa))fa/(xb−xa); C xb−(xb−xa)fb/(fb−f(xa)); D xa−(xb−xa)fa/(fb−f(xa)). The procedure does not define fa.
Your answer
Answer & solution
Official answer: C
The secant through(xa, f(xa)) and(xb, fb) has slope(fb−f(xa))/(xb−xa). Setting its linear approximation to zero gives xt=xb−(xb−xa)*fb/(fb−f(xa)), option C. This uses quantities defined by the procedure and requires a nonzero denominator. An equivalent formula anchored at xa would require fa=f(xa), but fa is not initialized in the displayed procedure.
The secant line through (xa, f(xa)) and (xb, fb) has slope (fb−f(xa))/(xb−xa). Its x-intercept solves 0=fb+slope·(xt−xb). Rearranging gives xt=xb−fb(xb−xa)/(fb−f(xa)), exactly C. The stored fb is the current endpoint value, so replacing its numerator by an unrelated function value would not describe this line. The denominator must be nonzero; as with ordinary secant iteration, convergence is not guaranteed for arbitrary starting points.
A global int pointer A and global stkTop coexist with stkFunc’s static int size=0, stkTop=0. Opcode −1 sets size=val; opcode 0 pushes A[stkTop++]=val when stkTop<size; the default returns A[--stkTop] if nonempty, otherwise −1. main points A at B[20], sets global stkTop=−1, sets capacity 10, pushes 5 then 10, and prints stkFunc(1, 0)+stkFunc(1, 0). Find the output.
Answer & solution
Official answer: 15
The function-local static stkTop starts at 0 and shadows the global stkTop, so assigning the global variable−1 does not affect the stack. After configuring size 10 and pushing 5 then 10, the two pops return 10 and 5 in whichever operand-evaluation order is chosen. Their sum is 15. Although the + operands have unspecified order, the two function executions are indeterminately sequenced rather than interleaving their bodies; this is not the direct unsequenced-increment case.
Track the function-local static top, not the global of the same name. Capacity initialization leaves the local top at 0. Pushing 5 writes B[0] and changes it to 1; pushing 10 writes B[1] and changes it to 2. The two calls then return 10 and 5, in whichever operand-call order is chosen. Their sum is 15. A function’s static local persists between calls, and lexical scope makes it hide the global stkTop, so setting that global to −1 does not underflow this stack.
Instructions are MUL R5, R0, R1; DIV R6, R2, R3; ADD R7, R5, R6; SUB R8, R7, R4. Pipeline stages IF, OF and WB take one cycle; PO takes 3 for MUL, 5 for DIV and 1 for ADD/SUB. PO output can forward to OF. Find total cycles under the stated single occupied PO-stage interpretation.
Answer & solution
Official answer: 13
Step through it (6 steps)
With a single occupied PO stage and the stated forwarding, MUL uses IF1, OF2, PO3–5, WB6. DIV uses PO6–10, ADD uses PO11 and SUB uses PO12; SUB writes back in cycle 13. The dependent ADD/SUB operand fetches use the forwarded results at the end of the preceding producer PO cycle. Thus total 13 cycles. This is the conventional in-order, non-internally-pipelined PO-stage model; independent or internally pipelined functional units would require more scheduling details.
Count occupied execution cycles rather than adding all independent instruction latencies. MUL starts PO in cycle 3 and occupies cycles 3–5. DIV cannot use the same PO stage until cycle 6, then occupies 6–10. ADD depends on both results and uses PO in cycle 11 after forwarding; SUB follows in cycle 12. Its WB is cycle 13. The explicit resource model matters: a separately pipelined multiplier/divider would permit a different schedule, and a non-forwarding design would add dependency stalls.
A byte-addressed machine has two-byte registers and an upward-growing stack. SP is 016E hexadecimal and PC is 5FA0 immediately before a two-word CALL that pushes PC and PSW. What is the resulting SP? A 016A; B 016C; C 0170; D 0172.
Your answer
Answer & solution
Official answer: D
CALL pushes the two-byte PC and two-byte PSW onto an upward-growing stack, adding 4 to SP. Thus hexadecimal 016E+4=0172, D. Instruction length affects the return-address value pushed, not the number of bytes added to this stack.
Each pushed register consumes two bytes. Two pushes therefore add four to the stack pointer: 0x016E+0x0004=0x0172. The two-word length of the CALL affects the saved return PC, not how many registers are pushed. Similarly, the current PC value is not an address increment to add to SP. A downward-growing stack would subtract four, but the question explicitly gives upward growth, ruling out 016A.
How many minterms remain in the minimized function [¬D + A¬B + ¬AC + A¬CD + ¬A¬CD] complemented as a whole? Here juxtaposition is AND and + is OR.
Answer & solution
Official answer: 1
Step through it (11 steps)
For the outer complement to be 1, every inner OR term must be 0. D′=0 requires D=1. With D=1 and C=0, AC′D+A′C′D=A+A′=1, impossible; hence C=1. Then A′C=0 requires A=1, and AB′=0 requires B=1. Conversely A=B=C=D=1 makes all inner terms zero. The function is exactly ABCD, one minterm.
Complementing a sum means that every product inside must be zero. The ¬D term first forces D=1. Then A¬CD and ¬A¬CD combine to ¬C, so C must be 1. With C=1, the term ¬AC forces A=1; with A=1, A¬B forces B=1. Thus exactly A=B=C=D=1 survives. Conversely that assignment makes every original summand zero, verifying the result ABCD and exactly one minterm.
For f(x)=x^(−1/3) on −1≤x≤1, assess I continuity throughout the interval, II unboundedness, and III nonzero finite area between the curve and x-axis. Options: A II only; B III only; C II and III only; D I, II and III.
Your answer
Answer & solution
Official answer: C
For real x, x−1/3=1/cuberoot(x) is undefined at 0 and unbounded near it, so I is false and II true. The geometric area is the improper integral 2*integral(0..1)x−1/3dx=2*(3/2)=3, positive and finite. Thus II and III, C; signed cancellation across zero would not be the geometric area.
At x=0 the function is undefined and its magnitude grows without bound as x approaches zero, so I is false and II is true. Geometric area uses absolute value, not cancellation of the odd function’s signed integral. On the positive half, ∫₀¹ x−1/3dx=[(3/2)x2/3]₀¹=3/2, finite despite the singularity. The negative half contributes the same area, for total 3. Therefore III is true. A divergent function value at one endpoint does not automatically make an improper integral diverge.
Start with matrix [[3, 4, 45], [7, 9, 105], [13, 2, 195]]. Add row 3 to row 2, then subtract column 3 from column 1. Find the determinant of the resulting matrix.
Answer & solution
Official answer: 0
The third column is 15 times the first: 45=15*3, 105=15*7, 195=15*13. The original determinant is therefore 0. Adding one row to another and subtracting one column from another preserve determinant, so the resulting determinant remains 0.
Before doing arithmetic, observe that the third column is exactly 15 times the first: 45=15·3, 105=15·7 and 195=15·13. Hence the original determinant is zero. Adding one row to another does not change a determinant; subtracting one column from another also preserves it. After the specified column operation, column 1 is −14 times its former value and remains proportional to column 3, so dependence remains directly visible. The requested determinant is therefore 0 without expanding nine cofactors.
Similar questions2 more → · asked again: GATE 2012, Q37
Sets, Relations & Functions
Tap to enlarge
How many onto functions exist from a four-element set to a three-element set?
Answer & solution
Official answer: 36
There are 34 total functions. Exclude functions omitting at least one codomain value by inclusion-exclusion: 34−C(3, 1)24+C(3, 2)14=81−48+3=36. Equivalently choose the repeated pair of domain elements in 6 ways, its image in 3 ways and assign the other two images in 2 ways.
There are 3⁴=81 functions in total. For each of the three codomain elements, 2⁴=16 functions omit it. Subtract 3·16, then restore the three intersections where only one codomain element is used. The result is 81−48+3=36. Equivalently, an onto function must have fiber sizes 2, 1, 1: choose the repeated pair in C(4, 2)=6 ways, its image in 3 ways and assign the remaining two images in 2 ways. Both counts give 36.
Choose uniformly from all functions from a two-element set to a twenty-element set. Find the probability that the function is one-to-one.
Answer & solution
Official answer: 0.95
The first domain element has 20 possible images and the second must choose one of the remaining 19 for injectivity. Among 20² equally likely functions, 20*19 are injective, giving 19/20=0.95.
The first domain element may map to any of 20 values. Of the 20 choices for the second, exactly 19 differ from the first. Uniform independent choices among all 20² functions therefore give 20·19/20²=19/20=0.95. The number 20·19 is a count of injective functions, not the requested probability. The uniformity over all functions is essential to this simple ratio.
Solve language equations X0=1X1, X1=0X1+1X2, X2=0X1+{ε}, where concatenation and union have their regular-expression meanings. Determine X0; option C is 1(0+10)*1. Options: A 10(0*+(10)*)1; B 10(0*+(10)*)*1; C 1(0+10)*1; D 10(0+10)*1+110(0+10)*1.
Your answer
Answer & solution
Official answer: C
Substitute X2=0X1+{epsilon} into X1=0X1+1X2 to obtain X1=(0+10)X1+1. Since the repeated-prefix language excludes epsilon, Arden’s lemma gives X1=(0+10)*1. Then X0=1X1=1(0+10)*1, C. The source’s X2 right side is 0X1, not 0X2.
Substitute X2 into X1: X1=0X1+1(0X1+ε)=(0+10)X1+1. Arden’s lemma says X=AX+B has unique solution A*B when ε is not in A. Here A={0, 10} excludes ε, giving X1=(0+10)*1. Prefixing the initial equation by 1 yields X0=1(0+10)*1. This expression includes 11 via zero repetitions and may add either 0 or 10 in the middle; using the wrong variable in the X2 equation would yield a different language.
For which residue classes of n modulo 4 can a simple self-complementary graph have n vertices? Options: A multiple of 4; B even; C odd; D n≡0 or 1 (mod 4).
Your answer
Answer & solution
Official answer: D
A simple self-complementary graph has the same number m of edges as its complement, so 2m=C(n, 2), or m=n(n−1)/4. This must be an integer, forcing n congruent 0 or 1 modulo 4. Thus D. The statement is a necessary condition; it does not assert every graph of those orders is self-complementary.
If a graph has m edges, its complement has n(n−1)/2−m. An isomorphism between them requires equal edge counts, so m=n(n−1)/4 must be an integer. Among four consecutive residue possibilities, n(n−1) is divisible by 4 exactly when n≡0 or 1 modulo 4. This establishes the necessary arithmetic restriction; the standard existence theorem for self-complementary graphs establishes these classes are attainable, rather than claiming edge integrality alone constructs a graph.
A bridge is an edge whose removal disconnects a connected graph. Which assertion is true? A a tree has no bridges; B a bridge cannot lie on a simple cycle; C every edge of a clique of size at least 3 is a bridge; D a graph with bridges cannot contain a cycle.
Your answer
Answer & solution
Official answer: B
If an edge lies on a simple cycle, the rest of that cycle still connects its endpoints after removal, so it cannot disconnect a connected graph. Therefore a bridge cannot lie on a simple cycle, B. Every edge of a nontrivial tree is a bridge, and attaching a leaf to a triangle gives a graph with both a bridge and a cycle.
If an edge lies on a cycle, removing it leaves the rest of that cycle as an alternate path between its endpoints. It therefore cannot disconnect the graph, proving B. Every edge of a nontrivial tree is a bridge, refuting A. Clique edges with at least three vertices lie in triangles, refuting C. A triangle with a single pendant edge has both a cycle and a bridge, refuting D. These examples separate a property of one edge from a property of the entire graph.
Which displayed first-order formula is a tautology? A (∀x∃y R(x, y))↔(∃y∀x R(x, y)); B (∀x[∃y R(x, y)→S(x, y)])→∀x∃y S(x, y), with the printed quantifier scope retained; C [∀x∃y(P(x, y)→R(x, y))]↔[∀x∃y(¬P(x, y)∨R(x, y))]; D (∀x∀y P(x, y))→∀x∀y P(y, x). The published key selects C alone.
Your answer
Answer & solution
Official answer: C
Our answer: C and D are valid; official C only
C follows pointwise from P→R being equivalent to NOT P OR R, preserved under the same quantifiers. But D is also valid as literally printed: from forall x forall y P(x, y), every ordered pair satisfies P, including the pair(y, x), hence forall x forall y P(y, x). Universal quantifiers commute and bound-variable names can be renamed. Thus the single-choice question has at least two valid options, C and D, although the embedded official answer marks only C. A fails for equality on a two-element domain; B can have a false existential antecedent with S everywhere false.
Material implication P→R is equivalent pointwise to ¬P∨R. Applying identical quantifiers to equivalent predicates preserves equivalence, so C is valid. D is also valid: if P holds on every ordered pair, it holds on every swapped pair; exchanging the dummy variable names changes nothing. A fails on a two-element domain with R equality: each x has a matching y but no single y matches both. For B, take R and S both always false on a nonempty domain; the implication in its premise is true while the conclusion is false, regardless of the scope ambiguity in the displayed y. Thus the single-choice key omits another valid answer D.
Which statement about code inspection and walkthrough is true? A inspection is carried out once code has been unit tested; B inspection and walkthrough are synonyms; C inspection checks adherence to coding standards; D walkthrough is usually conducted by an independent test team.
Your answer
Answer & solution
Official answer: C
Formal code inspection includes checking adherence to coding standards, C. Inspection is static and need not wait until unit testing; a walkthrough is typically author-led and is not synonymous with formal inspection or necessarily performed by an independent test team.
An inspection is a systematic static review against defect classes and a checklist, which can include naming, formatting, safety and other coding standards. It need not wait for execution or unit testing, so A imposes an unnecessary ordering. A walkthrough is usually author-led and less formal, so it is not simply a synonym or necessarily an independent-test-team activity. Therefore C is the defensible general assertion. These are software-engineering concepts retained as supplemental coverage outside the requested subject taxonomy.
Construct a full adder from two half adders and an OR gate, and a four-bit ripple-carry adder from four such full adders. Each AND/OR gate delay is 1.2 microseconds; each XOR gate delay is 2.4 microseconds. Determine propagation delay, distinguishing a lumped full-adder timing model from gate-level overlapping propagation.
Each XOR delay is 2.4 microseconds and each AND/OR delay 1.2. A full adder made from two half adders has P=A XOR B, sum=P XOR Cin and Cout=AB+P*Cin. Its worst input-to-output delay is 4.8. Multiplying this black-box delay by four gives the published 19.2. However in a gate-aware ripple circuit all four P signals are computed in parallel. The first carry settles by 4.8, and each later carry needs only AND+OR=2.4 more, giving carry delays 4.8, 7.2, 9.6, 12; the last sum also settles by 9.6+2.4=12. Thus 19.2 is a conservative lumped-stage estimate, not the tight standard gate-level propagation bound under simultaneous operand arrival. A fixed zero initial carry or different arrival assumptions can further change sensitized timing. The intended timing model is not explicit.
At gate level all bit propagate signals P=A XOR B become ready after 2.4 microseconds, and generates G=AB after 1.2. The first carry using P·Cin followed by OR is ready after 4.8. Later carries traverse only an AND and OR using already-ready P, adding 2.4 each: 7.2, 9.6 and 12.0. The last sum is also ready at 9.6+2.4=12.0. By contrast, treating each full adder as a black box with worst-case delay 4.8 and multiplying by four gives the published 19.2. These calculations use different overlap assumptions; the source/key discrepancy must remain visible rather than silently selecting a timing model.