## GATE 2020

 Question 1

Two straight lines are drawn perpendicular to each other in X-Y plane. If α and β are the acute angles the straight lines make with the X-axis, then α+β is ______.

 A 60° B 120° C 180° D 90°
Aptitude       Numerical
Question 1 Explanation:
Two st. line perpendicular to each other in X-Y, if α & β are acute angles then α + β = ____

We know a + α + β = 180
α + β = 180 - 90
α + β = 90
 Question 2

The total revenue of a company during 2014-2018 is shown in the bar graph. If the total expenditure of the company in each year is 500 million rupees, then the aggregate profit or loss (in percentage) on the total expenditure of the company during 2014-2018 is ______.

 A 20% profit B 20% loss C 16.67% loss D 16.67% profit
Aptitude       Numerical
Question 2 Explanation:
Bar-graph:
2014-2018
Total expenditure = 500 million/year = 500 × 5 = 2500 million
Revenue total (from the graph)
= 400 + 500 + 600 + 700 + 800
= 3000 million
Profit = 3000 - 2500 = 500
⟹ 500/2500 = 20% profit
 Question 3

The figure below shows an annular ring with outer and inner radii as b and a, respectively. The annular space has been painted in the form of blue colour circles touching the outer and inner periphery of annular space. If maximum n number of circles can be painted, then the unpainted area available in annular space is ______.

 A π[(b2 - a2) + π/4(b - a)2] B π[(b2 - a2) - π/4(b - a)2] C π[(b2 - a2) - n(b - a)2] D π[(b2 - a2) + n(b - a)2]
Aptitude       Numerical
Question 3 Explanation:

Area of non-painted between 2 circles area of part 1 = πb2 - πa2 = π(b2 - a2)
Radius of painted circles = b-a/2
Area of painted circle = π(b-a/2)2
For n circles = nπ(b-a/2)2
Non-painted area = π[b2 - a2- n/4(b - a)2]
 Question 4

Goods and Services Tax (GST) is an indirect tax introduced in India in 2017 that is imposed on the supply of goods and services, and it subsumes all indirect taxes except few. It is a destination-based tax imposed on goods and services used, and it is not imposed at the point of origin from where goods come. GST also has a few components specific to state governments, central government and Union Territories (UTs).

Which one of the following statements can be inferred from the given passage?

 A GST includes all indirect taxes. B GST is imposed at the point of usage of goods and services. C GST does not have a component specific to UT. D GST is imposed on the production of goods and services.
Aptitude       Verbal
Question 4 Explanation:
GST is imposed at the point of usage of goods and services.
 Question 5

Select the word that fits the analogy:

` Cook : Cook :: Fly : _____  `
 A Flyer B Flying C Flew D Flighter
Aptitude       Verbal
Question 5 Explanation:
Cook-cook - Noun-verb relation
Fly-Flyer
 Question 6

The drawn of the 21st century witnessed the melting glaciers oscillating between giving too much and too little to billions of people who depend on them for fresh water. The UN climate report estimates that without deep cuts to man-made emissions, at least 30% of the northern hemisphere’s surface permafrost could melt by the end of the century. Given this situation of imminent global exodus of billions of people displaced by rising seas, nation-states need to rethink their carbon footprint for political concerns, if not for environmental ones.

Which one of the following statements can be inferred from the given passage?

 A Nation-states are responsible for providing fresh water to billions of people. B Billions of people are affected by melting glaciers. C Nation-states do not have environmental concerns. D Billions of people are responsible for man-made emissions.
Aptitude       Verbal
Question 6 Explanation:
Billions of people are affected by melting glaciers.
 Question 7

There are multiple routes to reach from node 1 to node 2, as shown in the network.

The cost of travel on an edge between two nodes is given in rupees. Nodes ‘a’, ‘b’, ‘c’, ‘d’, ‘e’, and ‘f’ are toll booths. The toll price at toll booths marked ‘a’ and ‘e’ is Rs.200, and is Rs.100 for the other toll booths. Which is the cheapest route from node 1 to node 2?

 A 1-f-e-2 B 1-f-b-2 C 1-b-2 D 1-a-c-2
Aptitude       Numerical
Question 7 Explanation:

1 - f - e - 2 ─ 100 + 100 + 200 = 400
1 - f - b - 2 ─ 100 + 0 + 200 = 300 ⇾ shortest [Answer]
1 - b - 2 ─ 300 + 200 = 500
1 - a - c ─ 2 - 200 + 100 + 100 = 400
 Question 8

Raman is confident of speaking English _____ six months as he has been practicing regularly_____the last three weeks.

 A for, in B during, for C for, since D within, for
Aptitude       Verbal
 Question 9

If P = 3, R = 27, T = 243, then Q+S = ______.

 A 80 B 110 C 40 D 90
Aptitude       Numerical
Question 9 Explanation:
P=3, R=27, T=243, Q+5=?
P=31, Q=32, R=33, S=34, T=35
Q+S = 32 + 34 = 9+81 = 90
 Question 10

His knowledge of the subject was excellent but his classroom performance was ______.

 A good B praiseworthy C extremely poor D desirable
Aptitude       Verbal
Question 10 Explanation:
A Contrast is indicated in the above sentence.
 Question 11

Let G be a group of 35 elements. Then the largest possible size of a subgroup of G other than G itself is ______.

 A 7
Engineering-Mathematics       Set-Theory
Question 11 Explanation:
Lagrange’s Theorem:
If ‘H” is a subgroup of finite group (G,*) then O(H) is the divisor of O(G).
Given that the order of group is 35. Its divisors are 1,5,7,35.
It is asked that the size of largest possible subgroup other than G itself will be 7.
 Question 12

Consider a relational database containing the following schemas.

The primary key of each table is indicated by underlying the constituent fields.

```SELECT s.sno, s.sname
FROM Suppliers s, Catalogue c
WHERE s.sno = c.sno AND
Cost > (SELECT AVG (cost)
FROM Catalogue
WHERE pno = ‘P4’
GROUP BY pno);```

The number of rows returned by the above SQL query is

 A 0 B 5 C 4 D 2
Database-Management-System       SQL
Question 12 Explanation:
The inner query “select avg(cost) from catalogue where pno='P4' group by pno;” returns:
AVG(COST)
------------
225
The outer query “select s.sno, s.sname from suppliers s, catalogue c where s.sno=c.sno” returns:
SNO SNAME
----------------------------------------
S1 M/s Royal furniture
S1 M/s Royal furniture
S1 M/s Royal furniture
S2 M/s Balaji furniture
S2 M/s Balaji furniture
So, the final result of the query is:
SN SNAME
----------------------------------------
S2 M/s Balaji furniture
Therefore, 4 rows will be returned by the query.
 Question 13

Consider the language L = {an| n≥0} ∪ {anbn| n≥0} and the following statements.

