The PYQ practice room
GATE CS 2017 Set 2
All 65 solved GATE CS 2017 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)
1056
Q56MCQ1 markEasyChoose the option with words that are not synonyms.Think it through. Then check your answer.Question
Choose the option with words that are not synonyms.Correct answer
(D) yielding, resistant
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the correct option, we evaluate the relationship between the words in each pair:1.aversion, dislike: These are synonyms. Both refer to a strong feeling of distaste or opposition.2.luminous, radiant: These are synonyms. Both describe something that emits or reflects light brightly.3.plunder, loot: These are synonyms. Both mean to steal goods from a place or person, typically during a time of war or disorder.4.yielding, resistant: These are antonyms. Yielding means giving way under pressure or being submissive, while resistant means offering opposition or being unaffected by something.Since the question asks for the pair that are not synonyms, option (D) is the correct answer.57
Q57MCQ1 markEasySaturn is __________ to be seen on a clear night with the naked eye.Think it through. Then check your answer.Question
Saturn is __________ to be seen on a clear night with the naked eye.Correct answer
(B) bright enough
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In English grammar, the word enough functions as an adverb of degree and is placed after the adjective or adverb it modifies. The standard grammatical structure is:In this sentence, 'bright' is the adjective. Therefore, 'bright enough' is the correct choice.- Option (A) is incorrect because 'enough' is placed before the adjective.
- Options (C) and (D) are grammatically incorrect constructions.
58
Q58MCQ1 markEasyThere are five buildings called V, W, X, Y and Z in a row (not necessarily in that order). V is to the West of W. Z is to the East of X and the West of V. W is to the West of Y.…Think it through. Then check your answer.Question
There are five buildings called V, W, X, Y and Z in a row (not necessarily in that order). V is to the West of W. Z is to the East of X and the West of V. W is to the West of Y. Which is the building in the middle?Correct answer
(A) V
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the order of the buildings from West to East, we analyze the given constraints:1.V is to the West of W:2.Z is to the East of X and the West of V:3.W is to the West of Y:Combining these constraints into a single sequence:
The buildings in order from West to East are X, Z, V, W, and Y. The building in the middle of this row of five is V.59
Q59MCQ1 markEasyA test has twenty questions worth 100 marks in total. There are two types of questions. Multiple choice questions are worth 3 marks each and essay questions are worth 11 marks…Think it through. Then check your answer.Question
A test has twenty questions worth 100 marks in total. There are two types of questions. Multiple choice questions are worth 3 marks each and essay questions are worth 11 marks each. How many multiple choice questions does the exam have?Correct answer
(B) 15
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let be the number of multiple choice questions and be the number of essay questions.We are given two conditions:1.Total number of questions is 20:2.Total marks is 100:Substitute the expression for from the first equation into the second:
Thus, the exam has 15 multiple choice questions.60
Q60MCQ1 markEasyThere are 3 red socks, 4 green socks and 3 blue socks. You choose 2 socks. The probability that they are of the same colour isThink it through. Then check your answer.Question
There are 3 red socks, 4 green socks and 3 blue socks. You choose 2 socks. The probability that they are of the same colour isCorrect answer
(D) 4/15
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Total number of socks = .The total number of ways to choose 2 socks out of 10 is:
To have both socks of the same color, we can choose 2 red, 2 green, or 2 blue socks:- Ways to choose 2 red socks:
- Ways to choose 2 green socks:
- Ways to choose 2 blue socks:
P(E)is:61
Q61MCQ2 marksEasy“We lived in a culture that denied any merit to literary works, considering them important only when they were handmaidens to something seemingly more urgent – namely ideology.…Think it through. Then check your answer.Question
“We lived in a culture that denied any merit to literary works, considering them important only when they were handmaidens to something seemingly more urgent – namely ideology. This was a country where all gestures, even the most private, were interpreted in political terms.”The author’s belief that ideology is not as important as literature is revealed by the word:Correct answer
(B) 'seemingly'
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The word "seemingly" is used to qualify the "urgency" of ideology, suggesting that this urgency was a matter of perception or appearance rather than an objective truth. This implies that the author does not necessarily agree with the culture's dismissal of literature in favor of ideology, thereby revealing the belief that literature is not less important than ideology.62
Q62MCQ2 marksMediumThere are three boxes. One contains apples, another contains oranges and the last one contains both apples and oranges. All three are known to be incorrectly labelled. If you are…Think it through. Then check your answer.Question
There are three boxes. One contains apples, another contains oranges and the last one contains both apples and oranges. All three are known to be incorrectly labelled. If you are permitted to open just one box and then pull out and inspect only one fruit, which box would you open to determine the contents of all three boxes?Correct answer
(B) The box labelled 'Apples and Oranges'
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let the boxes be labeled 'Apples', 'Oranges', and 'Apples and Oranges'. We are told all labels are incorrect. If we open the box labeled 'Apples and Oranges', it must contain either only apples or only oranges.1.If it contains apples:- Box labeled 'Apples and Oranges' Apples
- Box labeled 'Oranges' cannot contain oranges (wrong label) and cannot contain apples (already found), so it must contain Apples and Oranges.
- Box labeled 'Apples' must contain Oranges.
- Box labeled 'Apples and Oranges' Oranges
- Box labeled 'Apples' cannot contain apples (wrong label) and cannot contain oranges (already found), so it must contain Apples and Oranges.
- Box labeled 'Oranges' must contain Apples.
63
Q63MCQ2 marksMediumis a 30 digit number starting with the digit 4 followed by the digit 7. Then the number will haveThink it through. Then check your answer.Question
is a 30 digit number starting with the digit 4 followed by the digit 7. Then the number will haveCorrect answer
(A) 90 digits
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
is a 30-digit number starting with 47. Thus, .
Taking the cube of the boundaries:
A number has digits if . Since , the number of digits in is exactly .64
Q64MCQ2 marksMediumThe number of roots of in the range isThink it through. Then check your answer.Question
The number of roots of in the range isCorrect answer
(C) 2
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let .
To find the number of roots, we analyze the behavior of the function:1.Derivative: .2.Second Derivative: . Since for all , for all . This implies that is strictly increasing.3.Critical Point: Since is strictly increasing and continuous, and while , there is exactly one root of in the interval . Let this root be . This is the global minimum of .4.Function Values:- At the minimum: . So the minimum value is negative.
- At the boundaries:
.5.Conclusion: Since is continuous, starts positive at , goes below zero at , and returns to positive at , by the Intermediate Value Theorem, there are exactly two roots in the range .65
Q65MCQ2 marksEasyAn air pressure contour line joins locations in a region having the same atmospheric pressure. The following is an air pressure contour plot of a geographical region. Contour…Think it through. Then check your answer.Question
An air pressure contour line joins locations in a region having the same atmospheric pressure. The following is an air pressure contour plot of a geographical region. Contour lines are shown at bar intervals in this plot.If the possibility of a thunderstorm is given by how fast air pressure rises or drops over a region, which of the following regions is most likely to have a thunderstorm?
Correct answer
(C) R
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The likelihood of a thunderstorm is determined by the rate of change of air pressure over a region. In a contour map, the rate of change (gradient) of the plotted variable is represented by the spacing between the contour lines:1.Steep Gradient: When contour lines are very close together, it indicates a rapid change in the variable over a short distance.2.Gentle Gradient: When contour lines are far apart, it indicates a slow change in the variable.By observing the provided contour plot:- Region has the widest spacing between lines, indicating the slowest pressure change.
- Regions and have moderate spacing.
- Region has the highest density of contour lines, meaning the lines are closest together. This indicates that the air pressure rises or drops most rapidly in region .
Computer Science and Information Technology
551
Q1MCQ1 markEasyThe representation of the value of a 16-bit unsigned integer in hexadecimal number system is BCA9. The representation of the value of in octal number system isThink it through. Then check your answer.Question
The representation of the value of a 16-bit unsigned integer in hexadecimal number system is BCA9. The representation of the value of in octal number system isCorrect answer
(D) 136251
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To convert a hexadecimal number to octal, it is easiest to first convert it to binary and then to octal.1.Hexadecimal .2.Convert each hex digit to its 4-bit binary equivalent:- B = 1011
- C = 1100
- A = 1010
- 9 = 1001
3.Group the binary digits into sets of three from right to left to convert to octal:2
Q2MCQ1 markEasyMatch the following: | | | | | |---|---|---|---| | (P) |static char var;| (i) | Sequence of memory locations to store addresses | | (Q) |m = malloc(10); m = NULL;| (ii) |…Think it through. Then check your answer.Question
Match the following:(P) static char var;(i) Sequence of memory locations to store addresses (Q) m = malloc(10); m = NULL;(ii) A variable located in data section of memory (R) char *ptr[10];(iii) Request to allocate a CPU register to store data (S) register int var1;(iv) A lost memory which cannot be freed Correct answer
(A) (P) arrow (ii), (Q) arrow (iv), (R) arrow (i), (S) arrow (iii)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Matching the C programming concepts:- (P)
static char var;: Static variables are stored in the data segment of the memory. Thus, (P) matches (ii). - (Q)
m = malloc(10); m = NULL;: This code allocates memory on the heap and then loses the reference to it by setting the pointer to NULL. This is a memory leak (lost memory that cannot be freed). Thus, (Q) matches (iv). - (R)
char *ptr[10];: This is an array of 10 pointers to characters. An array is a sequence of memory locations, and here they store addresses. Thus, (R) matches (i). - (S)
register int var1;: Theregisterkeyword is a hint to the compiler to store the variable in a CPU register for faster access. Thus, (S) matches (iii).
- (P)
3
Q3MCQ1 markEasyMatch the algorithms with their time complexities: | Algorithm | Time complexity | |---|---| | (P) Towers of Hanoi with disks | (i) | | (Q) Binary search given…Think it through. Then check your answer.Question
Match the algorithms with their time complexities:Algorithm Time complexity (P) Towers of Hanoi with disks (i) (Q) Binary search given sorted numbers (ii) (R) Heap sort given numbers at the worst case (iii) (S) Addition of two matrices (iv) Correct answer
(C) (P) arrow (iii), (Q) arrow (iv), (R) arrow (ii), (S) arrow (i)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Matching algorithms to their standard time complexities:- (P) Towers of Hanoi: The recurrence relation is , which solves to . Thus, (P) matches (iii).
- (Q) Binary search: Searching in a sorted array of size takes time. Thus, (Q) matches (iv).
- (R) Heap sort: The worst-case time complexity of heap sort is . Thus, (R) matches (ii).
- (S) Addition of two matrices: Adding two matrices requires visiting each of the elements once. Thus, the complexity is . Thus, (S) matches (i).
4
Q4MCQ1 markMediumLet be any two context-free languages and be any regular language. Then which of the following is/are CORRECT? I. is context-free. II.…Think it through. Then check your answer.Question
Let be any two context-free languages and be any regular language. Then which of the following is/are CORRECT?I. is context-free.
II. is context-free.
III. is context-free.
IV. is context-free.Correct answer
(B) I and III only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
I. Context-free languages (CFLs) are closed under union. So, is context-free. (Correct)
II. CFLs are NOT closed under complementation. So, may not be context-free. (Incorrect)
III. . Since is regular, its complement is also regular. The intersection of a CFL and a regular language is always a CFL. So, is context-free. (Correct)
IV. CFLs are NOT closed under intersection. So, may not be context-free. (Incorrect)
Therefore, only I and III are correct.5
Q5MCQ1 markEasyMatch the following according to input (from the left column) to the compiler phase (in the right column) that processes it: | Input | Compiler Phase | | :--- | :--- | | (P)…Think it through. Then check your answer.Question
Match the following according to input (from the left column) to the compiler phase (in the right column) that processes it:Input Compiler Phase (P) Syntax tree (i) Code generator (Q) Character stream (ii) Syntax analyzer (R) Intermediate representation (iii) Semantic analyzer (S) Token stream (iv) Lexical analyzer Correct answer
(C) P arrow (iii), Q arrow (iv), R arrow (i), S arrow (ii)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The compiler phases and their typical inputs are:- Lexical analyzer: Processes the character stream (Q) to produce a token stream.
- Syntax analyzer: Processes the token stream (S) to produce a syntax tree.
- Semantic analyzer: Processes the syntax tree (P) for type checking and other semantic rules.
- Code generator: Processes the intermediate representation (R) to produce target code.
6
Q6MCQ1 markEasyWhich of the following statements about parser is/are CORRECT? I. Canonical LR is more powerful than SLR. II. SLR is more powerful than LALR. III. SLR is more powerful than…Think it through. Then check your answer.Question
Which of the following statements about parser is/are CORRECT?I. Canonical LR is more powerful than SLR.
II. SLR is more powerful than LALR.
III. SLR is more powerful than Canonical LR.Correct answer
(A) I only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The power hierarchy of LR parsers is: .- Statement I: Canonical LR is more powerful than SLR. (True)
- Statement II: SLR is more powerful than LALR. (False, LALR is more powerful)
- Statement III: SLR is more powerful than Canonical LR. (False, CLR is more powerful)
7
Q7MCQ1 markEasyWhich of the following is/are shared by all the threads in a process? I. Program counter II. Stack III. Address space IV. RegistersThink it through. Then check your answer.Question
Which of the following is/are shared by all the threads in a process?I. Program counter
II. Stack
III. Address space
IV. RegistersCorrect answer
(B) III only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In a multithreaded process, threads share the process's resources, including its Address space (which contains the code, data, and heap segments) and operating system resources like open files and signals. However, each thread must maintain its own execution state to run independently. This private state includes its own Program counter, Stack, and Registers. Therefore, only (Address space) is shared among all threads.8
Q8MCQ1 markEasyIn a file allocation system, which of the following allocation scheme(s) can be used if no external fragmentation is allowed? I. Contiguous II. Linked III. IndexedThink it through. Then check your answer.Question
In a file allocation system, which of the following allocation scheme(s) can be used if no external fragmentation is allowed?I. Contiguous
II. Linked
III. IndexedCorrect answer
(D) II and III only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Contiguous Allocation: Requires a file to occupy a set of contiguous blocks on the disk. As files are created and deleted, the free disk space is broken into small pieces, leading to external fragmentation.2.Linked Allocation: Each file is a linked list of disk blocks which can be scattered anywhere on the disk. Since any free block can be used to satisfy a request, there is no external fragmentation.3.Indexed Allocation: All pointers for a file are brought together into one location called the index block. Like linked allocation, it supports non-contiguous storage and thus avoids external fragmentation.Therefore, schemes and can be used if no external fragmentation is allowed.9
Q9MCQ1 markMediumConsider the following statements about the routing protocols, Routing Information Protocol (RIP) and Open Shortest Path First (OSPF) in an IPv4 network. I: RIP uses distance…Think it through. Then check your answer.Question
Consider the following statements about the routing protocols, Routing Information Protocol (RIP) and Open Shortest Path First (OSPF) in an IPv4 network.I: RIP uses distance vector routing
II: RIP packets are sent using UDP
III: OSPF packets are sent using TCP
IV: OSPF operation is based on link-state routingWhich of the statements above are CORRECT?Correct answer
(C) I, II and IV only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
- Statement I: RIP is a distance-vector routing protocol. Correct.
- Statement II: RIP uses UDP as its transport protocol (port 520). Correct.
- Statement III: OSPF does not use TCP or UDP. It encapsulates its data directly into IP packets with protocol number 89. Incorrect.
- Statement IV: OSPF is a link-state routing protocol. Correct.
10
Q10MCQ1 markMediumIf , and , then the constants and are,…Think it through. Then check your answer.Question
If , and , then the constants and are, respectivelyCorrect answer
(C) (4)/(π) and 0
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given the function .1. Using the derivative condition:
Differentiating with respect to :Given :2. Using the integral condition:
Evaluating the integral of from 0 to 1:Given :Thus, the constants are and .11
Q11MCQ1 markMediumLet denote the statements "It is raining", "It is cold", and "It is pleasant", respectively. Then the statement "It is not raining and it is pleasant, and it is not…Think it through. Then check your answer.Question
Let denote the statements "It is raining", "It is cold", and "It is pleasant", respectively. Then the statement "It is not raining and it is pleasant, and it is not pleasant only if it is raining and it is cold" is represented byCorrect answer
(A) (¬ p ∧ r) ∧ (¬ r arrow (p ∧ q))
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The atomic statements are:- : "It is raining"
- : "It is cold"
- : "It is pleasant"
1.Part 1: "It is not raining and it is pleasant" translates to .2.Part 2: "it is not pleasant only if it is raining and it is cold".Recall the logical rule: " only if " is equivalent toA → B.
Here, is "it is not pleasant" () and is "it is raining and it is cold" ().
So, this part translates to .Combining both parts with the conjunction "and":12
Q12MCQ1 markMediumGiven the following binary number in 32-bit (single precision) IEEE-754 format: 00111110011011011010000000000000 The decimal value closest to this floating-point number isThink it through. Then check your answer.Question
Given the following binary number in 32-bit (single precision) IEEE-754 format:00111110011011011010000000000000The decimal value closest to this floating-point number isCorrect answer
(C) 2.27 × 10⁻¹
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In IEEE-754 single precision (32-bit) format:- Sign bit (): 1 bit
- Biased Exponent (): 8 bits
- Mantissa (): 23 bits
0 01111100 110110110100000000000001.Sign bit (): Positive number.2.Biased Exponent (): .Actual exponent .3.Mantissa (): The fractional part isThe significand is
4.Value:Value
Value Comparing with options:- (A)
- (B)
- (C)
- (D)
13
Q13MCQ1 markEasyA circular queue has been implemented using a singly linked list where each node consists of a value and a single pointer pointing to the next node. We maintain exactly two…Think it through. Then check your answer.Question
A circular queue has been implemented using a singly linked list where each node consists of a value and a single pointer pointing to the next node. We maintain exactly two external pointers FRONT and REAR pointing to the front node and the rear node of the queue, respectively. Which of the following statements is/are CORRECT for such a circular queue, so that insertion and deletion operations can be performed in TIME?I. Next pointer of front node points to the rear node.
II. Next pointer of rear node points to the front node.Correct answer
(B) II only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In a circular queue implemented using a singly linked list:1.Deletion is performed at the FRONT. Since we have a direct pointer to the front node, we can access it and update FRONT toFRONT->nextin time.2.Insertion is performed at the REAR. To insert a new node in time, we need to update thenextpointer of the current rear node to point to the new node and then update the REAR pointer.3.For the queue to be circular, theStatement I is incorrect because the front node'snextpointer of the last node (rear) must point back to the first node (front). This is exactly what Statement II describes.nextpointer should point to the second node in the queue, not necessarily the rear node (unless there are only two nodes). Therefore, only Statement II is correct for maintaining the circular property and allowing operations.14
Q14MCQ1 markEasyConsider the following function implemented in C: [code] The output of invokingprintxy(1, 1)isThink it through. Then check your answer.Question
Consider the following function implemented in C:The output of invokingvoid printxy(int x, int y) { int *ptr; x = 0; ptr = &x; y = *ptr; *ptr = 1; printf("%d, %d", x, y); }printxy(1, 1)isCorrect answer
(C) 1, 0
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's trace the execution ofprintxy(1, 1):1.Initial values:x = 1,y = 1.2.x = 0;->xbecomes 0.3.ptr = &x;->ptrnow stores the address ofx.4.y = *ptr;->yis assigned the value at the address stored inptr(which isx). So,y = 0.5.*ptr = 1;-> The value at the address stored inptr(which isx) is set to 1. So,x = 1.6.Thus, the output isprintf("%d, %d", x, y);-> Prints the current values ofxandy, which are1and0respectively.1, 0.15
Q15MCQ1 markMediumThe Breadth First Search (BFS) algorithm has been implemented using the queue data structure. Which one of the following is a possible order of visiting the nodes in the graph…Think it through. Then check your answer.Question
The Breadth First Search (BFS) algorithm has been implemented using the queue data structure. Which one of the following is a possible order of visiting the nodes in the graph below?
Correct answer
(D) POQNMR
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's analyze the BFS traversal for each option based on the graph's adjacency list:- M: N, R, Q
- N: M, O, Q
- O: N, P, Q
- P: O, Q
- Q: M, N, O, P, R
- R: M, Q
(B) NQMPOR: Start N. Neighbors are {M, O, Q}. Queue: [Q, M, O]. Pop Q, visit Q. Neighbors of Q are {R, P}. Queue: [M, O, R, P]. Pop M, visit M. Pop O, visit O. Pop R, visit R. Pop P, visit P. The order should be N, Q, M, O, R, P. In option B, P comes before O. Incorrect.
(C) QMNROP: Start Q. All other nodes {M, N, O, P, R} are neighbors of Q (Level 1). Any permutation of these 5 nodes after Q is a valid BFS. Q, M, N, R, O, P is valid.
(D) POQNMR: Start P. Neighbors are {O, Q}. Queue: [O, Q]. Pop O, visit O. Neighbors of O is {N}. Queue: [Q, N]. Pop Q, visit Q. Neighbors of Q are {M, R}. Queue: [N, M, R]. Pop N, visit N. Pop M, visit M. Pop R, visit R. Order: P, O, Q, N, M, R. This matches option D.Note: Both C and D are technically valid BFS orders. However, in standard competitive exams, usually only one is provided or there's a specific tie-breaking rule (like alphabetical). Re-checking the graph, Q is connected to all nodes. If we start at P, Level 1 is {O, Q} and Level 2 is {N, M, R}. Option D follows this level-by-level structure correctly.16
Q16MCQ1 markEasyIdentify the language generated by the following grammar, where is the start variable.
S → XYThink it through. Then check your answer.Question
Identify the language generated by the following grammar, where is the start variable.S → XYCorrect answer
(C) \a^m bⁿ m n, n ≥ 0\
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Analyze the production rules for :generates the language .2.Analyze the production rules for :generates the language .3.Analyze the start variable :S → XYgenerates the concatenation ofL(X)andL(Y).
.4.Let . Since , we have , which implies .Since , the language is .Therefore, the correct option is (C).17
Q17MCQ1 markMediumAn ER model of a database consists of entity types A and B. These are connected by a relationship R which does not have its own attribute. Under which one of the following…Think it through. Then check your answer.Question
An ER model of a database consists of entity types A and B. These are connected by a relationship R which does not have its own attribute. Under which one of the following conditions, can the relational table for R be merged with that of A?Correct answer
(C) Relationship R is many-to-one and the participation of A in R is total.
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To merge the relationship table with the entity table , two conditions must be met:1.Cardinality Constraint: Every entity in must be associated with at most one entity in . This means the relationship from to must be many-to-one (or one-to-one). In a many-to-one relationship from to , is on the 'many' side, meaning each relates to exactly one .2.Participation Constraint: To avoid null values in the foreign key column (which stores the primary key of in table ), every entity in must participate in the relationship. This is called total participation.Thus, if is many-to-one from to and has total participation in , the relationship can be represented by adding 's primary key as a foreign key in 's table without needing a separate table for .Therefore, the correct option is (C).18
Q18MCQ1 markHardConsider socket API on a Linux machine that supports connected UDP sockets. A connected UDP socket is a UDP socket on which connect function has already been called. Which of…Think it through. Then check your answer.Question
Consider socket API on a Linux machine that supports connected UDP sockets. A connected UDP socket is a UDP socket on which connect function has already been called. Which of the following statements is/are CORRECT?I. A connected UDP socket can be used to communicate with multiple peers simultaneously.
II. A process can successfully call connect function again for an already connected UDP socket.Correct answer
(B) II only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Statement I is INCORRECT. Whenconnect()is called on a UDP socket, the socket is restricted to sending and receiving datagrams only to/from the specific peer address specified in theconnect()call. It cannot communicate with multiple peers simultaneously using that single connected state.Statement II is CORRECT. A process can callconnect()again on an already connected UDP socket to either change the peer address or to dissolve the connection (by setting the address family toAF_UNSPEC). This is a standard feature of the BSD socket API used in Linux.Therefore, only statement II is correct, making (B) the right choice.19
Q19NAT1 markMediumConsider the following tables T1 and T2. | T1 | | | T2 | | | :---: | :---: | :---: | :---: | :---: | | P | Q | | R | S | | 2 | 2 | | 2 | 2 | | 3 | 8 | | 8 | 3 | |…Think it through. Then check your answer.Question
Consider the following tables T1 and T2.In table T1, P is the primary key and Q is the foreign key referencing R in table T2 with on-delete cascade and on-update cascade. In table T2, R is the primary key and S is the foreign key referencing P in table T1 with on-delete set NULL and on-update cascade. In order to delete record from table T1, the number of additional records that need to be deleted from table T1 is ________.T1 T2 P Q R S 2 2 2 2 3 8 8 3 7 3 3 2 5 8 9 7 6 9 5 7 8 5 7 2 9 8 Correct answer
0 to 0
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Deleting record from table T1 means the primary key value is removed.2.Table T2 has a foreign key S referencing T1.**P** with the action on-delete set NULL. The record in T2 with is . Upon deletion of in T1, this record in T2 is updated to .3.No record is deleted from table T2.4.Table T1 has a foreign key Q referencing T2.**R** with the action on-delete cascade. Since no record was deleted from T2, no cascading deletions are triggered in T1.5.Therefore, no additional records are deleted from T1. The answer is 0.20
Q20NAT1 markMediumThe maximum number of IPv4 router addresses that can be listed in the record route (RR) option field of an IPv4 header is ________.Think it through. Then check your answer.Question
The maximum number of IPv4 router addresses that can be listed in the record route (RR) option field of an IPv4 header is ________.Correct answer
9 to 9
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.The maximum size of the IPv4 header is 60 bytes.2.The base IPv4 header is 20 bytes, leaving a maximum of 40 bytes for the options field.3.The Record Route (RR) option consists of a 1-byte type field, a 1-byte length field, and a 1-byte pointer field, totaling 3 bytes of overhead.4.The remaining space for IP addresses is bytes.5.Each IPv4 address occupies 4 bytes.6.The maximum number of addresses is .21
Q21NAT1 markMediumConsider the set under the partial ordering…Think it through. Then check your answer.Question
Consider the set under the partial ordering
.
The Hasse diagram of the partial order is shown below.The minimum number of ordered pairs that need to be added to to make a lattice is ______.
Correct answer
0.01 to 0.01
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
A lattice is a partially ordered set (poset) in which every pair of elements has a unique least upper bound (LUB) and a unique greatest lower bound (GLB).Let's analyze the given poset with and the relation :1.Bottom and Top Elements: is the bottom element ( for all ) and is the top element ( for all ).2.Incomparable Pairs: The pairs of elements that are not related are and .3.Check for LUB and GLB:- For the pair :
- Upper bounds: (since and ). The least upper bound is .
- Lower bounds: (since and ). The greatest lower bound is .
- For the pair :
- Upper bounds: (since and ). The least upper bound is .
- Lower bounds: (since and ). The greatest lower bound is .
22
Q22NAT1 markEasyLet and be two matrices.…Think it through. Then check your answer.Question
Let and be two matrices.Then the rank of is ________________.Correct answer
2 to 2
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
First, we calculate the sum of the matrices and :Let . We find the rank of by checking its determinant:Since , the rank of is less than 3.
Now, we check for a non-zero minor. For example, consider the minor formed by the first two rows and first two columns:Since there exists at least one non-zero minor, the rank of is 2.23
Q23NAT1 markMediumis an undirected graph with vertices and 25 edges such that each vertex of has degree at least 3. Then the maximum possible value of is ______.Think it through. Then check your answer.Question
is an undirected graph with vertices and 25 edges such that each vertex of has degree at least 3. Then the maximum possible value of is ______.Correct answer
16 to 16
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
According to the Handshaking Lemma, the sum of the degrees of all vertices in an undirected graph is equal to twice the number of edges:Given that the number of edges , we have:It is also given that each vertex has a degree of at least 3, i.e., for all . Summing this over all vertices gives:Substituting the value from the Handshaking Lemma:Since the number of vertices must be an integer, the maximum possible value of is 16.24
Q24NAT1 markEasyConsider a quadratic equation with coefficients in a base . The solutions of this equation in the same base are and . Then b = ________.Think it through. Then check your answer.Question
Consider a quadratic equation with coefficients in a base . The solutions of this equation in the same base are and . Then b = ________.Correct answer
8 to 8
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given the quadratic equation with roots and in base .In any base , for a quadratic equation , the sum of the roots is given by and the product of the roots is given by .1.Sum of roots:Sum
From the equation, sum
Equating the two:2.Product of roots:Product
From the equation, product
Equating the two: Both conditions yield . Additionally, for the base to be valid, all digits in the equation (1, 3, 6) and the roots (5, 6) must be strictly less than the base . Since , is a valid base.Therefore, the value of is 8.25
Q25NAT1 markHardThe minimum possible number of states of a deterministic finite automaton that accepts the regular language…Think it through. Then check your answer.Question
The minimum possible number of states of a deterministic finite automaton that accepts the regular language is ________.Correct answer
8 to 8
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The language consists of strings over where the 3rd character is 'a' and the total length of the string is at least 6 ().The states of the minimal DFA represent the progress towards meeting these conditions:1.: Start state (length 0)2.: After 1 character (length 1)3.: After 2 characters (length 2)4.: After 3 characters, where the 3rd character is 'a' (length 3)5.: After 4 characters, where the 3rd character was 'a' (length 4)6.: After 5 characters, where the 3rd character was 'a' (length 5)7.: After 6 or more characters, where the 3rd character was 'a' (length ) — Final State8.: Trap state for strings where the 3rd character is 'b'.Transitions:26
Q26MCQ2 marksMediumP and Q are considering to apply for a job. The probability that P applies for the job is , the probability that P applies for the job given that Q applies for the…Think it through. Then check your answer.Question
P and Q are considering to apply for a job. The probability that P applies for the job is , the probability that P applies for the job given that Q applies for the job is , and the probability that Q applies for the job given that P applies for the job is . Then the probability that P does not apply for the job given that Q does not apply for the job isCorrect answer
(A) (4)/(5)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let be the event that P applies, and be the event that Q applies.
Given:
We need to find .
Using De Morgan's Law:
.Thus, the correct option is (A).27
Q27MCQ2 marksMediumIf are Boolean variables, then which one of the following is INCORRECT?Think it through. Then check your answer.Question
If are Boolean variables, then which one of the following is INCORRECT?Correct answer
(C) (wx(y + xz) + wx)y = xy
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let's evaluate each option:
(A) . (Correct)
(B) . (Correct)
(C) . This is , which is not equal to for all values (e.g., if , LHS=0 while RHS=1). (INCORRECT)
(D) . (Correct)Therefore, (C) is the incorrect statement.28
Q28MCQ2 marksMediumGiven , where represents the don't-care condition in Karnaugh maps. Which of the following is a minimum…Think it through. Then check your answer.Question
Given , where represents the don't-care condition in Karnaugh maps. Which of the following is a minimum product-of-sums (POS) form of ?Correct answer
(A) f = (w + z)(x + z)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the minimum POS form, we group the zeros (Maxterms) and don't-cares in the K-map.Minterms:
Don't-cares:
Maxterms (0s): K-map for (grouping 0s):Grouping 0s:00 01 11 10 00 1 1 1 1 01 0 X 1 X 11 0 0 X 0 10 1 0 X 1 1.Group 1: Maxterms 4, 12, 14 and Don't-cares 6. This covers . In POS form, this is .2.Group 2: Maxterms 9, 13 and Don't-cares 11, 15. This covers . In POS form, this is .Thus, the minimum POS form is .29
Q29MCQ2 marksMediumIn a two-level cache system, the access times of and caches are 1 and 8 clock cycles, respectively. The miss penalty from the cache to main memory is 18 clock…Think it through. Then check your answer.Question
In a two-level cache system, the access times of and caches are 1 and 8 clock cycles, respectively. The miss penalty from the cache to main memory is 18 clock cycles. The miss rate of cache is twice that of . The average memory access time (AMAT) of this cache system is 2 cycles. The miss rates of and respectively are:Correct answer
(A) 0.111 and 0.056
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Given:
cycle, cycles, cycles.
Let be the miss rate of . Then .
Solving the quadratic equation for :
Taking the positive root:
Then
So, and .30
Q30MCQ2 marksMediumConsider the recurrence function Then in terms of notation isThink it through. Then check your answer.Question
Consider the recurrence functionThen in terms of notation isCorrect answer
(B) Θ(log n)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Let , which implies .
Substituting into the recurrence:
Let . Then:
Using the Master Theorem for :
Since for , we are in Case 1 of the Master Theorem.
Substituting back :31
Q31MCQ2 marksMediumFor any discrete random variable , with probability mass function , and , define the polynomial function…Think it through. Then check your answer.Question
For any discrete random variable , with probability mass function
, and , define the polynomial function
. For a certain discrete random variable , there exists a scalar such that . The expectation of isCorrect answer
(B) Nβ
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The function is the probability generating function (PGF) of the discrete random variable .
The expectation of a random variable can be found from its PGF using the formula , where is the first derivative of the PGF with respect to .In this problem, we are given the PGF of a random variable as:
To find the expectation of , we first need to compute the derivative of with respect to :
Using the chain rule, we get:
Now, we evaluate this derivative at to find the expectation :
This is also recognizable as the PGF of a binomial distribution , for which the expectation is known to be .Therefore, the expectation of is .32
Q32MCQ2 marksMediumConsider the following expression grammar G: [code] Which of the following grammars is not left recursive, but is equivalent to G?Think it through. Then check your answer.Question
Consider the following expression grammar G:E -> E - T | T T -> T + F | F F -> (E) | id
Which of the following grammars is not left recursive, but is equivalent to G?Correct answer
(C) [code]
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The problem asks for a grammar that is not left recursive and is equivalent to the given grammar G.First, let's analyze the given grammar G:E -> E - T | T T -> T + F | F F -> (E) | id
This grammar has direct left recursion in the productions for E (E -> E - T) and T (T -> T + F). A grammar is left recursive if it has a non-terminal A such that there is a derivation for some string . Both E and T satisfy this.The question requires a grammar that is not left recursive. Let's check the options:- Option (A): This is the same as grammar G. It is left recursive. So, (A) is incorrect.
- Option (B): This grammar contains the production
T -> T + F. This is a direct left recursion for the non-terminal T. Therefore, this grammar is left recursive. So, (B) is incorrect. - Option (C): Let's check for left recursion.
-
E -> TX: The right side starts with a terminal or a different non-terminal (T). -
X -> -TX: The right side starts with a terminal-. -
T -> FY: The right side starts with a different non-terminal (F). -
Y -> +FY: The right side starts with a terminal+. -
F -> (E) | id: The right side starts with terminals(orid.
A -> Aα. This grammar is not left recursive.
Now, let's check for equivalence. This grammar is derived from G by applying the standard algorithm for eliminating left recursion.
ForE -> E - T | T, we have . The transformation is , . This matches the productions for E and X in option (C) (with X being ).
ForT -> T + F | F, we have . The transformation is , . This matches the productions for T and Y in option (C) (with Y being ).
Since this grammar is obtained by the standard left recursion elimination algorithm, it is equivalent to G.
Thus, option (C) is not left recursive and is equivalent to G.- Option (D): This grammar is not left recursive. However, it is not equivalent to G. For example, in G, T can derive
id + id(T -> T+F -> F+F -> id+id). In grammar (D), T can only deriveid(T -> id). Therefore, the language generated by (D) is a small subset of the language generated by G. So, (D) is not equivalent.
33
Q33MCQ2 marksEasyA system shares 9 tape drives. The current allocation and maximum requirement of tape drives for three processes are shown below: | Process | Current Allocation | Maximum…Think it through. Then check your answer.Question
A system shares 9 tape drives. The current allocation and maximum requirement of tape drives for three processes are shown below:Which of the following best describes current state of the system?Process Current Allocation Maximum Requirement P1 3 7 P2 1 6 P3 3 5 Correct answer
(B) Safe, Not Deadlocked
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To determine if the system state is safe, we use the Banker's algorithm (Safety Algorithm).1.Calculate total allocated resources:Total Allocation = Allocation(P1) + Allocation(P2) + Allocation(P3)
Total Allocation = 3 + 1 + 3 = 7 tape drives.2.Calculate available resources:Total Resources = 9 tape drives.
Available = Total Resources - Total Allocation
Available = 9 - 7 = 2 tape drives.3.Calculate the 'Need' for each process:Need = Maximum Requirement - Current Allocation- Need(P1) = 7 - 3 = 4
- Need(P2) = 6 - 1 = 5
- Need(P3) = 5 - 3 = 2
Process Allocation Max Need P1 3 7 4 P2 1 6 5 P3 3 5 2
Available = 24.Run the Safety Algorithm:We need to find a sequence of processes that can finish execution. A process can finish if its 'Need' is less than or equal to the 'Available' resources.- Initial State: Available = 2.
- Can P1 run? Need(P1) = 4. Is 4 ≤ 2? No.
- Can P2 run? Need(P2) = 5. Is 5 ≤ 2? No.
- Can P3 run? Need(P3) = 2. Is 2 ≤ 2? Yes.
- Execute P3: P3 runs to completion and releases its allocated resources.
The safe sequence so far is .
Remaining processes: {P1, P2}.- Next State: Available = 5.
- Can P1 run? Need(P1) = 4. Is 4 ≤ 5? Yes.
- Execute P1: P1 runs to completion and releases its resources.
The safe sequence so far is .
Remaining processes: {P2}.- Next State: Available = 8.
- Can P2 run? Need(P2) = 5. Is 5 ≤ 8? Yes.
- Execute P2: P2 runs to completion.
34
Q34MCQ2 marksMediumConsider a binary code that consists of only four valid codewords as given below: 00000, 01011, 10101, 11110 Let the minimum Hamming distance of the code be and the maximum…Think it through. Then check your answer.Question
Consider a binary code that consists of only four valid codewords as given below:00000, 01011, 10101, 11110Let the minimum Hamming distance of the code be and the maximum number of erroneous bits that can be corrected by the code be . Then the values of and areCorrect answer
(A) p=3 and q=1
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Identify the codewords: .2.Calculate Hamming distances between all pairs:- (bits 2, 4, 5 differ)
- (bits 1, 3, 5 differ)
- (bits 1, 2, 3, 4 differ)
- (bits 1, 2, 3, 4 differ)
- (bits 1, 3, 5 differ)
- (bits 2, 4, 5 differ)
4.Determine : The error correction capability is given by .Thus, and .35
Q35MCQ2 marksEasyConsider two hosts and , connected by a single direct link of rate bits/sec. The distance between the two hosts is km and the propagation speed along the…Think it through. Then check your answer.Question
Consider two hosts and , connected by a single direct link of rate bits/sec. The distance between the two hosts is km and the propagation speed along the link is m/sec. Host sends a file of bytes as one large message to host continuously. Let the transmission and propagation delays be milliseconds and milliseconds, respectively. Then the values of and areCorrect answer
(D) p=400 and q=50
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Calculate Transmission Delay ():2.Calculate Propagation Delay ():Thus, and .36
Q36MCQ2 marksEasyThe pre-order traversal of a binary search tree is given by 12, 8, 6, 2, 7, 9, 10, 16, 15, 19, 17, 20. Then the post-order traversal of this tree is:Think it through. Then check your answer.Question
The pre-order traversal of a binary search tree is given by 12, 8, 6, 2, 7, 9, 10, 16, 15, 19, 17, 20. Then the post-order traversal of this tree is:Correct answer
(B) 2, 7, 6, 10, 9, 8, 15, 17, 20, 19, 16, 12
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.Determine In-order Traversal: For a Binary Search Tree (BST), the in-order traversal is the sorted sequence of its elements.In-order: 2, 6, 7, 8, 9, 10, 12, 15, 16, 17, 19, 202.Construct the Tree using Pre-order and In-order:- Root is the first element of pre-order: 12.
- Left subtree elements (from in-order): 2, 6, 7, 8, 9, 10. Pre-order for these: 8, 6, 2, 7, 9, 10.
- Right subtree elements (from in-order): 15, 16, 17, 19, 20. Pre-order for these: 16, 15, 19, 17, 20.
- Recursively applying this, the tree structure is:
- Root 12
- Left child 8; 8's left is 6 (with children 2, 7), 8's right is 9 (with right child 10).
- Right child 16; 16's left is 15, 16's right is 19 (with children 17, 20).
- Post-order of left subtree (rooted at 8): 2, 7, 6, 10, 9, 8
- Post-order of right subtree (rooted at 16): 15, 17, 20, 19, 16
- Full post-order: 2, 7, 6, 10, 9, 8, 15, 17, 20, 19, 16, 12.
37
Q37MCQ2 marksMediumConsider the C program fragment below which is meant to divide by using repeated subtractions. The variables and are all unsigned int. [code] Which of…Think it through. Then check your answer.Question
Consider the C program fragment below which is meant to divide by using repeated subtractions. The variables and are all unsigned int.Which of the following conditions on the variables and before the execution of the fragment will ensure that the loop terminates in a state satisfying the condition ?while (r >= y) { r = r - y; q = q + 1; }Correct answer
(C) (q == 0) && (r == x) && (y 0)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The loop implements division by repeated subtraction. The loop invariant is . For the loop to terminate in a state where , this condition must hold initially.1.Invariant Check: If we start with and , then . The invariant holds.2.Termination: For the loopwhile (r >= y)to terminate, must be greater than 0. If , since is an unsigned integer, is always true, leading to an infinite loop.3.Standard Initialization: In a typical division algorithm, we initialize the quotient to 0 and the remainder to the dividend .Comparing with options:- (A) requires initially.
- (B) does not specify .
- (C) specifies , which is sufficient.
- (D) does not specify .
38
Q38MCQ2 marksMediumConsider the following C function. [code] Time complexity of fun in terms of notation isThink it through. Then check your answer.Question
Consider the following C function.Time complexity of fun in terms of notation isint fun(int n) { int i, j; for(i = 1; i <= n; i++) { for(j = 1; j < n; j += i) { printf(" %d %d", i, j); } } }Correct answer
(C) Θ(n log n)
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The outer loop runs times ().
For a fixed , the inner loop runs for as long as . The number of iterations is approximately .
Total number of iterations .
The sum is the -th Harmonic number , which is .
Therefore, .39
Q39MCQ2 marksMediumLet denote the transition function and denote the extended transition function of the -NFA whose transition table is given below: | |…Think it through. Then check your answer.Question
Let denote the transition function and denote the extended transition function of the -NFA whose transition table is given below:Then isCorrect answer
(C) \q₀, q₁, q₂\
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
First, compute the -closures:1.2.3.4.Thus, .40
Q40MCQ2 marksMediumConsider the following languages.
…Think it through. Then check your answer.Question
Consider the following languages.
Which of the following are CORRECT?I. is context-free but not regular.
II. is not context-free.
III. is not context-free but recursive.
IV. is deterministic context-free.Correct answer
(D) III and IV only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Step-by-step analysis of the statements:1.Statement I: is a standard example of a language that is not context-free (it is a Context-Sensitive Language). Thus, I is incorrect.2.Statement II: can be written as . Since is regular and is context-free (requires one comparison), their concatenation is context-free. Thus, II is incorrect.3.Statement III: requires two simultaneous comparisons ( of 's with of 's, and of 's with of 's), which a single stack cannot do. It is not context-free but is recursive (it's a CSL). Thus, III is correct.4.Statement III: is a standard Deterministic Context-Free Language (DCFL) as it can be accepted by a Deterministic Pushdown Automaton. Thus, IV is correct.Statements III and IV are correct, which corresponds to option (D).41
Q41MCQ2 marksMediumLetL(R)be the language represented by regular expression . LetL(G)be the language generated by a context free grammar . LetL(M)be the language accepted by a…Think it through. Then check your answer.Question
LetL(R)be the language represented by regular expression . LetL(G)be the language generated by a context free grammar . LetL(M)be the language accepted by a Turing machine . Which of the following decision problems are undecidable?I. Given a regular expression and a string , is ?
II. Given a context-free grammar , is ?
III. Given a context-free grammar , is for some alphabet ?
IV. Given a Turing machine and a string , is ?Correct answer
(D) III and IV only
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Analysis of decision problems:- I. Membership for Regular Languages: Decidable. We can construct a DFA from and check if it accepts .
- II. Emptiness for CFG: Decidable. There are algorithms to check if a CFG generates any terminal string.
- III. Totality for CFG: Undecidable. Checking if a CFG generates all possible strings over its alphabet is a known undecidable problem.
- IV. Membership for Turing Machines: Undecidable. This is equivalent to the Halting Problem (specifically, the Acceptance Problem ), which is undecidable.
42
Q42MCQ2 marksMediumThe next state table of a 2-bit saturating up-counter is given below. | | | | | | :---: | :---: | :---: | :---: | | 0 | 0 | 0 | 1 | | 0 | 1 | 1 | 0 | |…Think it through. Then check your answer.Question
The next state table of a 2-bit saturating up-counter is given below.The counter is built as a synchronous sequential circuit using T flip-flops. The expressions for and are0 0 0 1 0 1 1 0 1 0 1 1 1 1 1 1 Correct answer
(B) T₁ = Q₁ Q₀, T₀ = Q₁ + Q₀
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the expressions for and , we use the excitation table of a T flip-flop, where .For :0 0 0 1 0 1 0 1 1 0 1 1 1 0 1 1 0 1 1 1 1 1 0 0
is 1 only when .
So, .For :
is 1 for minterms .
Using the absorption law :
.Thus, and , which matches option (B).43
Q43NAT2 marksMediumConsider the following snippet of a C program. Assume thatswap(&x, &y)exchanges the contents ofxandy. [code] The output of the program is ________.Think it through. Then check your answer.Question
Consider the following snippet of a C program. Assume thatswap(&x, &y)exchanges the contents ofxandy.The output of the program is ________.int main() { int array[] = {3, 5, 1, 4, 6, 2}; int done = 0; int i; while (done == 0) { done = 1; for (i=0; i<=4; i++) { if (array[i] < array[i+1]) { swap(&array[i], &array[i+1]); done = 0; } } for (i=5; i>=1; i--) { if (array[i] > array[i-1]) { swap(&array[i], &array[i-1]); done = 0; } } } printf("%d", array[3]); }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 provided C code implements a variation of the bubble sort algorithm known as the Cocktail Shaker Sort (or bidirectional bubble sort). However, the comparison operators are set such that it sorts the array in descending order.1.Initial array:{3, 5, 1, 4, 6, 2}2.First pass (forward): Moves smaller elements to the right. After the first forward loop, the array becomes{5, 3, 4, 6, 2, 1}.3.First pass (backward): Moves larger elements to the left. After the first backward loop, the array becomes{6, 5, 3, 4, 2, 1}.4.Second pass (forward): The array becomes{6, 5, 4, 3, 2, 1}.5.Termination: In the next iteration, no swaps occur,The final sorted array in descending order isdoneremains 1, and the loop terminates.{6, 5, 4, 3, 2, 1}. The value atarray[3](the 4th element) is 3.44
Q44NAT2 marksHardTwo transactions and are given as
where denotes a read operation by…Think it through. Then check your answer.Question
Two transactions and are given as
where denotes a read operation by transaction on a variable and denotes a write operation by transaction on a variable . The total number of conflict serializable schedules that can be formed by and is ________.Correct answer
54 to 54
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
A schedule is conflict serializable if it is conflict equivalent to a serial schedule. For two transactions and , the possible serial orders are and .Conflicts between and occur on variable :1.Equivalent to : Requires all conflicting operations of to precede those of . Specifically, , which means . This only happens in 1 schedule: .2.Equivalent to : Requires all conflicting operations of to precede those of . Specifically, , which means .Total possible schedules = . We count schedules where (at least two operations appear before the third operation). Using combinatorics, the number of such schedules is 53.Total conflict serializable schedules = .45
Q45NAT2 marksHardThe read access times and the hit ratios for different caches in a memory hierarchy are as given below. | Cache | Read access time (in nanoseconds) | Hit ratio | | :--- | :--- |…Think it through. Then check your answer.Question
The read access times and the hit ratios for different caches in a memory hierarchy are as given below.The read access time of main memory is 90 nanoseconds. Assume that the caches use the referred-word-first read policy and the write back policy. Assume that all the caches are direct mapped caches. Assume that the dirty bit is always 0 for all the blocks in the caches. In execution of a program, 60% of memory reads are for instruction fetch and 40% are for memory operand fetch. The average read access time in nanoseconds (up to 2 decimal places) is ________.Cache Read access time (in nanoseconds) Hit ratio I-cache 2 0.8 D-cache 2 0.9 L2-cache 8 0.9 Correct answer
4.72 to 4.72
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
The average read access time (ARAT) is calculated as a weighted average of instruction fetch time and data fetch time:
For a multi-level hierarchy (L1 -> L2 -> Main Memory):1.Instruction Fetch ARAT:ns2.Data Fetch ARAT:ns3.Total ARAT:ns.46
Q46NAT2 marksMediumConsider the following database table named top_scorer. ### top_scorer | player | country | goals | | :--- | :--- | :--- | | Klose | Germany | 16 | | Ronaldo | Brazil | 15 | | G…Think it through. Then check your answer.Question
Consider the following database table named top_scorer.top_scorer
Consider the following SQL query:player country goals Klose Germany 16 Ronaldo Brazil 15 G Müller Germany 14 Fontaine France 13 Pelé Brazil 12 Klinsmann Germany 11 Kocsis Hungary 11 Batistuta Argentina 10 Cubillas Peru 10 Lato Poland 10 Lineker England 10 T Müller Germany 10 Rahn Germany 10 The number of tuples returned by the above SQL query is __________.SELECT ta.player FROM top_scorer AS ta WHERE ta.goals >ALL (SELECT tb.goals FROM top_scorer AS tb WHERE tb.country = 'Spain') AND ta.goals >ANY (SELECT tc.goals FROM top_scorer AS tc WHERE tc.country = 'Germany')Correct answer
7 to 7
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.The first subquerySELECT tb.goals FROM top_scorer AS tb WHERE tb.country = 'Spain'returns an empty set because there are no players from Spain in the table.2.The conditionta.goals > ALL (empty set)is vacuously true for all rows in the table.3.The second subquerySELECT tc.goals FROM top_scorer AS tc WHERE tc.country = 'Germany'returns the set of goals for German players: .4.The conditionta.goals > ANY {16, 14, 11, 10}is equivalent tota.goals > min(16, 14, 11, 10), which simplifies tota.goals > 10.5.Combining the conditions, we need to count rows whereTRUE AND ta.goals > 10.6.The players with more than 10 goals are:- Klose (16)
- Ronaldo (15)
- G Müller (14)
- Fontaine (13)
- Pelé (12)
- Klinsmann (11)
- Kocsis (11)
47
Q47NAT2 marksMediumIf the ordinary generating function of a sequence is , then is equal to __________.Think it through. Then check your answer.Question
If the ordinary generating function of a sequence is , then is equal to __________.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 generating function is .
Using the binomial expansion , for we have:
.
Thus, .
The coefficient is the coefficient of in :
for .
For , .
For , .
Therefore, .48
Q48NAT2 marksMediumIf a random variable has a Poisson distribution with mean 5, then the expectation equals __________.Think it through. Then check your answer.Question
If a random variable has a Poisson distribution with mean 5, then the expectation equals __________.Correct answer
54 to 54
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
For a Poisson distribution with mean :
We know that , so:
.
We need to find :
Substituting the known values:
.49
Q49NAT2 marksMediumIn a B+ tree, if the search-key value is 8 bytes long, the block size is 512 bytes and the block pointer size is 2 bytes, then the maximum order of the B+ tree is ___________.Think it through. Then check your answer.Question
In a B+ tree, if the search-key value is 8 bytes long, the block size is 512 bytes and the block pointer size is 2 bytes, then the maximum order of the B+ tree is ___________.Correct answer
52 to 52
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
In a B+ tree, the order is defined as the maximum number of pointers in an internal node. An internal node with order contains at most block pointers and search keys.Given:- Search-key size () = 8 bytes
- Block pointer size () = 2 bytes
- Block size () = 512 bytes
50
Q50NAT2 marksMediumA message is made up entirely of characters from the set . The table of probabilities for each of the characters is shown below: | Character | Probability |…Think it through. Then check your answer.Question
A message is made up entirely of characters from the set . The table of probabilities for each of the characters is shown below:If a message of 100 characters over is encoded using Huffman coding, then the expected length of the encoded message in bits is ___________.Character Probability 0.22 0.34 0.17 0.19 0.08 Total 1.00 Correct answer
225 to 225
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
To find the expected length using Huffman coding, we first construct the Huffman tree by repeatedly combining the two nodes with the lowest probabilities:1.Initial probabilities:2.Combine and : . Remaining:3.Combine and : . Remaining:4.Combine and : . Remaining:5.Combine and :Codeword lengths ():- : 2 bits (Root )
- : 2 bits (Root )
- : 2 bits (Root )
- : 3 bits (Root )
- : 3 bits (Root )
51
Q51NAT2 marksMediumConsider the set of processes with arrival time (in milliseconds), CPU burst time (in milliseconds), and priority (0 is the highest priority) shown below. None of the processes…Think it through. Then check your answer.Question
Consider the set of processes with arrival time (in milliseconds), CPU burst time (in milliseconds), and priority (0 is the highest priority) shown below. None of the processes have I/O burst time.The average waiting time (in milliseconds) of all the processes using preemptive priority scheduling algorithm is ___________.Process Arrival Time Burst Time Priority 0 11 2 5 28 0 12 2 3 2 10 1 9 16 4 Correct answer
29 to 29
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Preemptive Priority Scheduling (Lower number = Higher priority):Gantt Chart:- : runs (Priority 2). At , (Priority 1) arrives and preempts . ( remaining: 9)
- : runs. At , (Priority 0) arrives and preempts . ( remaining: 7)
- : runs to completion as it has the highest priority. ()
- : resumes and finishes. ()
- : resumes and finishes. ()
- : (Priority 3) runs and finishes. ()
- : (Priority 4) runs and finishes. ()
- :
- :
- :
- :
- :
52
Q52NAT2 marksMediumIf the characteristic polynomial of a matrix over (the set of real numbers) is , , and one…Think it through. Then check your answer.Question
If the characteristic polynomial of a matrix over (the set of real numbers) is , , and one eigenvalue of is 2, then the largest among the absolute values of the eigenvalues of 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
Given the characteristic polynomial . Since is an eigenvalue, .The characteristic equation is . Since is a root, we can factor the polynomial:The eigenvalues are , , and . The absolute values are , , and . The largest among these is 5.53
Q53NAT2 marksEasyConsider a machine with a byte addressable main memory of bytes divided into blocks of size 32 bytes. Assume that a direct mapped cache having 512 cache lines is used…Think it through. Then check your answer.Question
Consider a machine with a byte addressable main memory of bytes divided into blocks of size 32 bytes. Assume that a direct mapped cache having 512 cache lines is used with this machine. The size of the tag field in bits is ________.Correct answer
18 to 18
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Main memory size = bytes Address bits = 32.
Block size = 32 bytes = bytes Block offset = 5 bits.
Number of cache lines = 512 = Index bits = 9 bits.
In a direct mapped cache, the physical address is divided as follows:Total address bits = bits.Tag Index Block Offset bits 9 bits 5 bits 54
Q54NAT2 marksEasyConsider the following C Program. [code] The output of the program is ________.Think it through. Then check your answer.Question
Consider the following C Program.The output of the program is ________.#include<stdio.h> int main() { int m = 10; int n, n1; n = ++m; n1 = m++; n--; --n1; n -= n1; printf("%d", n); return 0; }Correct answer
0 to 0
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
Step-by-step execution of the program:1.int m = 10;2.n = ++m;Pre-increment to 11, then assign to . So .3.n1 = m++;Assign current value of (11) to , then post-increment to 12. So .4.n--;Post-decrement . becomes 10.5.--n1;Pre-decrement . becomes 10.6.n -= n1;.7.printf("%d", n);Prints 0.55
Q55NAT2 marksMediumConsider the following C Program. [code] The output of the program is ________.Think it through. Then check your answer.Question
Consider the following C Program.The output of the program is ________.#include<stdio.h> #include<string.h> int main() { char* c = "GATECSIT2017"; char* p = c; printf("%d", (int)strlen(c+2[p]-6[p]-1)); return 0; }Correct answer
2 to 2
Turn this into a strength.Explore AI-powered practice and doubt support with Success Tracker.Step-by-step solution
1.The stringcis initialized to"GATECSIT2017". The pointerpalso points to the same string literal.2.In C, the array subscripting operator[]is commutative, meaningi[p]is equivalent to*(p + i), which is the same asp[i].3.2[p]is equivalent top[2], which is the character'T'. Its ASCII value is 84.4.6[p]is equivalent top[6], which is the character'I'. Its ASCII value is 73.5.The expressionc + 2[p] - 6[p] - 1evaluates as follows:6.c + 10is a pointer to the character at index 10 of the string"GATECSIT2017".7.Let's map the indices of the string:8. The pointerIndex 0 1 2 3 4 5 6 7 8 9 10 11 12 Char G A T E C S I T 2 0 1 7 \0 c + 10points to the substring starting at index 10, which is"17".9.Thestrlen()function calculates the length of the string excluding the null terminator. For"17", the length is 2.10.Thus, the program prints 2.