The PYQ practice room
GATE CS 2015 Set 2
All 65 solved GATE CS 2015 Set 2 questions in exam order. Open a question, commit to an answer, and learn from the step-by-step solution. One question at a time.
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.Questions
65
Paper marks
100
Question formats
2
MCQ · NAT
Revision mode
Self-paced
No timer. Focus on understanding.
Explore the questions
General Aptitude (GA)
101
Q1MCQ1 markEasyWe ______________ our friend’s birthday and we ______________ how to make it up to him.Think it through. Then check your answer.Question
We ______________ our friend’s birthday and we ______________ how to make it up to him.Correct answer
(C) completely forgot --- just don’t know
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The correct phrase is 'completely forgot' (adverb modifying verb) and 'just don't know' (adverb modifying verb phrase). 'Don't just know' changes the meaning significantly. Therefore, option (C) is the correct choice.2
Q2MCQ1 markEasyChoose the statement where underlined word is used correctly.Think it through. Then check your answer.Question
Choose the statement where underlined word is used correctly.Correct answer
(C) All <u personnel</u are being given the day off.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The word 'personnel' refers to people employed in an organization or engaged in an organized undertaking such as military service.
(A) Should be 'personal' (private).
(B) Should be 'personal' (private).
(C) Correct usage: 'All personnel' refers to the staff/employees.
(D) Should be 'personal' (individual/private).3
Q3MCQ1 markEasyA generic term that includes various items of clothing such as a skirt, a pair of trousers and a shirt isThink it through. Then check your answer.Question
A generic term that includes various items of clothing such as a skirt, a pair of trousers and a shirt isCorrect answer
(D) apparel
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
'Apparel' is a general term for clothing or garments. Fabric, textile, and fibre are materials used to make clothing, not the clothing items themselves.4
Q4MCQ1 markEasyBased on the given statements, select the most appropriate option to solve the given question. What will be the total weight of 10 poles each of same weight? Statements: (I) One…Think it through. Then check your answer.Question
Based on the given statements, select the most appropriate option to solve the given question.What will be the total weight of 10 poles each of same weight?Statements:
(I) One fourth of the weight of a pole is 5 Kg.
(II) The total weight of these poles is 160 kg more than the total weight of two poles.Correct answer
(C) Either I or II alone is sufficient.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let be the weight of one pole.
We need to find the total weight of 10 poles, which is .Statement (I): "One fourth of the weight of a pole is 5 Kg."
This can be written as Kg.
From this, we can find Kg.
Then, the total weight of 10 poles is Kg.
So, Statement (I) alone is sufficient.Statement (II): "The total weight of these poles is 160 kg more than the total weight of two poles."
Let be the number of poles, which is 10.
Total weight of poles is .
Total weight of 2 poles is .
So, .
Given , we have .
Kg.
Then, the total weight of 10 poles is Kg.
So, Statement (II) alone is also sufficient.Since either statement alone is sufficient to find the total weight of 10 poles, the correct option is (C).The final answer is5
Q5MCQ1 markEasyConsider a function on . The value of at which the function attains a maximum, and the maximum value of the function are:Think it through. Then check your answer.Question
Consider a function on . The value of at which the function attains a maximum, and the maximum value of the function are:
Correct answer
(C) 0, 1
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The given function is defined on the interval .To find the maximum value of , we need to minimize .
The absolute value function is always non-negative, i.e., .
The minimum value of occurs at , where .Since is within the given interval , the minimum value of in this interval is at .Substituting into the function:
.This is the maximum value of because will be largest when is smallest.So, the function attains its maximum value of at .Comparing this with the given options:
(A) (x value, max value)
(B) (x value, max value)
(C) (x value, max value)
(D) (x value, max value)The correct option is (C).The final answer is6
Q6MCQ2 marksEasyOut of the following four sentences, select the most suitable sentence with respect to grammar and usage:Think it through. Then check your answer.Question
Out of the following four sentences, select the most suitable sentence with respect to grammar and usage:Correct answer
(A) Since the report lacked needed information, it was of no use to them.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's analyze each sentence for grammar and usage:(A) "Since the report lacked needed information, it was of no use to them."- "lacked needed information" is grammatically correct.
- "it was of no use to them" is a correct and idiomatic expression.
- The sentence is concise and grammatically sound.
- The phrase "no needed information" is problematic. "Information" is an uncountable noun, so it should be "no needed information" (singular agreement) or "no information needed". The use of "were" with "information" is incorrect. It should be "there was no needed information".
- "not real useful" is grammatically incorrect. "Real" is an adjective, but here an adverb is needed to modify "useful". It should be "not really useful".
- "would not had been" is grammatically incorrect. The correct conditional perfect form is "would not have been".
7
Q7MCQ2 marksMediumIn a triangle PQR, PS is the angle bisector of and . What is the length of PS? [figure]Think it through. Then check your answer.Question
In a triangle PQR, PS is the angle bisector of and . What is the length of PS?
Correct answer
(B) (qr)/((q+r))
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let . Let and .
Given that PS is the angle bisector of and .
Since PS is the angle bisector, .
Therefore, the total angle .The area of can be expressed as the sum of the areas of and .
Area() =
Area() =
Area() = So,
Multiply by 2:
We know that .
Substitute this into the equation:
Since , we can divide both sides by :
Solving for (the length of PS):
This matches option (B).The final answer is8
Q8NAT2 marksMediumIf are distinct integers such that: …Think it through. Then check your answer.Question
If are distinct integers such that:
Also a function
Also the same operations are valid with two variable functions of the form .
What is the value of ?Correct answer
8 to 8
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We need to evaluate .
First, let's calculate .
Here, .
Calculate .
Calculate .Since , we use the second condition for :
.
, so the remainder is .
Thus, .Now we need to evaluate .
Based on the definition , it implies that would mean .
So, we need to find ..
.Finally, .The value is 8.9
Q9MCQ2 marksEasyIf the list of letters, P, R, S, T, U is an arithmetic sequence, which of the following are also in arithmetic sequence? I. II. III.…Think it through. Then check your answer.Question
If the list of letters, P, R, S, T, U is an arithmetic sequence, which of the following are also in arithmetic sequence?
I.
II.
III.Correct answer
(B) I and II
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the arithmetic sequence be with common difference . So, .Statement I:
The terms are .
This can be written as .
This is an arithmetic sequence with the first term and a common difference of .
So, Statement I is TRUE.Statement II:
The terms are .
This can be written as .
This is an arithmetic sequence with the first term and a common difference of .
So, Statement II is TRUE.Statement III:
The terms are .
Let's check the differences between consecutive terms:
Difference between the first two terms: .
Difference between the second and third terms: .
For the sequence to be an arithmetic sequence, these differences must be equal:
This implies . If , then all terms are identical, and their squares would also form an arithmetic sequence (with common difference 0). However, for a general arithmetic sequence where , the squares do not form an arithmetic sequence. For example, if (common difference ), then . The differences are and , which are not equal. Thus, Statement III is generally FALSE.Based on the analysis, only statements I and II are true.The final answer is10
Q10MCQ2 marksMediumFour branches of a company are located at M, N, O, and P. M is north of N at a distance of 4 km; P is south of O at a distance of 2 km; N is southeast of O by 1 km. What is the…Think it through. Then check your answer.Question
Four branches of a company are located at M, N, O, and P. M is north of N at a distance of 4 km; P is south of O at a distance of 2 km; N is southeast of O by 1 km. What is the distance between M and P in km?Correct answer
(A) 5.34
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the position of O be at the origin .1.Position of P: P is south of O at a distance of 2 km.2.Position of N: N is southeast of O by 1 km. Southeast implies an angle of (or ) from the positive x-axis.3.Position of M: M is north of N at a distance of 4 km.4.Distance between M and P:Using the distance formula :
The distance is approximately 5.34 km.
Computer Science and Information Technology
5511
Q11MCQ1 markEasyConsider the following two statements.
: If a candidate is known to be corrupt, then he will not be elected : If a candidate is kind, he will be elected Which one of…Think it through. Then check your answer.Question
Consider the following two statements.
: If a candidate is known to be corrupt, then he will not be elected
: If a candidate is kind, he will be electedWhich one of the following statements follows from and as per sound inference rules of logic?Correct answer
(C) If a person is kind, he is not known to be corrupt
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the propositions be:
: Candidate is known to be corrupt
: Candidate will be elected
: Candidate is kindThe given statements are:
From , the contrapositive is .
Using hypothetical syllogism on () and the contrapositive of (), we get:
(If a candidate is known to be corrupt, he is not kind).The contrapositive of this derived statement () is:
(If a candidate is kind, he is not known to be corrupt).This matches option (C).12
Q12NAT1 markEasyThe cardinality of the power set of is ________.Think it through. Then check your answer.Question
The cardinality of the power set of is ________.Correct answer
2048 to 2048
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The set is .
The number of elements in the set is .The cardinality of the power set of a set with elements is .
Here, , so the cardinality is .
.13
Q13MCQ1 markEasyLet be the relation on the set of positive integers such that if and only if and are distinct and have a common divisor other than 1. Which one of the following…Think it through. Then check your answer.Question
Let be the relation on the set of positive integers such that if and only if and are distinct and have a common divisor other than 1. Which one of the following statements about is true?Correct answer
(D) R is symmetric but not reflexive and not transitive
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let be the set of positive integers.
is a relation on such that if and only if and are distinct and have a common divisor other than 1.Let's check the properties of :1.Reflexivity: A relation is reflexive if for all . According to the definition, requires and to be distinct. Therefore, is never true. So, is not reflexive.2.Symmetry: A relation is symmetric if whenever , then . If , then and are distinct and have a common divisor greater than 1. This implies and are distinct and have the same common divisor greater than 1. So, is true. Thus, is symmetric.3.Transitivity: A relation is transitive if whenever and , then . Let's test with an example.Consider , , .
: and are distinct, and have a common divisor . So, is true.
: and are distinct, and have a common divisor . So, is true.
Now, let's check : and are distinct, and have a common divisor . So, is true.
This example suggests transitivity might hold. However, we need to be careful with the 'distinct' condition. Let's try another example:
Consider , , .
: and are distinct, common divisor . True.
: and are distinct, common divisor . True.
: and are distinct, common divisor . True. Let's try to find a counterexample for transitivity.
Suppose and .
This means , .
There exists such that and .
There exists such that and . We need to check if is true, i.e., and there exists such that and . Consider , , .
: and are distinct, common divisor . True.
: and are distinct, common divisor . True.
Now, check : and are distinct. Do they have a common divisor greater than 1? No, their only common divisor is 1. So, is false.
Therefore, is not transitive.Combining these findings:- is not reflexive.
- is symmetric.
- is not transitive.
14
Q14NAT1 markEasyThe number of divisors of 2100 is _________Think it through. Then check your answer.Question
The number of divisors of 2100 is _________Correct answer
36 to 36
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the number of divisors of 2100, we first find the prime factorization of 2100.
So, If a number has a prime factorization , then the number of divisors of is given by the product of one more than each exponent:
Number of divisors For :
(for prime 2)
(for prime 3)
(for prime 5)
(for prime 7)Number of divisors
Thus, the number of divisors of 2100 is 36.15
Q15NAT1 markEasyThe larger of the two eigenvalues of the matrix is _________Think it through. Then check your answer.Question
The larger of the two eigenvalues of the matrix is _________Correct answer
6 to 6
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the given matrix be .
To find the eigenvalues, we need to solve the characteristic equation , where is the identity matrix and represents the eigenvalues.Now, calculate the determinant:
This is a quadratic equation. We can solve it by factoring or using the quadratic formula.
Factoring the quadratic equation:
We need two numbers that multiply to -6 and add to -5. These numbers are -6 and 1.
This gives us two eigenvalues:
The eigenvalues are and .
The question asks for the larger of the two eigenvalues.
Comparing and , the larger eigenvalue is .Alternatively, using the trace and determinant:
For a matrix , the characteristic equation is .
Here, .
Trace .
Determinant .
So, the characteristic equation is , which is the same as obtained above.
Solving yields and .
The larger eigenvalue is .16
Q16MCQ1 markMediumAn unordered list contains distinct elements. The number of comparisons to find an element in this list that is neither maximum nor minimum isThink it through. Then check your answer.Question
An unordered list contains distinct elements. The number of comparisons to find an element in this list that is neither maximum nor minimum isCorrect answer
(D) Θ(1)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find an element that is neither maximum nor minimum in an unordered list of distinct elements (assuming , as for such an element does not exist):1.Find the maximum element: This requires comparisons.2.Find the minimum element: This requires comparisons.Alternatively, both the maximum and minimum can be found in approximately comparisons by comparing elements in pairs.Once the maximum () and minimum () elements are identified, any other element in the list (if ) is guaranteed to be neither the maximum nor the minimum. We can then iterate through the list to find the first element such that and . This iteration takes at most comparisons.Combining these steps, the total number of comparisons will be proportional to . Therefore, the complexity is .For example, if the list is :- Find max (10) and min (1). This takes comparisons.
- Iterate: 5 is not 10 and not 1. So 5 is an element that is neither max nor min. This takes comparisons in the worst case to find such an element after max/min are known.
17
Q17NAT1 markMediumThe minimum number of JK flip-flops required to construct a synchronous counter with the count sequence isThink it through. Then check your answer.Question
The minimum number of JK flip-flops required to construct a synchronous counter with the count sequence isCorrect answer
3 to 3
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The given count sequence is .Let's list the unique states in this sequence:- The number 0 appears twice.
- The number 1 appears twice.
- The number 2 appears twice.
- The number 3 appears twice.
1.0 (first occurrence)2.0 (second occurrence)3.1 (first occurrence)4.1 (second occurrence)5.2 (first occurrence)6.2 (second occurrence)7.3 (first occurrence)8.3 (second occurrence)To represent 8 distinct states, we need flip-flops such that .
.Therefore, a minimum of 3 JK flip-flops are required to construct a synchronous counter with this sequence.18
Q18NAT1 markEasyAssume that for a certain processor, a read request takes 50 nanoseconds on a cache miss and 5 nanoseconds on a cache hit. Suppose while running a program, it was observed that…Think it through. Then check your answer.Question
Assume that for a certain processor, a read request takes 50 nanoseconds on a cache miss and 5 nanoseconds on a cache hit. Suppose while running a program, it was observed that 80% of the processor's read requests result in a cache hit. The average read access time in nanoseconds isCorrect answer
14 to 14
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given values:- Cache miss time () = 50 nanoseconds
- Cache hit time () = 5 nanoseconds
- Cache hit rate () = 80% = 0.8
- Cache miss rate () =
Substitute the given values into the formula:
Thus, the average read access time is 14 nanoseconds.19
Q19NAT1 markMediumA computer system implements a 40-bit virtual address, page size of 8 kilobytes, and a 128-entry translation look-aside buffer (TLB) organized into 32 sets each having four ways.…Think it through. Then check your answer.Question
A computer system implements a 40-bit virtual address, page size of 8 kilobytes, and a 128-entry translation look-aside buffer (TLB) organized into 32 sets each having four ways. Assume that the TLB tag does not store any process id. The minimum length of the TLB tag in bits is ________.Correct answer
22 to 22
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the length of the TLB tag, we first determine the components of the virtual address:1.Virtual Address Space: 40 bits.2.Page Size: 8 KB = bytes. This means the Page Offset is 13 bits.3.Virtual Page Number (VPN): Total Virtual Address bits - Page Offset bits = bits.4.TLB Organization:- Total entries = 128
- Associativity = 4-way set associative
- Number of sets =
- Therefore, the TLB Index requires 5 bits.
20
Q20MCQ1 markMediumConsider the following statements. I. The complement of every Turing decidable language is Turing decidable II. There exists some language which is in NP but is not Turing…Think it through. Then check your answer.Question
Consider the following statements.I. The complement of every Turing decidable language is Turing decidable
II. There exists some language which is in NP but is not Turing decidable
III. If is a language in NP, is Turing decidableWhich of the above statements is/are true?Correct answer
(D) Only I and III
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's evaluate each statement:- Statement I: Turing decidable languages (also known as Recursive languages) are closed under complementation. If a language is decidable, there exists a Turing machine that halts on all inputs. We can construct a machine for by simply swapping the accept and reject states of the machine for . Thus, Statement I is true.
- Statement II: The class NP is a subset of the class of decidable languages (). Therefore, every language in NP is decidable. There is no language in NP that is undecidable. Thus, Statement II is false.
- Statement III: As established above, . Therefore, if , then is Turing decidable. Thus, Statement III is true.
21
Q21MCQ1 markMediumConsider the following function written in the C programming language. [code] The output of the above function on input "ABCD EFGH" isThink it through. Then check your answer.Question
Consider the following function written in the C programming language.The output of the above function on input "ABCD EFGH" isvoid foo(char *a){ if ( *a && *a != ' '){ foo(a+1); putchar(*a); } }Correct answer
(D) DCBA
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The functionfoois a recursive function that processes a string character by character.1.The base case for the recursion is when*ais either the null terminator\0(evaluated as false in C) or a space character' '.2.For the input "ABCD EFGH", the function calls itself recursively for 'A', then 'B', then 'C', then 'D'.3.When the pointer reaches the space character between 'D' and 'E', the condition*a != ' 'fails, and the recursion stops.4.Becauseputchar(*a)is called after the recursive callfoo(a+1), the characters are printed in reverse order as the recursion unwinds.5.The stack of calls returns in the order:foofor 'D', then 'C', then 'B', then 'A'.6.The output is "DCBA".22
Q22MCQ1 markMediumConsider a complete binary tree where the left and the right subtrees of the root are max-heaps. The lower bound for the number of operations to convert the tree to a heap isThink it through. Then check your answer.Question
Consider a complete binary tree where the left and the right subtrees of the root are max-heaps. The lower bound for the number of operations to convert the tree to a heap isCorrect answer
(A) Ω(log n)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In a complete binary tree where both the left and right subtrees are already max-heaps, the only node that might violate the max-heap property is the root. To convert this tree into a max-heap, we perform the max-heapify operation starting at the root. The max-heapify operation compares the root with its children and swaps it with the larger child if necessary, continuing down the tree until the property is restored. In a complete binary tree with nodes, the height is . The number of comparisons and swaps in the worst case is proportional to the height of the tree. Therefore, the complexity is , and the lower bound is .23
Q23MCQ1 markEasyLet be the relation on the set of positive integers such that if and only if and are distinct and have a common divisor other than 1. Which one of the following…Think it through. Then check your answer.Question
Let be the relation on the set of positive integers such that if and only if and are distinct and have a common divisor other than 1. Which one of the following statements about is true?Correct answer
(D) R is symmetric but not reflexive and not transitive
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The relation is defined on the set of positive integers as:
and .1.Reflexivity: For a relation to be reflexive, must hold for all . However, the definition requires and to be distinct (). Since is always true, is always false. Thus, is not reflexive.2.Symmetry: For a relation to be symmetric, . If and , then and . This satisfies the condition for . Thus, is symmetric.3.Transitivity: For a relation to be transitive, and . Let's test with a counter-example:- Let .
- : and (True).
- : and (True).
- : and . Since the common divisor is not greater than 1, is False.
24
Q24NAT1 markMediumConsider the following C function. [code] The return value offun(5)is ________.Think it through. Then check your answer.Question
Consider the following C function.The return value ofint fun(int n) { int x=1, k; if (n==1) return x; for (k=1; k<n; ++k) x = x + fun(k) * fun(n-k); return x; }fun(5)is ________.Correct answer
51 to 51
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let be the value returned byfun(n).
The variable is initialized to 1.
Base case: If , return . So .Recursive step:
For to , .
Since is initialized to 1, the recurrence is:Calculate values sequentially:1.2.:
Return 2.3.:
Return 5.4.:
Return 15.5.:
Return 51.25
Q25MCQ1 markEasyA software requirements specification (SRS) document should avoid discussing which one of the following?Think it through. Then check your answer.Question
A software requirements specification (SRS) document should avoid discussing which one of the following?Correct answer
(C) Design specification
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
An SRS document describes what the software will do (functional and non-functional requirements) and its external interfaces. It should not describe how the software will be implemented (design specifications), which belongs in the Software Design Description (SDD).26
Q26MCQ1 markMediumConsider two decision problems such that reduces in polynomial time to 3-SAT and 3-SAT reduces in polynomial time to . Then which one of the following is…Think it through. Then check your answer.Question
Consider two decision problems such that reduces in polynomial time to 3-SAT and 3-SAT reduces in polynomial time to . Then which one of the following is consistent with the above statement?Correct answer
(A) Q₁ is in NP, Q₂ is NP hard.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given:1.2.From (1), since 3-SAT is in NP, must be in NP (if a problem reduces to an NP problem, it is in NP).
From (2), since 3-SAT is NP-Hard, must be NP-Hard (if an NP-Hard problem reduces to a problem, that problem is NP-Hard).Thus, is in NP and is NP-Hard.27
Q27MCQ1 markEasyMatch the following: | Group I | Group II | |---|---| | P. Lexical analysis | 1. Graph coloring | | Q. Parsing | 2. DFA minimization | | R. Register allocation | 3. Post-order…Think it through. Then check your answer.Question
Match the following:Group I Group II P. Lexical analysis 1. Graph coloring Q. Parsing 2. DFA minimization R. Register allocation 3. Post-order traversal S. Expression evaluation 4. Production tree Correct answer
(C) P-2, Q-4, R-1, S-3
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
- Lexical analysis (P) uses Finite Automata, so it relates to DFA minimization (2).
- Parsing (Q) constructs a parse tree or Production tree (4).
- Register allocation (R) is often modeled as a Graph coloring (1) problem (interference graph).
- Expression evaluation (S) is typically done using a Post-order traversal (3) of the expression tree.
28
Q28MCQ1 markMediumIn the context of abstract-syntax-tree (AST) and control-flow-graph (CFG), which one of the following is TRUE?Think it through. Then check your answer.Question
In the context of abstract-syntax-tree (AST) and control-flow-graph (CFG), which one of the following is TRUE?Correct answer
(C) The maximum number of successors of a node in an AST and a CFG depends on the input program
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's evaluate each statement:- (A) is FALSE. In a CFG, a back-edge (representing a loop) can have a successor node that corresponds to code appearing before the code for in the source program.
- (B) is FALSE. While an AST is a tree and thus acyclic, a CFG for a program with loops will contain cycles.
- (C) is TRUE. The number of successors of a node in a CFG can vary based on the program structure (e.g., a switch statement can have many successors). Similarly, in an AST, a node representing a function call or a complex expression can have a variable number of children depending on the input program.
- (D) is FALSE. In an AST, nodes often represent expressions or sub-expressions, which are parts of a statement, not necessarily a full statement. In a CFG, a basic block (node) can contain multiple statements.
29
Q29MCQ1 markEasyConsider the basic COCOMO model where is the effort applied in person-months, is the development time in chronological months, is the estimated number of delivered…Think it through. Then check your answer.Question
Consider the basic COCOMO model where is the effort applied in person-months, is the development time in chronological months, is the estimated number of delivered lines of code (in thousands) and have their usual meanings. The basic COCOMO equations are of the formCorrect answer
(A) E = a_b(KLOC)^(b_b), D = c_b(E)^(d_b)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The basic COCOMO (Constructive Cost Model) uses two primary equations to estimate effort and development time:1.Effort () is calculated as: person-months.2.Development Time () is calculated as: months.This matches the form given in option (A).30
Q30MCQ1 markEasyA system has 6 identical resources and processes competing for them. Each process can request at most 2 resources. Which one of the following values of could lead to a…Think it through. Then check your answer.Question
A system has 6 identical resources and processes competing for them. Each process can request at most 2 resources. Which one of the following values of could lead to a deadlock?Correct answer
(D) 4
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To ensure a system is deadlock-free, the total number of resources must satisfy the condition:
where is the number of processes and is the maximum demand of process .
Given:- for all
Thus, for , the system is guaranteed to be deadlock-free. A deadlock can only occur if . However, the provided options are 1, 2, 3, 4 and the marked correct answer is (D) 4. This suggests a possible discrepancy in the question's parameters as presented in the source image (e.g., if the number of resources were 3 instead of 6, then could lead to a deadlock since ). Following the provided key, we select (D).31
Q31MCQ1 markEasyConsider the following transaction involving two bank accounts x and y. [code] The constraint that the sum of the accounts x and y should remain constant is that ofThink it through. Then check your answer.Question
Consider the following transaction involving two bank accounts x and y.The constraint that the sum of the accounts x and y should remain constant is that ofread(x); x := x - 50; write(x); read(y); y:= y + 50; write(y)Correct answer
(B) Consistency
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The property that ensures the database moves from one consistent state to another is Consistency. In this case, the sum of accounts and must remain constant (conservation of money), which is a consistency constraint. If the transaction fails in the middle, Atomicity ensures rollback, but the requirement that the sum is preserved if the transaction completes successfully is Consistency.32
Q32NAT1 markMediumWith reference to the B+ tree index of order 1 shown below, the minimum number of nodes (including the Root node) that must be fetched in order to satisfy the following query:…Think it through. Then check your answer.Question
With reference to the B+ tree index of order 1 shown below, the minimum number of nodes (including the Root node) that must be fetched in order to satisfy the following query: "Get all records with a search key greater than or equal to 7 and less than 15" is ________.
Correct answer
5 to 5
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To satisfy the query for keys in range :1.Search for the starting key (7):- Fetch Root (node with 9). , go left.
- Fetch Internal Node (node with 5). , go right.
- Fetch Leaf Node (node with 5, 7). Found 7.
- Process Leaf (5, 7). Contains 7 (match).
- Follow pointer to next leaf.
- Fetch Leaf Node (node with 9, 11). Contains 9, 11 (matches, both ).
- Follow pointer to next leaf.
- Fetch Leaf Node (node with 13, 15). Contains 13 (match). Contains 15 (stop condition, ).
33
Q33MCQ1 markEasyIdentify the correct order in which a server process must invoke the function callsaccept,bind,listen, andrecvaccording to UNIX socket API.Think it through. Then check your answer.Question
Identify the correct order in which a server process must invoke the function callsaccept,bind,listen, andrecvaccording to UNIX socket API.Correct answer
(B) bind, listen, accept, recv
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The standard sequence of system calls for a TCP server is:1.socket(): Create the socket.2.bind(): Bind the socket to a local address and port.3.listen(): Put the socket in passive mode to listen for connections.4.accept(): Block and wait for an incoming connection request.5.Therefore, the correct order is bind, listen, accept, recv.recv(): Receive data from the connected client.34
Q34NAT1 markMediumA link has a transmission speed of bits/sec. It uses data packets of size 1000 bytes each. Assume that the acknowledgment has negligible transmission delay, and that its…Think it through. Then check your answer.Question
A link has a transmission speed of bits/sec. It uses data packets of size 1000 bytes each. Assume that the acknowledgment has negligible transmission delay, and that its propagation delay is the same as the data propagation delay. Also assume that the processing delays at nodes are negligible. The efficiency of the stop-and-wait protocol in this setup is exactly 25%. The value of the one-way propagation delay (in milliseconds) is ___________.Correct answer
12 to 12
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given:
Bandwidth bits/sec
Packet size bytes bits
Efficiency Transmission time sec ms.For Stop-and-Wait protocol, efficiency is given by:Substituting the values:The one-way propagation delay is 12 ms.35
Q35MCQ1 markEasyWhich one of the following statements is NOT correct about HTTP cookies?Think it through. Then check your answer.Question
Which one of the following statements is NOT correct about HTTP cookies?Correct answer
(A) A cookie is a piece of code that has the potential to compromise the security of an Internet user
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Statement (A) is incorrect because a cookie is a small piece of text data (key-value pairs) stored on the user's computer by the web browser. It is not executable code and cannot directly compromise security like a virus or malware, although it can be used for tracking which raises privacy concerns.Statement (B) is correct: Cookies are set via theSet-CookieHTTP response header.
Statement (C) is correct: Cookies can have anExpiresorMax-Ageattribute.
Statement (D) is correct: Cookies are commonly used to track user sessions and browsing patterns.36
Q36MCQ2 marksMediumConsider the following routing table at an IP router: | Network No. | Net Mask | Next Hop | |---|---|---| | 128.96.170.0 | 255.255.254.0 | Interface 0 | | 128.96.168.0 |…Think it through. Then check your answer.Question
Consider the following routing table at an IP router:For each IP address in Group I identify the correct choice of the next hop from Group II using the entries from the routing table above.Group INetwork No. Net Mask Next Hop 128.96.170.0 255.255.254.0 Interface 0 128.96.168.0 255.255.254.0 Interface 1 128.96.166.0 255.255.254.0 R2 128.96.164.0 255.255.252.0 R3 0.0.0.0 Default R4
i) 128.96.171.92
ii) 128.96.167.151
iii) 128.96.163.151
iv) 128.96.165.121Group II
a) Interface 0
b) Interface 1
c) R2
d) R3
e) R4Correct answer
(A) i-a, ii-c, iii-e, iv-d
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We perform Longest Prefix Match for each IP address.i) 128.96.171.92- 128.96.170.0/23 (Mask 255.255.254.0): 171 in binary is 10101011. Mask 254 is 11111110. 171 & 254 = 170. Matches 128.96.170.0. Next Hop: Interface 0 (a).
- 128.96.170.0/23: 167 & 254 = 166 170. No match.
- 128.96.168.0/23: 167 & 254 = 166 168. No match.
- 128.96.166.0/23: 167 & 254 = 166. Matches 128.96.166.0. Next Hop: R2.
- 128.96.164.0/22 (Mask 255.255.252.0): 167 & 252 = 164. Matches 128.96.164.0. Next Hop: R3.
- Longest prefix is /23 (R2). Next Hop: R2 (c).
- 128.96.170.0/23: 163 & 254 = 162 170. No match.
- 128.96.168.0/23: 163 & 254 = 162 168. No match.
- 128.96.166.0/23: 163 & 254 = 162 166. No match.
- 128.96.164.0/22: 163 & 252 = 160 164. No match.
- Default route matches. Next Hop: R4 (e).
- 128.96.170.0/23: 165 & 254 = 164 170. No match.
- 128.96.168.0/23: 165 & 254 = 164 168. No match.
- 128.96.166.0/23: 165 & 254 = 164 166. No match.
- 128.96.164.0/22: 165 & 252 = 164. Matches 128.96.164.0. Next Hop: R3 (d).
37
Q37MCQ2 marksMediumHost A sends a UDP datagram containing 8880 bytes of user data to host B over an Ethernet LAN. Ethernet frames may carry data up to 1500 bytes (i.e. MTU=1500 bytes). Size of UDP…Think it through. Then check your answer.Question
Host A sends a UDP datagram containing 8880 bytes of user data to host B over an Ethernet LAN. Ethernet frames may carry data up to 1500 bytes (i.e. MTU=1500 bytes). Size of UDP header is 8 bytes and size of IP header is 20 bytes. There is no option field in IP header. How many total number of IP fragments will be transmitted and what will be the contents of offset field in the last fragment?Correct answer
(C) 7 and 1110
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Total data to be transmitted at IP layer = UDP Header + User Data = bytes.
MTU = 1500 bytes. IP Header = 20 bytes.
Maximum payload per IP fragment = bytes.
Since 1480 is divisible by 8 (fragment offset scaling factor), the maximum data in a fragment is 1480 bytes.Number of fragments:
Total payload = 8888 bytes.
Fragment 1: 1480 bytes (Offset 0)
Fragment 2: 1480 bytes (Offset )
Fragment 3: 1480 bytes (Offset )
Fragment 4: 1480 bytes (Offset )
Fragment 5: 1480 bytes (Offset )
Fragment 6: 1480 bytes (Offset )
Total data sent so far = bytes.
Remaining data = bytes.
Fragment 7: 8 bytes (Offset ).Total fragments = 7.
Offset of last fragment = 1110.38
Q38MCQ2 marksMediumAssume that the bandwidth for a TCP connection is 1048560 bits /sec. Let be the value of RTT in milliseconds (rounded off to the nearest integer) after which the TCP…Think it through. Then check your answer.Question
Assume that the bandwidth for a TCP connection is 1048560 bits /sec. Let be the value of RTT in milliseconds (rounded off to the nearest integer) after which the TCP window scale option is needed. Let be the maximum possible window size with window scale option. Then the values of and areCorrect answer
(C) 500 milliseconds, 65535 × 2¹⁴
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Bandwidth bits/sec.
The TCP window scale option is needed when the Bandwidth-Delay Product (BDP) exceeds the maximum window size supported by the standard 16-bit window field ( bytes).
Max standard window bytes.
in bits = bits.We need
seconds = 500 ms.
So, milliseconds.The TCP window scale option allows the window size to be scaled by a factor of up to .
Maximum possible window size with scaling = .
So, .39
Q39MCQ2 marksMediumConsider a simple checkpointing protocol and the following set of operations in the log. (start, T4); (write, T4, y, 2, 3); (start, T1); (commit, T4); (write, T1, z, 5, 7);…Think it through. Then check your answer.Question
Consider a simple checkpointing protocol and the following set of operations in the log.(start, T4); (write, T4, y, 2, 3); (start, T1); (commit, T4); (write, T1, z, 5, 7);
(checkpoint);
(start, T2); (write, T2, x, 1, 9); (commit, T2); (start, T3), (write, T3, z, 7, 2);If a crash happens now and the system tries to recover using both undo and redo operations, what are the contents of the undo list and the redo list?Correct answer
(A) Undo: T3, T1; Redo: T2
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
At the time of the crash:- Undo List: Transactions that were active (started but not committed) at the time of the crash.
- T1 started before checkpoint and has not committed.
- T3 started after checkpoint and has not committed.
- So, Undo List = {T1, T3}.
- Redo List: Transactions that committed after the last checkpoint (or were active at checkpoint and committed later).
- T4 committed before the checkpoint, so its changes are already saved to the database. It does not need to be redone.
- T2 started after the checkpoint and committed before the crash. It needs to be redone.
- So, Redo List = {T2}.
40
Q40MCQ2 marksEasyConsider two relations with the tuples and . Assume thatR(A,B,C)is the full natural outer join of and . Consider…Think it through. Then check your answer.Question
Consider two relations with the tuples and . Assume thatR(A,B,C)is the full natural outer join of and . Consider the following tuples of the form . Which one of the following statements is correct?Correct answer
(C) R contains e, f, g but not a, b.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The full natural outer join of and on the common attribute includes:1.Matching tuples (Inner Join):- For : has and has . The join yields , which is tuple .
- For : has . There is no tuple with in . The result is padded with nulls for : , which is tuple .
- For : has . There is no tuple with in . The result is padded with nulls for : , which is tuple .
- Tuple is incorrect because has a match in , so the value must be 7, not null.
- Tuple is incorrect because has a match in , so the value must be 5, not null.
- Tuples and contain values not present in the source relations for the given keys.
41
Q41MCQ2 marksEasyConsider six memory partitions of sizes 200 KB, 400 KB, 600 KB, 500 KB, 300 KB and 250 KB, where KB refers to kilobyte. These partitions need to be allotted to four processes of…Think it through. Then check your answer.Question
Consider six memory partitions of sizes 200 KB, 400 KB, 600 KB, 500 KB, 300 KB and 250 KB, where KB refers to kilobyte. These partitions need to be allotted to four processes of sizes 357 KB, 210 KB, 468 KB and 491 KB in that order. If the best fit algorithm is used, which partitions are NOT allotted to any process?Correct answer
(A) 200 KB and 300 KB
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The Best Fit algorithm allocates the smallest free partition that is large enough to hold the process.Available Partitions: {200, 400, 600, 500, 300, 250}1.Process 1 (357 KB):- Needs . Candidates: {400, 600, 500}.
- Best fit: 400 KB.
- Remaining: {200, 600, 500, 300, 250}
- Needs . Candidates: {600, 500, 300, 250}.
- Best fit: 250 KB.
- Remaining: {200, 600, 500, 300}
- Needs . Candidates: {600, 500}.
- Best fit: 500 KB.
- Remaining: {200, 600, 300}
- Needs . Candidates: {600}.
- Best fit: 600 KB.
- Remaining: {200, 300}
42
Q42NAT2 marksHardConsider a typical disk that rotates at 15000 rotations per minute (RPM) and has a transfer rate of bytes/sec. If the average seek time of the disk is twice the…Think it through. Then check your answer.Question
Consider a typical disk that rotates at 15000 rotations per minute (RPM) and has a transfer rate of bytes/sec. If the average seek time of the disk is twice the average rotational delay and the controller's transfer time is 10 times the disk transfer time, the average time (in milliseconds) to read or write a 512-byte sector of the disk is ________.Correct answer
6.1 to 6.2
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Calculate Average Rotational Delay:- Rotational speed = 15000 RPM = rotations/sec.
- Time for one rotation = sec = 4 ms.
- Average rotational delay = rotation time = ms = 2 ms.
- Given as twice the average rotational delay.
- Average seek time = ms = 4 ms.
- Transfer rate = bytes/sec.
- Sector size = 512 bytes.
- Disk Transfer Time = sec = s s = 0.01024 ms.
- Given as 10 times the disk transfer time.
- Controller Transfer Time = ms = 0.1024 ms.
- Total Time = Seek Time + Rotational Delay + Disk Transfer Time + Controller Transfer Time
- Total Time = ms
- Total Time = ms.
43
Q43NAT2 marksHardA computer system implements 8 kilobyte pages and a 32-bit physical address space. Each page table entry contains a valid bit, a dirty bit, three permission bits, and the…Think it through. Then check your answer.Question
A computer system implements 8 kilobyte pages and a 32-bit physical address space. Each page table entry contains a valid bit, a dirty bit, three permission bits, and the translation. If the maximum size of the page table of a process is 24 megabytes, the length of the virtual address supported by the system is ____________ bits.Correct answer
36
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given:
Page size = 8 kilobytes = bytes = bytes.
Physical address space = 32-bit.
Maximum size of page table = 24 megabytes = bytes.From the page size, the page offset (or displacement) is 13 bits, since bytes.Since the physical address space is 32-bit, the physical address is 32 bits long.
Physical Address = Page Frame Number (PFN) + Page Offset
bits.Each page table entry (PTE) contains a valid bit, a dirty bit, three permission bits, and the translation (PFN).
So, the size of one PTE = bits.Maximum size of page table = 24 megabytes = bytes.
Number of PTEs in the page table =
Size of one PTE in bytes = bytes.
Number of PTEs = .The number of PTEs in the page table corresponds to the number of virtual pages.
Number of virtual pages = .Virtual Address = Virtual Page Number (VPN) + Page Offset
Number of bits for VPN = 23 bits.
Number of bits for Page Offset = 13 bits.Length of virtual address = VPN bits + Page Offset bits = bits.Thus, the length of the virtual address supported by the system is 36 bits.44
Q44MCQ2 marksMediumConsider the intermediate code given below. [code] The number of nodes and edges in the control-flow-graph constructed for the above code, respectively, areThink it through. Then check your answer.Question
Consider the intermediate code given below.(1) i = 1 (2) j = 1 (3) t1 = 5 * i (4) t2 = t1 + j (5) t3 = 4 * t2 (6) t4 = t3 (7) a[t4] = -1 (8) j = j + 1 (9) if j<=5 goto (3) (10) i=i+1 (11) if i<5 goto (2)
The number of nodes and edges in the control-flow-graph constructed for the above code, respectively, areCorrect answer
(B) 6 and 7
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To construct the Control Flow Graph (CFG), we identify basic blocks and the flow of control between them.Basic Blocks:- Block 1 (B1):
i = 1
(2)j = 1- Block 2 (B2):
t1 = 5 * i
(4)t2 = t1 + j
(5)t3 = 4 * t2
(6)t4 = t3
(7)a[t4] = -1
(8)j = j + 1
(9)if j<=5 goto (3)(Conditional jump)- Block 3 (B3):
i = i + 1
(11)if i<5 goto (2)(Conditional jump)- Block 4 (B4): (Exit block, implicitly after (11) if condition is false)
- B1:
i = 1
(2)j = 1
(Entry point, leads to B2)- B2:
t1 = 5 * i
(4)t2 = t1 + j
(5)t3 = 4 * t2
(6)t4 = t3
(7)a[t4] = -1
(8)j = j + 1
(9)if j<=5 goto (3)(This is a conditional jump. If true, goes to (3) (B2 itself). If false, falls through to (10) (B3).)- B3:
i = i + 1
(11)if i<5 goto (2)(This is a conditional jump. If true, goes to (2) (B1, but effectively the start of the outer loop, which means it should go to B2 after re-initializing j). If false, falls through to the exit.)Let's re-evaluate the basic blocks more strictly:1.Leader: (1)Block 1 (B1):i = 1
(1)i = 1
(2)j = 12.Leader: (3)Block 2 (B2):t1 = 5 * i(Target ofgoto (3)) and (2)j = 1(Target ofgoto (2)) is not a leader, but the instruction after (1) is a leader. So (2) is part of B1.
(3)t1 = 5 * i
(4)t2 = t1 + j
(5)t3 = 4 * t2
(6)t4 = t3
(7)a[t4] = -1
(8)j = j + 1
(9)if j<=5 goto (3)(This is a conditional jump. The next instruction (10) is a leader.)3.Leader: (10)Block 3 (B3):i = i + 1(Instruction immediately following a conditional jump)
(10)i = i + 1
(11)if i<5 goto (2)(This is a conditional jump. The next instruction (implicit exit) is a leader.)4.Leader: Implicit exit.Block 4 (B4): (Exit block)However, thegoto (2)in (11) means the control goes back toj = 1. This implies thatj = 1should be the start of a block, or the loop structure is such thatj = 1is re-executed. Given the structure, it's more common to consider the loop body as a block.Let's consider the loops:
Outer loop:ifrom 1 to 4 (controlled by (10) and (11))
Inner loop:jfrom 1 to 5 (controlled by (8) and (9))Revised Basic Blocks:- Node 1 (Initialization):
i = 1- Node 2 (Outer Loop Initialization):
j = 1- Node 3 (Inner Loop Body):
t1 = 5 * i
(4)t2 = t1 + j
(5)t3 = 4 * t2
(6)t4 = t3
(7)a[t4] = -1
(8)j = j + 1- Node 4 (Inner Loop Condition):
if j<=5 goto (3)- Node 5 (Outer Loop Increment):
i = i + 1- Node 6 (Outer Loop Condition):
if i<5 goto (2)Number of Nodes: 6 (as identified above)Number of Edges:1.Node 1 -> Node 2 (Afteri=1,j=1is executed)2.Node 2 -> Node 3 (Afterj=1, inner loop body starts)3.Node 3 -> Node 4 (After inner loop body, check condition)4.Node 4 -> Node 3 (Ifj<=5is true, loop back to inner loop body)5.Node 4 -> Node 5 (Ifj<=5is false, proceed to outer loop increment)6.Node 5 -> Node 6 (Afteri=i+1, check outer loop condition)7.Node 6 -> Node 2 (Ifi<5is true, loop back toj=1)8.Node 6 -> Exit (IfWait, the question asks for nodes and edges in the control-flow-graph. The standard way to construct a CFG is to identify basic blocks. A basic block is a sequence of instructions that is entered only at the beginning and exited only at the end.Let's re-identify basic blocks:Leaders:i<5is false, exit)1.(1)i = 1(First instruction)2.(3)t1 = 5 * i(Target ofgoto (3))3.(10)i = i + 1(Instruction immediately following conditional jump (9))4.(2)Let's list the basic blocks based on these leaders:j = 1(Target ofgoto (2))- Block 1 (B1):
i = 1
(2)j = 1
(Since (2) is a leader, (1) forms a block ending before (2). But (2) is also a leader. This is tricky. If (2) is a leader, then (1) is a block by itself. If (2) is a target of a jump, it's a leader. Let's assume (1) is a block, and (2) is a block because it's a target of a jump.)Let's try a different approach for basic blocks:- B1: (Entry block)
i = 1- B2: (Target of
goto (2)) - This is the start of the outer loop's iteration.
j = 1- B3: (Target of
goto (3)) - This is the start of the inner loop's iteration.
t1 = 5 * i
(4)t2 = t1 + j
(5)t3 = 4 * t2
(6)t4 = t3
(7)a[t4] = -1
(8)j = j + 1- B4: (Conditional jump from B3)
if j<=5 goto (3)- B5: (Instruction after conditional jump B4)
i = i + 1- B6: (Conditional jump from B5)
if i<5 goto (2)- B7: (Exit block - implicit)
1.B1 -> B2 (Flow from (1) to (2))2.B2 -> B3 (Flow from (2) to (3))3.B3 -> B4 (Flow from (8) to (9))4.B4 -> B3 (True branch of (9)goto (3))5.B4 -> B5 (False branch of (9)j<=5)6.B5 -> B6 (Flow from (10) to (11))7.B6 -> B2 (True branch of (11)goto (2))8.B6 -> Exit (False branch of (11)This gives 6 nodes and 8 edges if we include the exit edge. However, the options are 5/7, 6/7, 5/5, 7/8. This suggests the exit edge might not be counted, or the blocks are grouped differently.Let's re-examine the definition of nodes and edges in a CFG. Each basic block is a node. Edges represent control flow.Consider the structure:i<5)Nodes: A, B, C, D, E, F. (6 nodes)Block A: i = 1 Block B: j = 1 Loop1: Block C: t1..j+1 Block D: if j<=5 goto Loop1 Block E: i=i+1 Loop2: Block F: if i<5 goto Block B Block G: Exit
Edges:1.A -> B2.B -> C3.C -> D4.D -> C (inner loop back-edge)5.D -> E (inner loop exit)6.E -> F7.F -> B (outer loop back-edge)8.F -> G (outer loop exit)This gives 6 nodes and 8 edges. This is not an option.Let's consider if some statements are grouped differently.Often, theifstatement itself is considered a node, and its branches are edges. But here, theifis the last statement of a block.Let's try to combine blocks if possible:- Block 1:
i = 1
(2)j = 1
(This is a single entry, single exit block. It's the start of the program.)- Block 2: (Inner loop body)
t1 = 5 * i
(4)t2 = t1 + j
(5)t3 = 4 * t2
(6)t4 = t3
(7)a[t4] = -1
(8)j = j + 1- Block 3: (Inner loop condition)
if j<=5 goto (3)- Block 4: (Outer loop increment)
i = i + 1- Block 5: (Outer loop condition)
if i<5 goto (2)- Block 6: (Exit block - implicit)
1.i = 12.j = 13.t1 = 5 * i...j = j + 14.if j<=5 goto (3)5.i = i + 16.This is 6 nodes. Now for edges:if i<5 goto (2)1.Node 1 -> Node 22.Node 2 -> Node 33.Node 3 -> Node 44.Node 4 -> Node 3 (true branch of inner loop)5.Node 4 -> Node 5 (false branch of inner loop)6.Node 5 -> Node 67.Node 6 -> Node 2 (true branch of outer loop)8.Node 6 -> Exit (false branch of outer loop)This is 6 nodes and 8 edges. Still not matching option B (6 and 7).Let's re-evaluate the basic blocks. A basic block is a maximal sequence of consecutive three-address statements with the properties that:1.The first statement is a leader.2.No other statement is a leader.3.It is entered only at its first statement.4.It is exited only from its last statement.Leaders:- (1)
i = 1(First statement) - (3)
t1 = 5 * i(Target ofgoto (3)) - (10)
i = i + 1(Statement immediately following conditional jump (9)) - (2)
j = 1(Target ofgoto (2))
- B1: (1)
i = 1 - B2: (2)
j = 1 - B3:
t1 = 5 * i
(4)t2 = t1 + j
(5)t3 = 4 * t2
(6)t4 = t3
(7)a[t4] = -1
(8)j = j + 1- B4: (9)
if j<=5 goto (3) - B5: (10)
i = i + 1 - B6: (11)
if i<5 goto (2)
1.B1 -> B2 (Sequential flow)2.B2 -> B3 (Sequential flow)3.B3 -> B4 (Sequential flow)4.B4 -> B3 (True branch ofif j<=5)5.B4 -> B5 (False branch ofif j<=5)6.B5 -> B6 (Sequential flow)7.B6 -> B2 (True branch ofif i<5)8.B6 -> Exit (False branch ofThis is 6 nodes and 8 edges. Still not matching option B (6 and 7).Let's consider the possibility that the exit edge is not counted, or that theif i<5)ifstatement is not a separate block.
If we consider theifstatement as part of the preceding block, then:- B1: (1)
i = 1 - B2: (2)
j = 1 - B3:
t1 = 5 * i
(4)t2 = t1 + j
(5)t3 = 4 * t2
(6)t4 = t3
(7)a[t4] = -1
(8)j = j + 1
(9)if j<=5 goto (3)(This block now has two exits)- B4:
i = i + 1
(11)if i<5 goto (2)(This block also has two exits)This gives 4 nodes (B1, B2, B3, B4). This is too few.Let's re-examine the options. The correct option is marked as (B) 6 and 7.
This means there are 6 nodes and 7 edges.If we have 6 nodes, then the basic block identification above is correct (B1 to B6).Where could one edge be missing from the 8 edges identified?1.B1 -> B22.B2 -> B33.B3 -> B44.B4 -> B3 (inner loop back)5.B4 -> B5 (inner loop exit)6.B5 -> B67.B6 -> B2 (outer loop back)8.B6 -> Exit (outer loop exit)Perhaps the 'Exit' edge is not counted as a control flow edge in this context, or it's implicitly handled. If we don't count the edge to the implicit exit block, then we have 7 edges.So, 6 nodes (B1, B2, B3, B4, B5, B6) and 7 edges (excluding the edge to the implicit exit block).Let's verify the basic blocks again:- Block 1:
i = 1(Leader: first statement) - Block 2:
j = 1(Leader: target ofgoto (2)) - Block 3:
t1 = 5 * i...j = j + 1(Leader: target ofgoto (3). Ends before conditional jump (9)) - Block 4:
if j<=5 goto (3)(Leader: statement after conditional jump (8) is (9), but (9) is a conditional jump itself. The statement after (8) is (9), which is a leader. So (9) is a block by itself.) - Block 5:
i = i + 1(Leader: statement after conditional jump (9)) - Block 6:
if i<5 goto (2)(Leader: statement after conditional jump (10) is (11), which is a conditional jump itself. So (11) is a block by itself.)
1.(1) -> (2): B1 -> B22.(2) -> (3): B2 -> B33.(8) -> (9): B3 -> B44.(9) true: B4 -> B35.(9) false: B4 -> B56.(10) -> (11): B5 -> B67.(11) true: B6 -> B28.(11) false: B6 -> Exit (This is the edge that is likely not counted to get 7 edges)So, 6 nodes and 7 edges (excluding the final exit edge).The final answer is .45
Q45NAT2 marksMediumThe number of states in the minimal deterministic finite automaton corresponding to the regular expression is ________.Think it through. Then check your answer.Question
The number of states in the minimal deterministic finite automaton corresponding to the regular expression is ________.Correct answer
3 to 3
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The regular expression represents the set of all binary strings ending with the substring .To construct the minimal DFA:1.State (Start): Represents the state where we have not seen the pattern or the last symbol was (and not part of a ).- On input , stay in .
- On input , go to .
- On input , we complete the pattern , so go to .
- On input , we still have a suffix , so stay in .
- On input , the suffix becomes (ends in ), go to .
- On input , the suffix becomes (ends in ), go to .
- : start state
- : intermediate state
- : accepting state
46
Q46MCQ2 marksMediumWhich of the following languages is/are regular?
…Think it through. Then check your answer.Question
Which of the following languages is/are regular?Correct answer
(A) L₁ and L₃ only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Analyze : .Since , can be any non-empty string. Consider any string with length . If the first symbol of is the same as the last symbol of , we can let be that symbol (length 1), and be the substring in between. Since , the middle part has length , so . Thus, consists of all strings of length that start and end with the same symbol. This can be represented by the regular expression: . Hence, is Regular.2.Analyze : .This is a classic Context-Free Language (CFL) that is not Regular. Its complement (intersected with ) is , which requires a stack to check equality of counts. Hence, is Not Regular.3.Analyze : .This is simply the language of strings with any number of 's, followed by any number of 's, followed by any number of 's. It corresponds to the regular expression . Hence, is Regular.Therefore, and are regular.47
Q47MCQ2 marksEasyGiven below are some algorithms, and some algorithm design paradigms. | Algorithm | Design Paradigm | | :--- | :--- | | 1. Dijkstra's Shortest Path | i. Divide and Conquer | | 2.…Think it through. Then check your answer.Question
Given below are some algorithms, and some algorithm design paradigms.Match the above algorithms on the left to the corresponding design paradigm they follow.Algorithm Design Paradigm 1. Dijkstra's Shortest Path i. Divide and Conquer 2. Floyd-Warshall algorithm to compute all pairs shortest path ii. Dynamic Programming 3. Binary search on a sorted array iii. Greedy design 4. Backtracking search on a graph iv. Depth-first search v. Breadth-first search Correct answer
(C) 1-iii, 2-ii, 3-i, 4-iv
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Dijkstra's Shortest Path: Uses a Greedy approach (always picking the closest unvisited node). Matches with (iii).2.Floyd-Warshall: Uses Dynamic Programming to compute all-pairs shortest paths ( based on ). Matches with (ii).3.Binary Search: Uses Divide and Conquer (halving the search space). Matches with (i).4.Backtracking search: Typically implemented using Depth-first search (exploring one branch as deep as possible before backtracking). Matches with (iv).Correct matching: 1-iii, 2-ii, 3-i, 4-iv.48
Q48NAT2 marksHardA Young tableau is a 2D array of integers increasing from left to right and from top to bottom. Any unfilled entries are marked with , and hence there cannot be any entry…Think it through. Then check your answer.Question
A Young tableau is a 2D array of integers increasing from left to right and from top to bottom. Any unfilled entries are marked with , and hence there cannot be any entry to the right of, or below a . The following Young tableau consists of unique entries.When an element is removed from a Young tableau, other elements should be moved into its place so that the resulting table is still a Young tableau (unfilled entries may be filled in with a ). The minimum number of entries (other than 1) to be shifted, to remove 1 from the given Young tableau is ______.1 2 5 14 3 4 6 23 10 12 18 25 31 Correct answer
5 to 5
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To remove the element 1 at position , we replace it with the smaller of its neighbors (right or down) to maintain the sorted property. We repeat this process until we reach an or the boundary.1.Start at (value 1 removed). Compare neighbors and . Min is 2. Shift 2 to . Hole moves to .2.At . Compare neighbors and . Min is 4. Shift 4 to . Hole moves to .3.At . Compare neighbors and . Min is 6. Shift 6 to . Hole moves to .4.At . Compare neighbors and . Min is 18. Shift 18 to . Hole moves to .5.At . Compare neighbors and . Min is 25. Shift 25 to . Hole moves to .6.At . Neighbors are (out of bounds/) and . Both are . Fill hole with . Stop.The elements shifted are: 2, 4, 6, 18, 25. Total count = 5.49
Q49MCQ2 marksMediumSuppose you are provided with the following function declaration in the C programming language. [code] The function treats the first element ofa[]as a pivot, and rearranges…Think it through. Then check your answer.Question
Suppose you are provided with the following function declaration in the C programming language.The function treats the first element ofint partition(int a[], int n);a[]as a pivot, and rearranges the array so that all elements less than or equal to the pivot is in the left part of the array, and all elements greater than the pivot is in the right part. In addition, it moves the pivot so that the pivot is the last element of the left part. The return value is the number of elements in the left part.The following partially given function in the C programming language is used to find the smallest element in an arraya[]of sizenusing the partition function. We assume .The missing argument lists are respectivelyint kth_smallest(int a[], int n, int k) { int left_end = partition(a, n); if ( left_end+1 == k ) { return a[left_end]; } if ( left_end+1 > k ) { return kth_smallest( ___________ ); } else { return kth_smallest( ___________ ); } }Correct answer
(A) (a, left end, k) and (a+left end+1, n-left end-1, k-left end-1)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The functionpartitionreturnsleft_end, which is the number of elements in the left part (including the pivot). The pivot is placed ata[left_end]. Wait, the problem states the pivot is the last element of the left part. If the return value is the number of elements in the left part, say , then the left part occupies indices to , and the pivot is at .However, the code checksif ( left_end+1 == k ). This implies thatleft_endis treated as the index of the pivot in a 0-indexed array (where the pivot is the -th element). Ifleft_endis the index, then the number of elements in the left subarray (excluding pivot) isleft_end(indices to ).Let's assume standard QuickSelect logic wherepartitionreturns the index of the pivot.- If , the pivot is the -th element.
- If , the -th element is in the left subarray . The recursive call should be on the same array pointer
a, sizep(which isleft_end), and samek. Argument:(a, left_end, k). - If , the -th element is in the right subarray . The recursive call should be on
a + p + 1, sizen - (p + 1), and we need the -th element of this new subarray. Argument:(a + left_end + 1, n - left_end - 1, k - left_end - 1).
50
Q50MCQ2 marksMediumWhich one of the following hash functions on integers will distribute keys most uniformly over 10 buckets numbered 0 to 9 for ranging from 0 to 2020?Think it through. Then check your answer.Question
Which one of the following hash functions on integers will distribute keys most uniformly over 10 buckets numbered 0 to 9 for ranging from 0 to 2020?Correct answer
(B) h(i) = i³ mod 10
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We analyze the distribution of values modulo 10 for each function:(A) : The quadratic residues modulo 10 are . The values are never produced. This is not uniform.(B) : The cubic residues modulo 10 map as follows:
.
This is a permutation of digits . Since the input range to covers the cycle many times uniformly, this function distributes keys very uniformly.(C) . Same as (A), not uniform.(D) . This produces only even numbers . Not uniform.Therefore, (B) is the correct answer.51
Q51MCQ2 marksMediumThe secant method is used to find the root of an equation . It is started from two distinct estimates and for the root. It is an iterative procedure…Think it through. Then check your answer.Question
The secant method is used to find the root of an equation . It is started from two distinct estimates and for the root. It is an iterative procedure involving linear interpolation to a root. The iteration stops if is very small and then is the solution. The procedure is given below. Observe that there is an expression which is missing and is marked by ?. Which is the suitable expression that is to be put in place of ? so that it follows all steps of the secant method?Secant Initialize: xa, xb, epsilon, N // epsilon = convergence indicator // N = maximum no. of iterations fb = f(xb) i = 0 while (i < N and |fb| > epsilon) do i = i + 1 // update counter xt = ? // missing expression for // intermediate value xa = xb // reset xa xb = xt // reset xb fb = f(xb) // function value at new xb end while if |fb| > epsilon then // loop is terminated with i=N write "Non-convergence" else write "return xb" end ifCorrect answer
(C) x_b - (x_b - xₐ) f_b / (f_b - f(xₐ))
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The Secant method formula for the next approximation given and is:In the given code:- corresponds to the current approximation .
- corresponds to the previous approximation .
- holds .
- is the new approximation .
52
Q52NAT2 marksMediumConsider the C program below. [code] The value printed by the above program is _______.Think it through. Then check your answer.Question
Consider the C program below.The value printed by the above program is _______.#include <stdio.h> int *A, stkTop; int stkFunc(int opcode, int val) { static int size=0, stkTop=0; switch (opcode) { case -1: size = val; break; case 0: if (stkTop < size) A[stkTop++] = val; break; default: if (stkTop) return A[--stkTop]; } return -1; } int main() { int B[20]; A = B; stkTop = -1; stkFunc(-1, 10); stkFunc(0, 5); stkFunc(0, 10); printf("%d\n", stkFunc(1, 0) + stkFunc(1, 0)); }Correct answer
15 to 15
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The program implements a stack using a static arrayA(which points toBinmain) and a static variablestkTopinsidestkFunc. Key Analysis:1.Variable Shadowing: The global variablestkTopis initialized to -1 inmain, but insidestkFunc, there is astatic int stkTop=0. This local static variable shadows the global one. Thus, the stack operations use the staticstkTopstarting at 0.2.Execution Trace:stkFunc(-1, 10):opcodeis -1. Setssize = 10.stkTopremains 0.stkFunc(0, 5):opcodeis 0.stkTop(0) <size(10). Pushes 5:A[0] = 5,stkTopbecomes 1.stkFunc(0, 10):opcodeis 0.stkTop(1) <size(10). Pushes 10:A[1] = 10,stkTopbecomes 2.stkFunc(1, 0) + stkFunc(1, 0): This sums two pop operations.- First Pop:
opcodeis 1 (default case).stkTop(2) is non-zero. DecrementsstkTopto 1, returnsA[1]which is 10. - Second Pop:
opcodeis 1.stkTop(1) is non-zero. DecrementsstkTopto 0, returnsA[0]which is 5. - Sum: .
53
Q53NAT2 marksMediumConsider the sequence of machine instructions given below: [code] In the above sequence, R0 to R8 are general purpose registers. In the instructions shown, the first register…Think it through. Then check your answer.Question
Consider the sequence of machine instructions given below:MUL R5, R0, R1 DIV R6, R2, R3 ADD R7, R5, R6 SUB R8, R7, R4
In the above sequence, R0 to R8 are general purpose registers. In the instructions shown, the first register stores the result of the operation performed on the second and the third registers. This sequence of instructions is to be executed in a pipelined instruction processor with the following 4 stages: (1) Instruction Fetch and Decode (IF), (2) Operand Fetch (OF), (3) Perform Operation (PO) and (4) Write back the result (WB). The IF, OF and WB stages take 1 clock cycle each for any instruction. The PO stage takes 1 clock cycle for ADD or SUB instruction, 3 clock cycles for MUL instruction and 5 clock cycles for DIV instruction. The pipelined processor uses operand forwarding from the PO stage to the OF stage. The number of clock cycles taken for the execution of the above sequence of instructions is ___________.Correct answer
13 to 13
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The program demonstrates variable scoping rules in C, specifically the difference between global variables and static local variables.1.Global Variables:int *A, stkTop;are declared globally.2.FunctionstkFunc:-
static int size=0, stkTop=0;declares static local variables. The localstkTopshadows the globalstkTopwithin this function. Static variables retain their values between function calls. - Opcode -1: Sets
size = val. - Opcode 0: Pushes
valonto the stack (arrayA) ifstkTop < size, incrementing the localstkTop. - Default: Pops from the stack if
stkTop > 0, returningA[--stkTop].
main:-
int B[20]; A = B; stkTop = -1;initializes arrayB, points globalAtoB, and sets globalstkTopto -1. Note that setting globalstkTophas no effect onstkFuncbecausestkFuncuses its own staticstkTop.
1.stkFunc(-1, 10):-
opcodeis -1. - Static
sizebecomes 10. - Static
stkTopremains 0.
stkFunc(0, 5):-
opcodeis 0. -
stkTop(0) <size(10). -
A[0] = 5. - Static
stkTopbecomes 1.
stkFunc(0, 10):-
opcodeis 0. -
stkTop(1) <size(10). -
A[1] = 10. - Static
stkTopbecomes 2.
printf("%d\n", stkFunc(1, 0) + stkFunc(1, 0)):- Evaluate first
stkFunc(1, 0): -
opcodeis 1 (default case). -
stkTopis 2 (true). - Returns
A[--stkTop]A[1]which is 10. - Static
stkTopbecomes 1. - Evaluate second
stkFunc(1, 0): -
opcodeis 1 (default case). -
stkTopis 1 (true). - Returns
A[--stkTop]A[0]which is 5. - Static
stkTopbecomes 0. - Sum: .
-
54
Q54MCQ2 marksMediumConsider a processor with byte-addressable memory. Assume that all registers, including Program Counter (PC) and Program Status Word (PSW), are of size 2 bytes. A stack in the…Think it through. Then check your answer.Question
Consider a processor with byte-addressable memory. Assume that all registers, including Program Counter (PC) and Program Status Word (PSW), are of size 2 bytes. A stack in the main memory is implemented from memory location and it grows upward. The stack pointer (SP) points to the top element of the stack. The current value of SP is . The CALL instruction is of two words, the first word is the op-code and the second word is the starting address of the subroutine (one word = 2 bytes). The CALL instruction is implemented as follows:- Store the current value of PC in the stack
- Store the value of PSW register in the stack
- Load the starting address of the subroutine in PC
Correct answer
(D) (0172)₁₆
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Analyze the Stack Properties:- The memory is byte-addressable.
- The stack grows upward (towards higher memory addresses).
- The Stack Pointer (SP) points to the top element of the stack.
- Current SP = .
- The instruction pushes the Program Counter (PC) and the Program Status Word (PSW) onto the stack.
- Size of PC = 2 bytes.
- Size of PSW = 2 bytes.
- Total data to be pushed = bytes.
- Since the stack grows upward, pushing data increases the SP value.
- New SP = Old SP + Total bytes pushed.
- Old SP = .
- Bytes pushed = .
- Perform Hexadecimal addition:
- (which is , so carry 1, remainder 2).
- .
Therefore, the new value of the stack pointer is .55
Q55NAT2 marksMediumThe number of min-terms after minimizing the following Boolean expression is _________Think it through. Then check your answer.Question
The number of min-terms after minimizing the following Boolean expression is _________Correct answer
1 to 1
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the given expression be . We first simplify the inner expression :Group terms with :Using , we have . Also .Now we need to find the complement of :Using De Morgan's Law:Since we have a factor , the term becomes because .This expression represents a single minterm ().
Thus, the number of min-terms is 1.56
Q56MCQ2 marksMediumLet and denote the area of the region bounded by and the X-axis, when varies from to . Which of the following statements is/are TRUE? I)…Think it through. Then check your answer.Question
Let and denote the area of the region bounded by and the X-axis, when varies from to . Which of the following statements is/are TRUE?I) is continuous in
II) is not bounded in
III) is nonzero and finiteCorrect answer
(C) II and III only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Analyze the function on .I) Continuity: At , the denominator is 0, so is undefined. Thus, is discontinuous at . Statement I is FALSE.II) Boundedness: . The function is unbounded. Statement II is TRUE.III) Area : The area is given by the integral of the absolute value of the function:Due to symmetry is an even function:The area is 3, which is nonzero and finite. Statement III is TRUE.Since II and III are true, option (C) is correct.57
Q57NAT2 marksMediumPerform the following operations on the matrix
(i) Add the third row to the second row (ii) Subtract…Think it through. Then check your answer.Question
Perform the following operations on the matrix
(i) Add the third row to the second row
(ii) Subtract the third column from the first column.The determinant of the resultant matrix is _________.Correct answer
0 to 0
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the matrix be . The determinant of a matrix remains unchanged under row addition operations () and column subtraction operations (). Therefore, the determinant of the resultant matrix is equal to the determinant of the original matrix.Observe the relationship between Column 1 () and Column 3 ():
Thus, . Since two columns are linearly dependent (proportional), the determinant of the matrix is 0.58
Q58NAT2 marksMediumThe number of onto functions (surjective functions) from set to set is __________.Think it through. Then check your answer.Question
The number of onto functions (surjective functions) from set to set is __________.Correct answer
36 to 36
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Total number of functions from to is .Number of functions that are NOT onto can be calculated using the Principle of Inclusion-Exclusion:
Number of onto functions = Total functions - Not onto functions
.59
Q59NAT2 marksMediumLet and denote the sets containing 2 and 20 distinct objects respectively and denote the set of all possible functions defined from to . Let be randomly…Think it through. Then check your answer.Question
Let and denote the sets containing 2 and 20 distinct objects respectively and denote the set of all possible functions defined from to . Let be randomly chosen from . The probability of being one-to-one is __________.Correct answer
0.95 to 0.95
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Total number of functions from to is .Number of one-to-one (injective) functions is given by .The probability is .60
Q60MCQ2 marksMediumConsider the alphabet , the null/empty string and the sets of strings , and generated by the corresponding non-terminals of a regular…Think it through. Then check your answer.Question
Consider the alphabet , the null/empty string and the sets of strings , and generated by the corresponding non-terminals of a regular grammar. , and are related as follows.Which one of the following choices precisely represents the strings in ?Correct answer
(C) 1(0 + 10)^ 1
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
We have the system of equations:
1)
2)
3) Substitute (3) into (2):
Using Arden's Theorem ():
Substitute into (1):
This matches option (C).61
Q61MCQ2 marksMediumA graph is self-complementary if it is isomorphic to its complement. For all self-complementary graphs on vertices, isThink it through. Then check your answer.Question
A graph is self-complementary if it is isomorphic to its complement. For all self-complementary graphs on vertices, isCorrect answer
(D) Congruent to 0 ±od 4, or, 1 ±od 4.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
A graph is self-complementary if . This implies that the number of edges in is equal to the number of edges in .
Since (total edges in ), we have:
For the number of edges to be an integer, must be divisible by 4. Since and are consecutive integers, one is odd and the other is even. The odd number cannot contribute to the factor 4, so the even number must be divisible by 4.
Case 1: is divisible by 4 .
Case 2: is divisible by 4 .62
Q62MCQ2 marksEasyIn a connected graph, a bridge is an edge whose removal disconnects a graph. Which one of the following statements is true?Think it through. Then check your answer.Question
In a connected graph, a bridge is an edge whose removal disconnects a graph. Which one of the following statements is true?Correct answer
(B) A bridge cannot be part of a simple cycle
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Option (A) is false: In a tree, every edge is a bridge because removing any edge disconnects the tree.
Option (B) is true: An edge is a bridge if and only if it does not lie on any cycle. If it were on a cycle, removing it would leave another path between and (the rest of the cycle), so the graph would remain connected.
Option (C) is false: In a clique of size , every edge is part of a triangle (cycle), so no edge is a bridge.
Option (D) is false: A graph can have both bridges and cycles (e.g., two disjoint cycles connected by a single edge).63
Q63MCQ2 marksMediumWhich one of the following well formed formulae is a tautology?Think it through. Then check your answer.Question
Which one of the following well formed formulae is a tautology?Correct answer
(C) [∀ x ∃ y (P(x,y) arrow R(x,y))] rightarrow [∀ x ∃ y (¬ P(x,y) ∨ R(x,y))]
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Option (C) is a tautology because the implicationA → Bis logically equivalent to . Therefore, is identical to . The formula is of the form , which is always true.
Option (A) is false; is valid, but the reverse is not.
Option (D) is also valid in standard first-order logic (renaming variables in universal quantification), but (C) is the intended answer based on the definition of implication.64
Q64MCQ2 marksEasyWhich one of the following assertions concerning code inspection and code walkthrough is true?Think it through. Then check your answer.Question
Which one of the following assertions concerning code inspection and code walkthrough is true?Correct answer
(C) Adherence to coding standards is checked during code inspection
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Code inspection is a formal review process where the code is examined for defects, adherence to coding standards, and other quality issues. It is typically more rigorous than a walkthrough. (A) is incorrect because inspection can be done before unit testing.
(B) is incorrect because they are distinct processes (inspection is formal, walkthrough is informal).
(C) is correct because checking adherence to coding standards is a primary objective of code inspection.
(D) is incorrect because walkthroughs are usually peer reviews led by the author, not necessarily an independent test team.65
Q65NAT2 marksMediumA half adder is implemented with XOR and AND gates. A full adder is implemented with two half adders and one OR gate. The propagation delay of an XOR gate is twice that of an…Think it through. Then check your answer.Question
A half adder is implemented with XOR and AND gates. A full adder is implemented with two half adders and one OR gate. The propagation delay of an XOR gate is twice that of an AND/OR gate. The propagation delay of an AND/OR gate is 1.2 microseconds. A 4-bit ripple-carry binary adder is implemented by using four full adders. The total propagation time of this 4-bit binary adder in microseconds is ___________.Correct answer
19.2 to 19.2
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given:
Delay of AND gate () = Delay of OR gate () = .
Delay of XOR gate () = .A Full Adder (FA) is constructed using two Half Adders (HA) and one OR gate.
Structure of FA:1.HA1: Inputs . Outputs Sum1 () and Carry1 ().- Delay for Sum1 = .
- Delay for Carry1 = .
- The input Sum1 is available after .
- Delay for Carry2 output relative to inputs = Delay(Sum1) + .
- Carry1 is ready at .
- Carry2 is ready at .
- is ready at .