I. L is deterministic context-free.
II. L is context-free but not deterministic context-free.
III. L is not LL(k) for any k.

Which of the above statements is/are TRUE?

 A II only B III only C I only D I and III only
Theory-of-Computation       Languages-and-Grammars
Question 13 Explanation:
L is DCFL.
We can make DPDA for this.

L is not LL(k) for any “k” look aheads. The reason is the language is a union of two languages which have common prefixes. For example strings {aa, aabb, aaa, aaabbb,….} present in language. Hence the LL(k) parser cannot parse it by using any lookahead “k” symbols.
 Question 14

For parameters a and b, both of which are ω(1), T(n) = T(n1/a)+1, and T(b)=1.

Then T(n) is

 A θ(loga logb n) B θ(logb loga n) C θ(log2 log2 n) D θ(logab n)
Algorithms       Recurrences
Question 14 Explanation:
T(n) = T(n1/a+1, T(b) = 1
T(n) = [T(n1/a2)+1] + 1
= [T(n1/a3)+1] + 2
= [T(n1/a3)] + 3
= [T(n1/ak)] + b
= logb n = ak
= log logb n = k log a
= k= loga logb n
T(n)=1+loga logb n
T(n)=O(loga logb n)
 Question 15

Consider the following statements.

I. If L1 ∪ L2 is regular, then both L1 and L2 must be regular.
II. The class of regular languages is closed under infinite union.

Which of the above statements is/are TRUE?

 A Both I and II B II only C Neither I nor II D I only
Theory-of-Computation       Regular-Language
Question 15 Explanation:
Statement I is wrong.
Assume L1 = {an bn | n>0} and L2 = complement of L1
L1 and L2 both are DCFL but not regular, but L1 U L2 = (a+b)* which is regular.
Hence even though L1 U L2 is regular, L1 and L2 need not be always regular.
Statement II is wrong.
Assume the following finite (hence regular) languages.
L1 = {ab}
L2 = {aabb}
L3 = {aaabbb}
.
.
.
L100 = {a100 b100}
.
.
.
If we take infinite union of all above languages i.e,
{L1 U L2 U ……….L100 U ……}
then we will get a new language L = {an bn | n>0}, which is not regular.
Hence regular languages are not closed under infinite UNION.
 Question 16

Consider the following statements.

I. Daisy chaining is used to assign priorities in attending interrupts.
II. When a device raises a vectored interrupt, the CPU does polling to identify the source of the interrupt.
III. In polling, the CPU periodically checks the status bits to know if any device needs its attention.
IV. During DMA, both the CPU and DMA controller can be bus masters at the same time.

Which of the above statements is/are TRUE?

 A I and IV only B I and II only C III only D I and III only
Computer-Organization       Interruption
Question 16 Explanation:
Statement-I is true as daisy chaining is used to assign priorities in attending interrupts.
Statement-II is false as vectored interrupt doesn’t involve polling but non-vectored interrupt involves polling.
Statement-III is true as polling means that CPU periodically checks the status bits to know if any device needs attention.
Statement-IV is false as during DMA only one of the CPU or DMA can be bus master at a time.
 Question 17

A direct mapped cache memory of 1 MB has a block ize of 256 bytes. The cache has an access time of 3 ns and a hit rate of 94%. During a cache miss, it takes 20 ns to bring the first word of a block from the main memory, while each subsequent word takes 5 ns. The word size is 64 bits. The average memory access time in ns (round off to 1 decimal place) is _____.

 A 13.5
Computer-Organization       Cache
Question 17 Explanation:
Cache access time = 3 ns
Hit ratio of cache = 0.94
Word size is 64 bits = 8 bytes.
Cache line size = 256 bytes = 32 words
Main memory access time = 20ns(time for first word) + 155ns(time for remaining 31 words, 31*5 = 155ns) = 175 ns
Average access time = h1*t1 + (1-h1)(t1+t2) = t1 +(1-h1)t2
⇒ 3 + (0.06)(175) = 13.5 ns
 Question 18

Let R be the set of all binary relations on the set {1,2,3}. Suppose a relation is chosen from R at random. The probability that the chosen relation is reflexive (round off to 3 decimal places) is _____.

 A 0.125
Engineering-Mathematics       Sets-And Relation
Question 18 Explanation:
For a set with n elements,
The number of reflexive relations is 2^(n^2-n).
The total number of relations on a set with n elements is 2^ (n^2).
The probability of choosing the reflexive relation out of set of relations is
= 2^(n^2-n) /2^ (n^2)
= 2^( n^2-n- n^2)
= 2^(-n)
Given n=3, the probability will be 2-n = ⅛ = 0.125
 Question 19

Which one of the following is used to represent the supporting many-one relationships of a weak entity set in an entity-relationship diagram?

 A Ovals that contain underlined identifiers B Rectangles with double/bold border C Diamonds with double/bold border D Ovals with double/bold border
Database-Management-System       ER-Model
Question 19 Explanation:
An entity set that does not have sufficient attributes to form a primary key is termed as a weak entity and an entity set that has a primary key is termed as strong entity set. For a weak entity set to be meaningful, it must be associated with another entity set, called identifying or owner entity set. The relationship associating the weak entity set with the identifying entity set is called the identifying relationship and it is represented by double diamond. The identifying relationship is many-to-one from the weak entity set to the identifying entity set and the participation of weak entity set in the relationship is total.
 Question 20

Consider allocation of memory to a new process. Assume that none of the existing holes in the memory will exactly fit the process’s memory requirement. Hence, a new hole of smaller size will be created if allocation is made in any of the existing holes. Which one of the following statements is TRUE?

 A The hole created by worst fit is always larger than the hole created by first fit. B The hole created by best fit is never larger than the hole created by first fit. C The hole created by first fit is always larger than the hole created by next fit. D The hole created by next fit is never larger than the hole created by best fit.
Operating-Systems       Memory-Management
Question 20 Explanation:
The size of hole created using best fit is never greater than size created by first fit. The best fit chooses the smallest available partition to fit the size of the process. Whereas, first fit and next fit doesn’t consider the size of the holes available.
 Question 21

Consider the following grammar.

```     S → aSB|d
B → b ```

The number of reduction steps taken by a bottom-up parser while accepting the string aaadbbb is _______.

 A 7
Compiler-Design       Parsers
Question 21 Explanation:

7 reductions total.
 Question 22

Consider the following statements about process state transitions for a system using preemptive scheduling.

I. A running process can move to ready state.
II. A ready process can move to running state.
III. A blocked process can move to running state.
IV. A blocked process can move to ready state.

Which of the above statements are TRUE?

 A II and III only B I, II and III only C I, II, III and IV D I, II and IV only
Operating-Systems       Process-Scheduling
Question 22 Explanation:
 Question 23

The preorder traversal of a binary search tree is 15, 10, 12, 11, 20, 18, 16, 19.

Which one of the following is the postorder traversal of the tree?

 A 20, 19, 18, 16, 15, 12, 11, 10 B 11, 12, 10, 16, 19, 18, 20, 15 C 10, 11, 12, 15, 16, 18, 19, 20 D 19, 16, 18, 20, 11, 12, 10, 15
Data-Structures       Binary-Trees
Question 23 Explanation:

Postorder:
11, 12, 10, 16, 19, 18, 20, 15
 Question 24

A multiplexer is placed between a group of 32 registers and an accumulator to regulate data movement such that at any given point in time the content of only one register will move to the accumulator. The minimum number of select lines needed for the multiplexer is _____.

 A 5
Digital-Logic-Design       Combinational-Circuit
Question 24 Explanation:
Number of registers is 32. Only one register has to be selected at any instant of time.
A 25x1 Multiplexer with 5 select lines selects one of the 32(= 25) registers at a time depending on the selection input.
The content from the selected register will be transferred through the output line to the Accumulator.
 Question 25

Consider a double hashing scheme in which the primary hash function is h1(k) = k mod 23, and the secondary hash function is h2(k) = 1 + (k mod 19). Assume that the table size is 23. Then the address returned by probe 1 in the probe sequence (assume that the probe sequence begins at probe 0) for key value k=90 is _______.

 A 13
Data-Structures       Hashing
Question 25 Explanation:
• Probe sequence is the list of locations which a method for open addressing produces as alternatives in case of a collision.
• K=90
• h1(k) = k mod 23 = 90 mod 23 = 21
• In case of collision, we need to use secondary hash function.
• h2(k) = 1 + (k mod19) = 1 + 90mod19 = 1+14 = 15
• Now (21+15) mod 23 = 36 mod 23 = 13
• So the address is 13.
 Question 26

Consider the functions

I. e-x
II. x2-sin x
III. √(x3+1)

Which of the above functions is/are increasing everywhere in [0,1]?

 A II and III only B III only C II only D I and III only
Engineering-Mathematics       Calculus
Question 26 Explanation:
A function f(x) is said to be increasing if f'(x)>0 at each point in an interval.
I. e-x
II. f'(x) = -e-x
f'(x)<0 on the interval [0,1] so this is not an increasing function.
II. x2-sinx
f'(x) = 2x - cosx
at x=0, f'(0) = 2(0) - 1 = -1 < 0
f(x) = x2 - sinx is decreasing over some interval, increasing over some interval as cosx is periodic.
III. √(x3+1) = (x3+1)1/2
f'(x) = 1/2(3x2/√(x3+1))>0
f(x) is increasing over [0,1].
 Question 27

What is the worst case time complexity of inserting n elements into an empty linked list, if the linked list needs to be maintained in sorted order?

 A θ(n log n) B θ(n2) C θ(1) D θ(n)
Question 27 Explanation:
The Linked list insertion operations will take O(1) time. It means a constant amount of time for insertion.
Total number of elements inserted into an empty linked list is O(n). So, it will take O(n) time in the worst case.
After inserting elements into an empty linked list we have to perform sorting operation.
To get minimum time complexity to perform sorting order is merge sort. It will give O(nlogn) time complexity only.
The head in MergeSort as the below implementation changes next links to sort the linked lists (not data at the nodes), so head node has to be changed if the data at the original head is not the smallest value in the linked list.
Note: There are other sorting methods also will give decent time complexity but quicksort will give O(n2) and heap sort will not be suitable to apply.
 Question 28

Assume that you have made a request for a web page through your web browser to a web server. Initially the browser cache is empty. Further, the browser is configured to send HTTP requests in non-persistent mode. The web page contains text and five very small images. The minimum number of TCP connections required to display the web page completely in your browser is ______.

 A 6
Computer-Networks       Application-Layer-Protocol
Question 28 Explanation:
In non-persistent HTTP connection for every object, there is a TCP connection established. Therefore, 1 TCP connection for text and 5 TCP connections for images required.
Hence, 1 Text + 5 Image = 6 Objects
 Question 29

Consider the following C program.

```#include
int main ()  {
int a [4] [5] = {{1, 2, 3, 4, 5},
{6, 7, 8, 9, 10},
{11, 12, 13, 14, 15},
{16, 17, 18, 19, 20}};
printf (“%d\n”, *(*(a+**a+2) +3));
return (0);
} ```

The output of the program is _______.

 A 19
Data-Structures       Arrays
Question 29 Explanation:
Check out the step by step program and its output in the comment:
#include
int main()
{
int a[4][5] = { {1,2,3,4,5},
{6,7,8,9,10},
{11,12,13,14,15},
{16,17,18,19,20}
};
printf("%d\n",a); //880 (consider base address = 880)
printf("%d\n",*a); //880
printf("%d\n",**a); //1
printf("%d\n",**a+2); //3
printf("%d\n",a+**a+2); //940
printf("%d\n",*(a+**a+2));//940
printf("%d\n",*(a+**a+2)+3);//952
printf("%d\n",*(*(a+**a+2)+3));//19
return 0;
}
 Question 30

Consider the following data path diagram.

Consider an instruction: R0 ← R1 + R2. The following steps are used to execute it over the given data path. Assume that PC is incremented appropriately. The subscripts r and w indicate read and write operations, respectively.

```1. R2r, TEMP1r, ALUadd, TEMP2w
2. R1r, TEMP1w
3. PCr, MARw, MEMr
4. TEMP2r, ROw
5. MDRr, IRw ```

Which one of the following is the correct order of execution of the above steps?

 A 3, 5, 1, 2, 4 B 3, 5, 2, 1, 4 C 1, 2, 4, 3, 5 D 2, 1, 4, 5, 3
Computer-Organization       Registers
Question 30 Explanation:
To execute the given instruction R0 ← R1 + R2.
First the PC value has to be moved into MAR (step-3 from the given sequence), then the instruction has to be fetched(step-5 from the given sequence). Then Temp1 is loaded with the value of R1 (step-2 from the given sequence), then the addition operation is performed by accessing the R2 value directly and adding it to Temp1 value and storing the result in Temp2 (step-1 from the given sequence).
Finally the result from Temp2 is stored in R0 (step-4 from the given sequence).
Hence the correct sequence is (3, 5, 2, 1, 4).
 Question 31

Consider the following statements.

I. Symbol table is accessed only during lexical analysis and syntax analysis.
II. Compilers for programming languages that support recursion necessarily need heap storage for memory allocation in the run-time environment.
III. Errors violating the condition ‘any variable must be declared before its use’ are detected during syntax analysis.

Which of the above statements is/are TRUE?

 A II only B I only C I and III only D None of I, II and III
Compiler-Design       Run-Time-Environment
Question 31 Explanation:
I is wrong as Symbol table is also accessed during semantic analysis phase.
II is wrong as compilers which supports recursion require stack memory in run time environment.
III is wrong “any variable must be declared before its use” is a semantic error and not syntax error.
 Question 32

If there are m input lines and n output lines for a decoder that is used to uniquely address a byte addressable 1 KB RAM, then the minimum value of m + n is ____.

 A 1034
Digital-Logic-Design       Combinational-Circuit
Question 32 Explanation:
The size of the decoder required is 10 x 210 i.e., 10 x 1024.
Each output line of the decoder is connected to one of the 1K(= 1024) rows of RAM.
Each row stores 1 Byte.
m=10 and n=1024
 Question 33

What is the worst case time complexity of inserting n2 elements into an AVL-tree with n elements initially?

 A θ(n4) B θ(n2) C θ(n3) D θ(n2 log n)
Data-Structures       Binary-Trees
Question 33 Explanation:
AVL Tree all operations(insert, delete and search) will take O(logn) time.
So, In worst case it will take o(n2 log n) time.
 Question 34

Which one of the following regular expressions represents the set of all binary strings with an odd number of 1’s?

 A 10*(0*10*10*)* B ((0 + 1)*1(0 + 1)*1)*10* C (0*10*10*)*10* D (0*10*10*)*0*1
Theory-of-Computation       Regular-Expression
Question 34 Explanation:
The regular expression 10*(0*10*10*)* always generate string begin with 1 and thus does not generate string “01110” hence wrong option.
The regular expression ((0+1)*1(0+1)*1)*10* generate string “11110” which is not having odd number of 1’s , hence wrong option.
The regular expression (0*10*10*)10* is not a generating string “01”. Hence this is also wrong . It seems none of them is correct.
NOTE: Option 3 is most appropriate option as it generates the max number of strings with odd 1’s.
But option 3 is not generating odd strings. So, still it is not completely correct.
The regular expression (0*10*10*)*0*1 always generates all string ends with “1” and thus does not generate string “01110” hence wrong option.
 Question 35

Consider the following statements about the functionality of an IP based router.

I. A router does not modify the IP packets during forwarding.
II. It is not necessary for a router to implement any routing protocol.
III. A router should reassemble IP fragments if the MTU of the outgoing link is larger than the size of the incoming IP packet.

Which of the above statements is/are TRUE?

 A I and II only B II only C I only D II and III only
Computer-Networks       Routers
Question 35 Explanation:
I: The packet contains Header and data. The router modifies the header details like TTL.
II: Is True.
III: Reassemble is not necessary at the router.
 Question 36

Consider a non-pipelined processor operating at 2.5 GHz. It takes 5 clock cycles to complete an instruction. You are going to make a 5-stage pipeline out of this processor. Overheads associated with pipelining force you to operate the pipelined processor at 2 GHz. In a given program, assume that 30% are memory instructions, 60% are ALU instructions and the rest are branch instructions. 5% of the memory instructions cause stalls of 50 clock cycles each due to cache misses and 50% of the branch instructions cause stalls of 2 cycles each. Assume that there are no stalls associated with the execution of ALU instructions. For this program, the speedup achieved by the pipelined processor over the non-pipelined processor (round off to 2 decimal places) is _____.

 A 2.16
Computer-Organization       Pipelining
Question 36 Explanation:
In the non-pipelined architecture the clock cycle time = 1/(2.5)G = 0.4 ns
It is given that each instruction takes 5 clock cycles to execute in the non-pipelined architecture, so time taken to execute each instruction = 5 * 0.4 = 2ns
In the pipelined architecture the clock cycle time = 1/2G = 0.5 ns
In the pipelined architecture there are stalls due to memory instructions and branch instructions.
In the pipeline, the updated clocks per instruction CPI = (1 + stall frequency due to memory operations * stalls of memory instructions + stall frequency due to branch operations * stalls due to branch instructions)
Out of the total instructions , 30% are memory instructions. Out of those 30%, only 5% cause stalls of 50 cycles each.
Stalls per instruction due to memory operations = 0.3*0.05*50 = 0.75
Out of the total instructions 10% are branch instructions. Out of those 10% of instructions 50% of them cause stalls of 2 cycles each.
Stalls per instruction due to branch operations = 0.1*0.5*2 = 0.1
The updated CPI in pipeline = 1 + 0.75 + 0.1 = 1.85
The execution time in the pipeline = 1.85 * 0.5 = 0.925 ns
The speed up = Time in non-pipelined architecture / Time in pipelined architecture = 2 / 0.925 = 2.16
 Question 37

Consider the following set of processes, assumed to have arrived at time 0. Consider the CPU scheduling algorithms Shortest Job First (SJF) and Round Robin (RR). For RR, assume that the processes are scheduled in the order P1,P2,P3,P4.

If the time quantum for RR is 4 ms, then the absolute value of the difference between the average turnaround times (in ms) of SJF and RR (round off to 2 decimal places) is _____.

 A 5.25
Operating-Systems       Process-Scheduling
Question 37 Explanation:
SJF:

Turn Around Time = (21 – 0) + (13 – 0) + (2 – 0) + (6 – 0), Average = 42/4 = 10.50

Turn Around Time (TAT) = (18 – 0) + (21 – 0) + (10 – 0) + (14 – 0), Average = 63/4 = 15.75
Absolute difference = |10.50-15.75| = 5.25
 Question 38

Let G = (V,E) be a directed, weighted graph with weight function w:E → R. For some function f:V → R, for each edge (u,v) ∈ E, define w'(u,v) as w(u,v) + f(u) - f(v).
Which one of the options completes the following sentence so that it is TRUE?

“The shortest paths in G under w are shortest paths under w’ too, _______”.

 A if and only if f(u) is the distance from s to u in the graph obtained by adding a new vertex s to G and edges of zero weight from s to every vertex of G B if and only if ∀u ∈ V, f(u) is positive C if and only if ∀u ∈ V, f(u) is negative D for every f: V→R
Data-Structures       Graphs-and-Tree
Question 38 Explanation:

 Question 39

Consider a schedule of transactions T1 and T2:

Here, RX stands for “Read(X)” and WX stands for “Write(X)”. Which one of the following schedules is conflict equivalent to the above schedule?

 A B C D
Database-Management-System       Transactions
Question 39 Explanation:
• Two schedules are said to be conflict equivalent, if conflict operations in both the schedules are executed in the same order.
• First, let’s list the conflict operations of each of the schedule given in the options and compare with the conflict operations of schedule which is given in the question.
Given schedule:

Conflict operations:
R2(B) → W1(B)
W2(B) → W1(B)
R1(C) → W2(C)
R2(D) → W1(D)
Option(1):

Conflict operations:
R1(C) → W2(C)
W1(D) → R2(D)
W1(B) → R2(B)
W1(B) → W2(B)
Option(2):

Conflict operations:
R2(B) → W1(B)
W2(B) → W1(B)
R2(D) → W1(D)
R1(C) → W2(C)
Option(3):

Conflict operations:
R2(B) → W1(B)
W2(B) → W1(B)
R2(D) → W1(D)
W2(C) → R1(C)
Option(4):

Conflict operations:
R1(C) → W2(C)
W1(D) → R2(D)
R2(B) → W1(B)
W2(B) → W1(B)
The conflict operations in the option (2) and given schedule are appearing in the same sequence order, so option (2) is the answer.
 Question 40

A computer system with a word length of 32 bits has a 16 MB byte-addressable main memory and a 64 KB, 4-way set associative cache memory with a block size of 256 bytes. Consider the following four physical addresses represented in hexadecimal notation.

` A1 = 0x42C8A4,  A2 = 0x546888,  A3 = 0x6A289C,  A4 = 0x5E4880 `

Which one of the following is TRUE?

 A A1 and A4 are mapped to different cache sets. B A1 and A3 are mapped to the same cache set. C A3 and A4 are mapped to the same cache set. D A2 and A3 are mapped to the same cache set.
Computer-Organization       Cache
Question 40 Explanation:
Main memory is 16MB in size.
The word length is given as 32 bits and the physical addresses mentioned are all contain 6 hexadecimal digits, so the the physical address is 32 bits long.
Block size is 256 bytes, block offset = 8 bits as it is a byte addressable memory.
Cache size = 64KB
Number of blocks in the cache = 64KB/256B = 256
It is a 4-way set associative cache, so no. of sets in the cache = 256/4 = 64 = 26
In the physical address we need 6 bits for the SET number.
TAG bits = 32 - 6 - 8 = 18
So the 32 bits physical address is divided as (18 TAG bits + 6 SET number bits + 8 OFFSET bits)
Since in all the options we are asked about SET numbers of the given addresses, we need to find the SET number of each of the addresses.
A1 = 0x42C8A4, here SET number is (00 1000) which includes the last 2 bits of C(1100) and binary representation of 8 (1000).
A2 = 0x546888, here SET number is (10 1000) which includes the last 2 bits of 6(0110) and binary representation of 8 (1000).
A3 = 0x6A289C here SET number is (10 1000) which includes the last 2 bits of 2(0010) and binary representation of 8 (1000).
A4 = 0x5E4880 here SET number is (00 1000) which includes the last 2 bits of 4 (0100) and binary representation of 8 (1000).
From the given options option-4 is TRUE as A2, A3 are mapped to the same cache SET.
 Question 41

For n>2, let a ∈ {0,1}n be a non-zero vector. Suppose that x is chosen uniformly at random from {0,1}n. Then, the probability that  is an odd number is _____.

 A 0.5
Engineering-Mathematics       Probability
Question 41 Explanation:
‘a’ is a non-zero vector such that a∈{0,1}n
‘x’ is a vector chosen randomly from {0,1}n
‘a’ can have 2(n-1) possibilities, x can have 2n possibilities.
∑aixi have (2n-1)(2n) possibilities, which is an even number of outcomes.
For example:
Take n=3
a = {001, 010, 100, 011, 101, 111}
x = {000, 001, 010, 011, 100, 101, 110, 111}
Computed as [001]×[000] = 0+0+0 = 0 Output = even
[001]×[001] = 0+0+1 = 0 Output = odd
Similarly, there could be 28 even, 28 odd outputs for the a(size=7), x(size=8) of total 56 outputs.
 Question 42

Graph G is obtained by adding vertex s to K3,4 and making s adjacent to every vertex of K3,4. The minimum number of colours required to edge-colour G is _____.

 A 7
Engineering-Mathematics       Graph-Theory
Question 42 Explanation:
In k3x4 there are two sets with sizes 3,4. (it is a complete bipartite graph).
The vertex in the set of size 3 has 4 edges connected to 4 vertices on other set. So, edge color of G is max(3,4) i.e. 4.
When a vertex is added to the graph with 7 vertices ( K3x4 has 7 vertices), there would be 7 edges associated to that new vertex. As per the edge coloring “no two adjacent edges have same color).
As the new vertex with 7 edges need to be colored with 7 colors, the edge color of graph G is 7.
 Question 43

An organization requires a range of IP addresses to assign one to each of its 1500 computers. The organization has approached an Internet Service Provider (ISP) for this task. The ISP uses CIDR and serves the requests from the available IP address space 202.61.0.0/17. The ISP wants to assign an address space to the organization which will minimize the number of routing entries in the ISP’s router using route aggregation. Which of the following address spaces are potential candidates from which the ISP can allot any one to the organization?

```I. 202.61.84.0/21
II. 202.61.104.0/21
III. 202.61.64.0/21
IV. 202.61.144.0/21 ```
 A I and II only B III and IV only C II and III only D I and IV only
Question 43 Explanation:
Given CIDR IP is 202.61.0.0/17 and for HID 32 - 17 = 15 bits can be used.
And to Assign an IP address for 1500 computer, we require 11 bit from HID part.
So NID + SID = 17 + 4 = 21 bits and HID = 11 bits
NID HID
202.61.0 0000 000.00000000
So, from the given option, possible IP Address is
I. 84 -> 0 1010 100 (Because in HID bit 1 is not possible)
II. 104 -> 0 1101 000
III. 64 -> 0 1000 000
IV. 144 -> 1 0010 000 (Because in NID bit 1 is not possible )
 Question 44

Consider a relational table R that is in 3NF, but not in BCNF. Which one of the following statements is TRUE?

 A A cell in R holds a set instead of an atomic value. B R has a nontrivial functional dependency X→A, where X is not a superkey and A is a non-prime attribute and X is not a proper subset of any key. C R has a nontrivial functional dependency X→A, where X is not a superkey and A is a non-prime attribute and X is a proper subset of some key. D R has a nontrivial functional dependency X→A, where X is not a superkey and A is a prime attribute.
Database-Management-System       Normalization
Question 44 Explanation:
R(ABCD)
FDs:
AB → C
BC → A
(BD)+ = BD ✖
(ABD)+ = ABDC ✔
(CBD)+ = CBDA ✔
Candidate keys = {ABD, CBD}
• The relation R is in 3NF, as there are no transitive dependencies.
• The relation R is not in BCNF, because the left side of both the FD’s are not Super keys.
• In R, BC → A is a non-trivial FD and in which BC is not a Super key and A is a prime attribute.
 Question 45

Consider a database implemented using B+ tree for file indexing and installed on a disk drive with block size of 4 KB. The size of search key is 12 bytes and the size of tree/disk pointer is 8 bytes. Assume that the database has one million records. Also assume that no node of the B+ tree and no records are present initially in main memory. Consider that each record fits into one disk block. The minimum number of disk accesses required to retrieve any record in the database is ______.

 A 4
Database-Management-System       File-System
Question 45 Explanation:
Block factor = 4096/20 = 204
(1) Database BF = 1
No. of block = 106 } ➝ 1 block access from database
(2) ⎡106/204⎤ = 491
(3) ⎡491/204⎤ = 3
(4) ⎡3/204⎤ = 1
So, 1+3 = 4 disk accesses are required to retrieve any record in the database.
 Question 46

A processor has 64 registers and uses 16-bit instruction format. It has two types of instructions: I-type and R-type. Each I-type instruction contains an opcode, a register name, and a 4-bit immediate value. Each R-type instruction contains an opcode and two register names. If there are 8 distinct I-type opcodes, then the maximum number of distinct R-type opcodes is _____.

 A 14
Computer-Organization       Registers
Question 46 Explanation:
Instruction is of size 16-bits.
All possible binary combinations = 216
There are 64 registers, so no. of bits needed to identify a register = 6
I-type instruction has (Opcode+Register+4-bit immediate value). There are 8 distinct I-type instructions.
All the binary combinations possible with the I-type instructions are = 8*26*24 = 213
R-type instructions have 2 register operands.
Let x be the number of R-type instructions.
All the possible binary combinations of R-type instructions = x*26*26 = x*212
The sum of I-type and R-type binary combinations should be equal to 216.
x*212 + 213 = 216
212 (x+2) = 216
x+2 = 24
x = 16 - 2 = 14
 Question 47

Which one of the following predicate formulae is NOT logically valid?
Note that W is a predicate formula without any free occurrence of x.

 A ∃x(p(x) → W) ≡ ∀x p(x) → W B ∀x(p(x) → W) ≡ ∀x p(x) → W C ∃x(p(x) ∧ W) ≡ ∃x p(x) ∧ W D ∀x(p(x) ∨ W) ≡ ∀x p(x) ∨ W
Engineering-Mathematics       Propositional-Logic
Question 47 Explanation:
Basic Rules:
~p→q ≡ ~p∨q
Demorgan laws:
~(∀x(a(x)) ≡ ∃x~a(x)
~(∃x(a(x)) ≡ ∀x~a(x)
(A) ∃x(p(x)→w) ≡ ∀x p(x)→w
LHS: ∃x(p(x)→w) ≡ ∃x(~p(x)∨w)
≡ ∃x(~p(x))∨w
Demorgan’s law:
~(∀x(a(x)) = ∃x ~ a(x)
≡ ~(∀x P(x)) ∨ w
≡ (∀x) P(x) → w ≡ RHS
It’s valid.
(B) ∀x(P(x) → w) ≡ ∀x(~P(x) ∨ w)
≡ ∀x(~P(x)) ∨ w
≡ ~(∃x P(x)) ∨ w
≡ ∃x P(x) → w
This is not equal to RHS.
(C) ∃x(P(x) ∧ w) ≡ ∃x P(x) ∧ w
‘w’ is not a term which contains x.
So the quantifier does not have any impact on ‘w’.
Thus it can be written as
∃x(P(x)) ∧ w) ≡ ∃x P(x) ∧ w
(D) ∀(x)(P(x) ∨ w) ≡ ∀x P(x) ∨ w
‘w’ is not a term which contains ‘x’.
So the quantifier does not have an impact on ‘w’.
Thus ∀(x)(P(x) ∨ w) ≡ ∀x P(x) ∨ w
 Question 48

In a balanced binary search tree with n elements, what is the worst case time complexity of reporting all elements in range [a,b]? Assume that the number of reported elements is k.

 A θ(n log k) B θ(log n + k) C θ(k log n) D θ(log n)
Data-Structures       Binary-Trees
Question 48 Explanation:
The idea is to traverse the given binary search tree starting from root. For every node being visited, check if this node lies in range, if yes, then add 1 to result and recur for both of its children. If the current node is smaller than the low value of range, then recur for right child, else recur for left child.
Time complexity of the above program is O(h + k) where h is the height of BST and k is the number of nodes in a given range.
Here h is log n, hence O(log n+k).
 Question 49

The number of permutations of the characters in LILAC so that no character appears in its original position, if the two L’s are indistinguishable, is _______.

 A 12
Engineering-Mathematics       Combinatorics
Question 49 Explanation:
There are 5 places.
― ― ― ― ―
Given: L I L A C
The derangement formula ⎣n!/e⎦ cannot be directly performed as there are repeated characters.
Let’s proceed in regular manner:
The L, L can be placed in other ‘3’ places as

(1) Can be arranged such that A, I, C be placed in three positions excluding ‘C’ being placed at its own position, which we get only 2×2×1 = 4 ways.
Similarly (2) can be filled as A, I, C being placed such that 4th position is not filled by A, so we have 2×2×1 = 4 ways. Similarly with (3).
Totally, we get 4+4+4 = 12 ways.
 Question 50

Let G = (V,E) be a weighted undirected graph and let T be a Minimum Spanning Tree (MST) of G maintained using adjacency lists. Suppose a new weighted edge (u,v) ∈ V×V is added to G. The worst case time complexity of determining if T is still an MST of the resultant graph is

 A θ(|E|+|V|) B θ(|E| log|V|) C θ(|E||V|) D θ(|V|)
Algorithms       Minimum-Spanning-Tree
Question 50 Explanation:
Method-1:
• As T is a minimum spanning tree and we need to add a new edge to existing spanning tree.
• Later we need to check still T is a minimum spanning tree or not, So we need to check all vertices whether there is any cycle present after adding a new edge.
• All vertices need to traverse to confirm minimum spanning tree after adding new edge then time complexity is O(V).
Method-2:
Time Complexity:
Total vertices: V, Total Edges : E
• O(logV) – to extract each vertex from the queue. So for V vertices – O(VlogV)
• O(logV) – each time a new pair object with a new key value of a vertex and will be done at most once for each edge. So for total E edge – O(ElogV)
• So overall complexity: O(VlogV) + O(ElogV) = O((E+V)logV) = O(ElogV)
Note: Method-1 is the most appropriate answer for giving a question.
 Question 51

Consider the following C functions.

```  int fun1 (int n)  {                              int fun2 (int n)  {
static int i = 0;                                static int i = 0;
if (n > 0)  {                                    if (n > 0)  {
++i;                                              i = i + fun1 (n);
fun1 (n-1);                                       fun2 (n-1);
}                                                 }
return (i);                                           return (i);
}                                                 } ```

The return value of fun2 (5) is _______.

 A 55
Programming       Functions
Question 51 Explanation:
#include
int fun1(int n) {
printf("--fun1 call--\n");
static int i = 0;
if(n>0){
++i;
printf("fun1(%d-1)\n",n);
fun1(n-1);
}
printf("fun1(%d)= %d\n",n, i);
return(i);
}
int fun2(int n) {
printf("\n******* fun2 call ********\n");
static int i = 0;
if(n>0){
printf("%d + fun1(%d)\n", i,n);
i=i+fun1(n);
fun2(n-1);
}
printf("fun2(%d)= %d\n",n, i);
return(i);
}
void main()
{
printf("final = %d\n", fun2(5));
}
Check step by step hand run of the code to understand the recursion:
******* fun2 call ********
0 + fun1(5)
--fun1 call--
fun1(5-1)
--fun1 call--
fun1(4-1)
--fun1 call--
fun1(3-1)
--fun1 call--
fun1(2-1)
--fun1 call--
fun1(1-1)
--fun1 call--
fun1(0)= 5
fun1(1)= 5
fun1(2)= 5
fun1(3)= 5
fun1(4)= 5
fun1(5)= 5
******* fun2 call ********
5 + fun1(4)
--fun1 call--
fun1(4-1)
--fun1 call--
fun1(3-1)
--fun1 call--
fun1(2-1)
--fun1 call--
fun1(1-1)
--fun1 call--
fun1(0)= 9
fun1(1)= 9
fun1(2)= 9
fun1(3)= 9
fun1(4)= 9
******* fun2 call ********
14 + fun1(3)
--fun1 call--
fun1(3-1)
--fun1 call--
fun1(2-1)
--fun1 call--
fun1(1-1)
--fun1 call--
fun1(0)= 12
fun1(1)= 12
fun1(2)= 12
fun1(3)= 12
******* fun2 call ********
26 + fun1(2)
--fun1 call--
fun1(2-1)
--fun1 call--
fun1(1-1)
--fun1 call--
fun1(0)= 14
fun1(1)= 14
fun1(2)= 14
******* fun2 call ********
40 + fun1(1)
--fun1 call--
fun1(1-1)
--fun1 call--
fun1(0)= 15
fun1(1)= 15
******* fun2 call ********
fun2(0)= 55
fun2(1)= 55
fun2(2)= 55
fun2(3)= 55
fun2(4)= 55
fun2(5)= 55
final = 55
 Question 52

Consider the array representation of a binary min-heap containing 1023 elements. The minimum number of comparisons required to find the maximum in the heap is _______.

 A 511
Data-Structures       Heap-Tree
Question 52 Explanation:
The binary heap contains 1023 elements. When it performs minimum comparisons it will take Ceil(n/2)
n=1023
= Ceil(1023/2)
= 512
So, the maximum element is also part of n/2.
So, we have to subtract from the total elements
= 512-1
= 511
 Question 53

Let A and B be two n×n matrices over real numbers. Let rank(M) and det(M) denote the rank and determinant of a matrix M, respectively. Consider the following statements,

I. rank(AB) = rank(A) rank(B)
II. det(AB) = det(A) det(B)
III. rank(A + B) ≤ rank(A) + rank(B)
IV. det(A + B) ≤ det(A) + det(B)

Which of the above statements are TRUE?

 A I and II only B I and IV only C III and IV only D II and III only
Engineering-Mathematics       Linear-Algebra
Question 53 Explanation:
Rank(AB) ≥ Rank(A) + Rank(B) − n. So option I is wrong.
Rank is the number of independent rows(vectors) of a matrix. On product of two matrices, the combined rank is more than the sum of individual matrices (subtracted with the order n)
det(AB) = det(A)∙det(B) as the magnitude remains same for the matrices after multiplication.
Note: We can just take a 2x2 matrix and check the options.
 Question 54

Each of a set of n processes executes the following code using two semaphores a and b initialized to 1 and 0, respectively. Assume that count is a shared variable initialized to 0 and not used in CODE SECTION P.

```wait (a); count = count+1;
if (count==n) signal (b);
signal (a); wait (b); signal (b);```

What does the code achieve?

 A It ensures that all processes execute CODE SECTION P mutually exclusively. B It ensures that at most two processes are in CODE SECTION Q at any time. C It ensures that no process executes CODE SECTION Q before every process has finished CODE SECTION P. D It ensures that at most n-1 processes are in CODE SECTION P at any time.
Operating-Systems       Process-Synchronization
Question 54 Explanation:
The wait(a) ensures that the count value is correctly incremented (no race condition) if(count==n) signal (b); // This signal(b) statement is executed by the last (nth) process only. Rest of the n-1 processes are blocked on wait(b). Once the nth process makes signal(b) then the rest of the processes can proceed and enter Code section Q.
 Question 55

Consider the productions A⟶PQ and A⟶XY. Each of the five non-terminals A, P, Q, X, and Y has two attributes: s is a synthesized attribute, and i is an inherited attribute. Consider the following rules.

```    Rule 1: P.i = A.i + 2, Q.i = P.i + A.i, and A.s = P.s + Q.s
Rule 2: X.i = A.i + Y.s and Y.i = X.s + A.i ```

Which one of the following is TRUE?

 A Only Rule 2 is L-attributed. B Neither Rule 1 nor Rule 2 is L-attributed. C Both Rule 1 and Rule 2 are L-attributed. D Only Rule 1 is L-attributed.
Compiler-Design       Synthesized-Attribute
Question 55 Explanation:
In rule 2 for production A -> XY the attribute “i” is calculated from the right sibling Y in X.i = A.i + Y.s which is violating the L attribute definition, as in L attribute calculating attribute vale from RHS sibling is not allowed.
 Question 56

Consider a TCP connection between a client and a server with the following specifications: the round trip time is 6 ms, the size of the receiver advertised window is 50 KB, slow start threshold at the client is 32 KB, and the maximum segment size is 2 KB. The connection is established at time t=0. Assume that there are no timeouts and errors during transmission. Then the size of the congestion window (in KB) at time t+60 ms after all acknowledgements are processed is ______.

 A 44
Computer-Networks       TCP-Congestion-Window
Question 56 Explanation:
Threshold = 32 Kb, MSS = 2KB, RTT = 6ms
Here, t + 60 is nothing but at the 10 RTT (60/6 = 10), but here it’s asking after all acknowledgement are processed it means after the 10th RTT, i.e., at the 11RTT.
1st transmission: 2 KB
2nd transmission: 4 KB
3rd transmission: 8 KB
4th transmission: 16 KB
5th transmission: 32 KB (Threshold reached)
6th transmission: 34 KB
7th transmission: 36 KB
8th transmission: 38 KB
9th transmission: 40 KB
10th transmission: 42 KB
At the completion of 10th transmission RTT = 10*6 = 60 ms
For the 11th transmission, The congestion window size is 44 KB.
 Question 57

Consider the Boolean function z(a,b,c).

Which one of the following minterm lists represents the circuit given above?

 A Z = ∑(0,1,3,7) B Z = ∑(2,4,5,6,7) C Z = ∑(1,4,5,6,7) D Z = ∑(2,3,5)
Digital-Logic-Design       Logic-Gates
Question 57 Explanation:
The output of the given circuit is a + b’c.
Convert a+b’c into canonical form which is sum of minterms.
a + b’c = a(b + b’)(c + c’) + (a + a’)b’c
= abc + abc’ + ab’c + ab’c’ + ab’c + a’b’c
= Σ(7,6,5,4,1)
 Question 58

Consider three registers R1, R2 and R3 that store numbers in IEEE-754 single precision floating point format. Assume that R1 and R2 contain the values (in hexadecimal notation) 0x42200000 and 0xC1200000, respectively.

If R3 = R1/R2, what is the value stored in R3?

 A 0x40800000 B 0x83400000 C 0xC8500000 D 0xC0800000
Digital-Logic-Design       Number-Systems
Question 58 Explanation:
Given numbers are 0x42200000 and 0xC1200000 which are stored in the registers R1 and R2, respectively.

R1 = 1.0100..0 X 2132-127
= 1.0100..0 X 25
= 101.0 X 23
= 5 X 8
= 40

R2 = (-1) x 1.0100..0 X 2130-127
= (-1) x 1.0100..0 X 23
= (-1) x 101.0 X 21
= (-1) x5 X 2
= -10
R3 = R1/R2
= -4
= (-1)x 1.0 x 22
Sign = 1
Mantissa = 000..0
Exponent = 2+127 = 129

R3 = 1100 0000 1000 000..0
= 0x C 0 8 0 0 0 0 0
 Question 59

Consider the following five disk access requests of the form (request id, cylinder number) that are present in the disk scheduler queue at a given time.

`         (P, 155), (Q, 85), (R, 110), (S, 30), (T, 115) `

Assume the head is positioned at cylinder 100. The scheduler follows Shortest Seek Time First scheduling to service the requests.

Which one of the following statements is FALSE?

 A The head reverses its direction of movement between servicing of Q and P. B T is serviced before P. C R is serviced before P. D Q is serviced after S, but before T.
Operating-Systems       Disk-Scheduling
Question 59 Explanation:
(P,155)(Q,85)(R,110)(S,30)(T,115)
 Question 60

Consider a graph G = (V, E), where V = {v1, v2, …, v100}, E = {(vi, vj) | 1 ≤ i < j ≤ 100}, and weight of the edge (vi, vj) is |i - j|. The weight of the minimum spanning tree of G is ______.

 A 99
Algorithms       Minimum-Spanning-Tree
Question 60 Explanation:
• If there are n vertices in the graph, then each spanning tree has n − 1 edges.
• N =100
• Edge weight is |i-j| for Edge (vi,vj) {1<=i<=100}
• The weight of edge(v1,v2) is 1 , edge(v5,v6) is 1.
• So, 99 edges of weight is 99.
 Question 61
Consider the following C functions.
int tob (int b, int* arr) {
int i;
for (i=0; b>0; i++) {
if (b%2) arr [i] = 1;
else arr [i] = 0;
b = b/2;
}
return (i);
}

int pp (int a, int b) {
int arr [20];
int i, tot = 1, ex, len;
ex = a;
len = tob (b,arr);
for (i=0; i if (arr[i] == 1)
tot = tot * ex;
ex = ex * ex;
}
return (tot);
}
The value returned by pp(3,4) is ________.
 A 81
Programming       Functions
Question 61 Explanation:
pp(3,4) ⇒
a=3,b=4
tot=1
ex=a=3
len=tob(b,arr) which is 3
[
tob(4,arr)==>
b=4
b%2 =4%2=0 Condition is false then arr[0]=0
=> b=b/2 =4/2 =2
b=2
b%2 =2%2=0 condition is false then arr[1]=0
=>b=b/2=2/2=1
b=1
then b%2=1%2 condition is true then arr[2]=1
=>b=b/2=1/2=0
The i value is 3 [length is 3]
]
i=0,
arr[0] ==1 condition is false
ex=3*3=9
i=1
arr[1]==1 condition is false
then
ex=9*9=81
i=2
then arr[2]==1 condition is true
tot=tot*ex=1*81=81
ex=81*81
Finally it returns tot value which 81.
 Question 62

Which of the following languages are undecidable? Note that indicates encoding of the Turing machine M.

L1 = | L(M) = Φ}
L2 = {| M on input w reaches state q in exactly 100 steps}
L3 = {| L(M) is not recursive}
L4 = {| L(M) contains at least 21 members}
 A L2 and L3 only B L1 and L3 only C L2, L3 and L4 only D L1, L3 and L4 only
Theory-of-Computation       Decidability-and-Undecidability
Question 62 Explanation:
L1 is undecidable as emptiness problem of Turing machine is undecidable. L3 is undecidable since there is no algorithm to check whether a given TM accept recursive language. L4 is undecidable as it is similar to membership problem.
Only L3 is decidable. We can check whether a given TM reach state q in exactly 100 steps or not. Here we have to check only upto 100 steps, so here is not any case of going to infinite loop.
 Question 63

Consider a paging system that uses a 1-level page table residing in main memory and a TLB for address translation. Each main memory access takes 100 ns and TLB lookup takes 20 ns. Each page transfer to/from the disk takes 5000 ns. Assume that the TLB hit ratio is 95%, page fault rate is 10%. Assume that for 20% of the total page faults, a dirty page has to be written back to disk before the required page is read in from disk. TLB update time is negligible. The average memory access time in ns (round off to 1 decimal places) is ______.

 A 154.5 ns
Operating-Systems       Memory-Management
Question 63 Explanation:
M=100ns
T=20ns
D=5000ns
h=0.95
p=0.1, 1-p=0.9
d=0.2, 1-d=0.8
EMAT = h×(T+M)+(1-h)[(1-p)×2M+p[(1-d)[D+M]+d(2D+M)]+T]
= 0.95×(20+100)+(1-0.95)[(1-0.1)×200+(0.1)[(1-0.2)[5000+100]+(0.2)(10000+100)]+20]
= 154.5 ns
 Question 64

Consider the following language.

`   L = {x ∈ {a,b}* | number of a’s in x is divisible by 2 but not divisible by 3} `

The minimum number of states in a DFA that accepts L is ______.

 A 6
Theory-of-Computation       Finite-Automata
Question 64 Explanation:
DFA 1: No. of a’s divisible by 2.

DFA 1: No. of a’s not divisible by 3

Using product automata:
 Question 65

Consider the following languages.

L1 = {wxyx | w,x,y ∈ (0 + 1)+}
L2 = {xy | x,y ∈ (a + b)*, |x| = |y|, x ≠ y}

Which one of the following is TRUE?

 A L1 is context-free but not regular and L2 is context-free. B Neither L1 nor L2 is context-free. C L1 is regular and L2 is context-free. D L1 is context-free but L2 is not context-free.
Theory-of-Computation       Languages-and-Grammars
Question 65 Explanation:
L1 is regular. y can be expanded and w can also expanded. So x can be either "a" or "b".
So it is equivalent to
(a+b)+ a (a+b)+ a + (a+b)+ b (a+b)+ b
L2 is CFL since it is equivalent to complement of L=ww.
Complement of L=ww is CFL.
There are 65 questions to complete.