Gate2004
Question 1 
have well indented programs
 
be able to infer the flow of control from the compiled code
 
be able to infer the flow of control from the program text
 
avoid the use of GOTO statements

Question 2 
call swap (x, y)
 
call swap (&x, &y)
 
swap (x,y) cannot be used as it does not return any value
 
swap (x,y) cannot be used as the parameters are passed by value

Here parameters passed by value in C then there is no change in the values.
Option B:
Here values are not swap.
Here parameters are passed by address in C.
Option C:
It is false. Return value is not valid for exchanging the variables.
Option D:
It is correct.
We cannot use swap(x,y) because parameters are passed by value.
Only exchanging the values (or) variables are passing their address and then modify the content with the help of dereferencing operator(*).
Question 3 
(top1 = MAXSIZE/2) and (top2 = MAXSIZE/2+1)
 
top1 + top2 = MAXSIZE
 
(top1 = MAXSIZE/2) or (top2 = MAXSIZE)
 
top1 = top2 – 1

Question 4 
2  
3  
4  
6 
Height of the binary search tree = 3
Question 5 
queue
 
stack  
tree
 
list 
While evaluating when left parentheses occur then it push in to the stack, when right parentheses occur pop from the stack.
While at the end there is empty in the stack.
Question 6 
preorder traversal  
inorder traversal
 
depth first search
 
breadth first search

It is an algorithm for traversing (or) searching tree (or) graph data structures. It starts at the root and explores all of the neighbour nodes at the present depth prior to moving on to the nodes at the next depth level.
Question 7 
i only
 
ii only
 
i and ii only
 
iii or iv

Hash function = x mod 10
Hash values = (2, 4, 1, 9, 9, 1, 3, 9)
9679, 1989, 4199 have same hash values
&
1471, 6171 have same hash values.
Question 8 
(i) only
 
(i) and (iii) only
 
(ii) and (iii) only
 
(iii) and (iv) only

i) On RHS it contains two adjacent nonterminals.
ii) Have nullable values.
Question 9 
Edit time  
Compile time
 
Link time
 
Load time 
Question 10 
E_{1} should be evaluated first
 
E_{2} should be evaluated first
 
Evaluation of E_{1} and E_{2} should necessarily be interleaved
 
Order to evaluation of E_{1} and E_{2} is of no consequence

Question 11 
(ii), (iii) and (iv) only
 
(ii) and (iii) only
 
(i) and (iii) only
 
(i) and (ii) only

→ If one user level thread perform blocking operation then entire process will be blocked. Option B is true.
→ User level threads are threads are transparent to the kernal. Because user level threads are created by users. Option D is true.
→ Kernal supported threads can be scheduled independently, that is based on OS. Option C is true.
Question 12 
Consider an operating system capable of loading and executing a single sequential user process at a time. The disk head scheduling algorithm used is First Come First Served (FCFS). If FCFS is replaced by Shortest Seek Time First (SSTF), claimed by the vendor to give 50% better benchmark results, what is the expected improvement in the I/O performance of user programs?
50%  
40%  
25%  
0% 
→ The better vendor benchmark results doesn't effects the I/O performance.
→ In FCFS (or) SSTF only one choice is to choose for IO from multiple IO's. There is always one I/O at a time.
Question 13 
Let R_{1} (A, B, (D)) and R_{2} (D, E) be two relation schema, where the primary keys are shown underlined, and let C be a foreign key in R_{1} referring to R_{2}. Suppose there is no violation of the above referential integrity constraint in the corresponding relation instances r_{1} and r_{2}. Which one of the following relational algebra expressions would necessarily produce an empty relation?
Π_{D}(r_{2})  Π_{C}(r_{1})
 
Π_{C}(r_{1})  Π_{D}(r_{2})
 
Π_{D}(r_{1}⨝_{C≠D}r_{2})
 
Π_{C}(r_{1}⨝_{C=D}r_{2})

→ Based on referral integrity C is subset of values in R_{2} then,
Π_{C}(r_{1})  Π_{D}(r_{2}) results empty relation.
Question 14 
8, 8  
120, 8
 
960, 8
 
960, 120 
→ In the question only enroll Id's are same with the student table.
→ The no. of minimum and maximum tuples is same i.e., 8, 8.
Question 15 
P  1, Q  4, R  3
 
P  2, Q  4, R  1
 
P  2, Q  3, R  1
 
P  1, Q  3, R  2

Transport Layer :: Fourth layer of the OSI Model, Responsible for Service point addressing/Socket to socket connection or end to end connection with full reliability.
Network Layer :: Third layer of the OSI Model, Responsible for Host to Host.
Question 16 
Both bridge and router selectively forward data packets
 
A bridge uses IP addresses while a router uses MAC addresses
 
A bridge builds up its routing table by inspecting incoming packets  
A router can connect between a LAN and a WAN

Question 17 
x' + y'
 
x + y
 
x + y'
 
x' + y

= x'y' + x'y + xy
= x'(y'+y)+xy
= x'⋅1+xy
= x'+xy
= (x'+x)(x'+y)
= 1⋅(x'+y)
= x'+y
Question 18 
Q = 0, Q' = 1
 
Q = 1, Q' = 0
 
Q = 1, Q' = 1
 
Indeterminate states

Truth table for the SR latch by cross coupling two NAND gates is
So, Answer is Option (D).
Question 19 
8, 16
 
10, 12  
9, 13
 
8, 11

7x+3 = 5y+4
7x5y = 1
Only option (D) satisfies above equation.
Question 20 
(i) and (iv)
 
(i) and (ii)
 
(ii) and (iii)
 
(i), (ii) and (iv)

A fixed address in memory which indicates a location by specifying a distance from another location. In this displacement type addressing is preferred.
So, option A is false.
Based Addressing:
This scheme is used by computers to control access to memory. In this pointers are replaced by protected objects which can be executed by kernal (or) some other privileged process authors.
So, this is suitable for program relocation at runtime.
Relative Addressing:
The offset of the relative addressing is to allow reference to code both before and after the instruction.
This is also suitable.
Indirect Addressing:
Which leads to extra memory location which can be not suitable at run time.
This is not suitable.
→ Only Based Addressing and Relative Addressing are suitable.
Question 21 
the instruction set architecture
 
page size
 
physical memory size
 
number of processes in memory

→ An ISA permits multiple implementations that may vary in performance, physical size and monetary cost.
Question 22 
600  
800  
876  
1200 
So bit rate is 9600 bps.
To send one char we need to send (1 + 8 + 2 +1) = 12
So total char send = 9600 / 12 = 800
Question 23 
(∃x) (boy(x) → (∀y) (girl(y) ∧ taller(x,y)))
 
(∃x) (boy(x) ∧ (∀y) (girl(y) ∧ taller(x,y)))
 
(∃x) (boy(x) → (∀y) (girl(y) → taller(x,y)))
 
(∃x) (boy(x) ∧ (∀y) (girl(y) → taller(x,y)))

'∧' → predicts statements are always true, no matter the value of x.
'→' → predicts there is no need of left predicate to be true always, but whenever it becomes true, then right predicate must be true.
Option D:
There exists a some boys who are taller than of all girls y.
Question 24 
{(x, y)y > x and x, y ∈ {0, 1, 2, ... }}  
{(x, y)y ≥ x and x, y ∈ {0, 1, 2, ... }}
 
{(x, y)y < x and x, y ∈ {0, 1, 2, ... }}
 
{(x, y)y ≤ x and x, y ∈ {0, 1, 2, ... }}

Answer is option B.
{(x, y)y ≥ x and x, y ∈ {0, 1, 2, ... }}
Question 25 
3/8  
1/2  
5/8  
3/4 
Then total number of possibilities = 2^{4} = 16
No. of possibilities getting 2 heads and 2 tails is
HHTT, HTHT, TTHH, THTH, THHT, HTTH = 6
Probability of getting 2 heads and 2 tails is
= No. of possibilities/Total no. of possibilities = 6/16 = 3/8
Question 26 
power (2,n)
 
power (2,n^{2})
 
power (2, (n^{2} + n)/2)
 
power (2, (n^{2}  n)/2)

A [i] [j] = A [j] [i]
So, we have only two choices, they are either upper triangular elements (or) lower triangular elements.
No. of such elements are
n + (n1) + (n2) + ... + 1
n(n+1)/2
We have two choices, thus we have
2^{(n(n+1)/2)} = 2^{((n2+n)/2) choices i.e., Power (2, (n2+n)/2). }
Question 27 
D^{1}C^{1}A^{1}
 
CDA
 
ADC
 
Does not necessarily exist

ABCD = I
Pre multiply A^{1} on both sides
A^{1}ABCD = A^{1}⋅I
BCD = A^{1}
Pre multiply B^{1} on both sides
B^{1}BCD = B^{1}A^{1}
CD = B^{1}A^{1}
Post multiply A on both sides
CDA = B^{1}A^{1}⋅A
∴ CDA = B^{1}(I)
∴ CDA = B^{1}
Question 28 
9.51 and 10.0 respectively
 
10.0 and 9.51 respectively
 
9.51 and 9.51 respectively
 
10.0 and 10.0 respectively

= (2) + 7.51
= 9.51 (✔️)
113. + (111. + 7.51)
= 113. + (103.51)
= 113. + 103
= 10 (✔️)
Question 29 
n  
n^{2}  
nlogn  
nlog^{2}n 
→Tightest upper bound is (big O).
Tightest lower bound is (big Ω).
Question 30 
both in P  
both NP complete
 
NPcomplete and in P respectively
 
undecidable and NPcomplete respectively

2SAT and 3SAT is a NPcomplete.
Question 32 
n = d_{1}d_{2}…d_{mi} and rev = d_{m}d_{m1}…d_{mi+1}
 
n = d_{mi+1}…d_{m1}d_{m} or rev = d_{mi}…d_{2}d_{1}
 
n ≠ rev  
n = d_{1}d_{2}…d_{m} and rev = d_{m}…d_{2}d_{1}

Question 33 
gnirts  
string
 
gnirt  
no output is printed

P[0] = S[71] = S[6] = \0.
In P[ ], the first character is '\0'. Then it will results a empty string. If P[0] become '\0', then it doesn't consider about next values in sequence.
Question 34 
(i), (iv), (vi), (viii)
 
(i), (iv), (vii)  
(i), (iii), (v), (vi), (viii)
 
(ii), (v), (viii)

Question 35 
(i) only  
(ii), (iii)
 
(iii) only
 
(iv) only

(i) Inorder and Preorder
(ii) Inorder and Postorder
(iii) Inorder and Levelorder
→And following are do not
(i) Post order and Preorder
(ii) Pre order and Level order
(iii) Post order and Level order
Question 36 
rear node
 
front node
 
not possible with a single pointer
 
node next to front

Question 37 
Question 38 
abc×+def^^
 
abc×+de^f^
 
ab+c×de^f^
 
+a×bc^^def

Note: When low precedence operator enters into stack then pop.
Question 39 
best if A is in rowmajor, and B is in column major order
 
best if both are in rowmajor order
 
best if both are in columnmajor order
 
independent of the storage scheme

But if the question would have asked best time complexity in which of the following implementation (not algorithm) then Option (A) is correct.
Question 40 
union only
 
intersection, membership
 
membership, cardinality
 
union, intersection

Let no. of elements in list 2 be n_{2}.
Union:
To union two lists, for each element in one list we will search in other list, to avoid duplicates. So, time complexity will be O(n_{1}×n_{2}).
Intersection:
To take intersection of two lists, for each element in one list we will search in other list if it is present or not. So time complexity will be O(n_{1} × n_{2}).
Membership:
In this we search if particular element is present in the list or not. So time complexity will be O(n_{1} + n_{2}).
Cardinality:
In this we find the size of set or list. So to find size of list we have to traverse each list once. So time complexity will be O(n_{1}+n_{2}).
Hence, Union and Intersection will be slowest.
Question 41 
x + y using repeated subtraction
 
x mod y using repeated subtraction
 
the greatest common divisor of x and y
 
the least common multiple of x and y

Question 42 
log m
 
m^{2}  
m^{1/2}
 
m^{1/3} 
x = (x + m/x)/2
2x = x^{2}+m/x
2x^{2} = x^{2} + m
x^{2} = m
x = √m = m^{1/2}
Question 43 
The number of leaf nodes in the tree
 
The number of nodes in the tree
 
The number of internal nodes in the tree
 
The height of the tree

→ So given that pointer to root of tree is passed to DoSomething ( ), it will return height of the tree. It is done when the height of single node is '0'.
Question 44 
P, Q, R, S, T, U
 
P, Q, R, U, S, T
 
P, Q, R, U, T, S
 
P, Q, T, R, U, S

P, Q, R, U, S, T
Question 45 
200  
180  
160  
40 
2 # 3 & 5 # 6 & 4
→ Here # means multiplication (*)
& means addition (+)
→ & is having more precedence because it is far from starting symbol, here # and & are left associatives.
2 # 3 & 5 # 6 & 4
⇒ (2 * (3+5)) * (6+4)
⇒ (2 * 8) * (10)
⇒ 16 * 10 = 160
Question 46 
5.50  
5.75  
6.00  
6.25 
Avg. TAT = 12+3+6+1/4 = 22/4 = 5.50
Question 47 
Consider a system with a twolevel paging scheme in which a regular memory access takes 150 nanoseconds, and servicing a page fault takes 8 milliseconds. An average instruction takes 100 nanoseconds of CPU time, and two memory accesses. The TLB hit ratio is 90%, and the page fault rate is one in every 10,000 instructions. What is the effective average instruction execution time?
645 nanoseconds
 
1050 nanoseconds
 
1215 nanoseconds
 
2060 nanoseconds 
= 100ns + 2EMAT
Now lets calculate EMAT,
EMAT = TLB + miss rate × 2 × 150ns + 150ns + 1/10000 × 8ms
= 0 + 0.1 × 300ns + 150ns + 800ns
= 980ns
∴ Effective average instruction time,
= 100ns + 2 × 980ns
= 2060ns
Question 48 
P(S_{y}), P(S_{x}); P(S_{x}), P(S_{y})
 
P(S_{x}), P(S_{y}); P(S_{y}), P(S_{x})
 
P(S_{x}), P(S_{x}); P(S_{y}), P(S_{y})
 
P(S_{x}), P(S_{y}); P(S_{x}), P(S_{y})

P_{1} : line 1
P_{2} : line 3 (block require S_{x})
P_{1} : line 2
P_{2} : line 4 (still in block state)
P_{1} : execute CS, the push up the value of S_{x}.
P_{2} : line 3 line 4 (block require S_{y})
P_{1} : push up S_{y}
P_{2} : line 4 get S_{y} and enter into CS
P_{2} : start execution.
So option D is Answer.
Question 49 
2^{24} bytes
 
2^{32} bytes
 
2^{34} bytes  
2^{48} bytes

= 10 + 2^{8} + (2^{8})^{2} + (2^{8})^{3}
= 2^{24} Blocks (App)
Size of each block = 2^{10}
Maximum file size = 2^{24} × 2^{10} = 2^{34}
Question 50 
2 NF
 
3 NF
 
BCNF
 
4NF

name, courseNo → grade →(I)
rollNo, courseNo → grade →(II)
name → rollNo →(III)
rollNo → name →(IV)
Candidate keys: name, courseNo (or) rollNo
Its is not BCNF, because the relation III, there is no relationship from super key.
name → rollNo
It is not BCNF, name is not super key.
It belongs to 3NF, because if X→Y, Y is prime then it is in 3NF.
Question 51 
names of girl students with the highest marks
 
names of girl students with more marks than some boy student
 
names of girl students with marks not less than some boy students
 
names of girl students with more marks than all the boy students

Question 52 
24  
25  
26  
27 
Child pointer = 6 bytes
key size = 14 bytes
Block size = 512 bytes
⇒ 512 = (n1)14 + n(6)
512 = 20n  14
n = 512+14/20 = 526/20 = 26.3
∴ n = 26
Question 53 
the average salary is more than the average salary in the company
 
the average salary of male employees is more than the average salary of all male employees in the company
 
the average salary of male employees is more than the average salary of employees in the same department
 
the average salary of male employees is more than the average salary in the company

This results the employees who having the salary more than the average salary.
Sex = M
Selects the Male employees whose salary is more than the average salary in the company.
Question 54 
A and B are the only two stations on an Ethernet. Each has a steady queue of frames to send. Both A and B attempt to transmit a frame, collide, and A wins the first backoff race. At the end of this successful transmission by A, both A and B attempt to transmit and collide. The probability that A wins the second backoff race is
0.5  
0.625  
0.75  
1.0 
The probability that A wins the second backoff race = 5/8 = 0.625
More explanation in the video.
Question 55 
Eth1 and Eth2  
Eth0 and Eth2
 
Eth0 and Eth3
 
Eth1 and Eth3 
If results of ANDing subnet masks and IP address are same then subnet mask with higher number of 1s is preferred.
IP address 128.75.43.16 is AND with 255.255.255.0 results 128.75.43.0 Net ID which is similar to destination of this mask, but ANDing 128.75.43.16 with 255.255.255.128 also results same destination. So, here, mask with higher number of one is considered and router will forward packet to Eth1.
ANDing 192.12.17.10 with three subnet mask in table does not result in destination Net ID so router will forward this packet to default network via Eth2.
Question 56 
200  
220  
240  
260 
Data will be divided in three packets as:
First packet: 80 bytes + 20 byte of header
Second packet: 80 bytes + 20 byte of header
Third packet: 40 bytes + 20 byte of header
Note: Defragmentation (grouping of fragments) is done only at destination.
H_{C} will receive total 260 bytes including header.
Question 57 
325.5 Kbps
 
354.5 Kbps  
409.6 Kbps
 
512.0 Kbps

Application data is transferred at rate of (180/260) x 512 Kbps = 354.46 Kbps
Question 58 
2  
3  
4  
5 
= A + BD + BC
= A + B (D + C)
So minimum two OR gates and 1 AND gate is required. Hence, in total minimum 3 gates is required.
Question 59 
a^{ȼ}c and ac^{ȼ}
 
a^{ȼ}c and b^{ȼ}c
 
a^{ȼ}c only
 
ac^{ȼ} and bc^{ȼ}

There are two EPI,
A'C and AC'.
Question 60 
R to X, 1 to Y, T to Z
 
T to X, R to Y, T to Z
 
T to X, R to Y, 0 to Z
 
R to X, 0 to Y, T to Z

f = z'x + zy
Put z=T, x=R, y=1 in f
f = T'R + T = (T+T') (R+T) = T+R
Hence, correct option is (A).
Question 61 
Q_{2}^{c}
 
Q_{2} + Q_{1}
 
(Q_{1} + Q_{2})^{c}
 
Q_{1} ⊕ Q_{2}

0  2  3  1  0
or
00  10  11  01  00
From the given sequence, we have state table as,
Now we have present state and next state, so we should use excitation table of T flipflop,
From state table,
Question 62 
A 4bit carry lookahead adder, which adds two 4bit numbers, is designed using AND, OR, NOT, NAND, NOR gates only. Assuming that all the inputs are available in both complemented and uncomplemented forms and the delay of each gate is one time unit, what is the overall propagation delay of the adder? Assume that the carry network has been implemented using twolevel ANDOR logic.
4 time units
 
6 time units
 
10 time units
 
12 time units

1) (2 time units) In 2 time units we can compute G_{i} and P_{i} in parallel, 2 time units for P_{i} since its an XOR operation and 1 time unit for G_{i} sinceits an AND operation.
2) (2 time units) Once G_{i} and P_{i} are available, we can calculate the carries, C_{i}, in 2 time units.
Level1 we can compute all the conjunctions (AND). Example P_{3}G_{2}, P_{3}P_{2}G_{1}, P_{3}P_{2}P_{1}G_{0} and P_{3}P_{2}P_{1}P_{0}C_{0} which are required for C_{4}.
Level2 we get the carries by computing the disjunction (OR).
3) (2 time units) Finally, we compute the sum in 2 time units, as its a XOR operation.
Hence, the total is 2+2+2=6 time units.
Question 63 
1007  
1020  
1024  
1028 
→ Interrupt occurs after executing halt instruction
So, number of instructions = 2+1+1+2+1 = 7
→ Each instruction with 4 bytes, then total instruction size = 7 * 4 = 28
→ Memory start location = 1000
→ Instruction saved location = 1000 + 28 = 1028
1028 is the starting address of next instruction.
Question 65 
2  
3  
4  
5 
The given sequernce is 8, 12, 0, 12, 8.
So in total 4 misses is there.
Question 66 
1100 0100
 
1001 1100
 
1010 0101
 
1101 0101 
B = 0000 1010 = 10_{10} [2's complement number]
A×B = 6×10 =  60_{10}
⇒ 60_{10} = 10111100_{2}
= 11000011_{2} (1's complement)
= 11000100_{2} (2's complement)
Question 67 
10, 3, 1024
 
8, 5, 256
 
5, 8, 2048
 
10, 3, 512

Micro process field width = 13 bits
MUX consists of 8 state bits, then it require 3 inputs to select input line.
No. of bits for next address field = 26  13  3= 10
For 10 bit addressing, we require 2^{10} memory size
Size (X, Y) = 10, 3
Question 68 
A hard disk with a transfer rate of 10 Mbytes/second is constantly transferring data to memory using DMA. The processor runs at 600 MHz, and takes 300 and 900 clock cycles to initiate and complete DMA transfer respectively. If the size of the transfer is 20 Kbytes, what is the percentage of processor time consumed for the transfer operation?
5.0%
 
1.0%  
0.5%
 
0.1%

For DMA initiation and completion total 1200 cycles is required. So total time will be = 1200 × 1/600 × 10^{6} = 2μs
Disk transfer rate = 10MB/s
1B = 1/10^{7} s
So, total transfer 20KB time taken will be,
20 × 10^{3} × 1/(10^{7}) s
= 2000μs
∴ Percentage of processor time consumed is,
2/2+2000 × 100 = 0.1%
Question 69 
A 4stage pipeline has the stage delays as 150, 120, 160 and 140 nanoseconds respectively. Registers that are used between the stages have a delay of 5 nanoseconds each. Assuming constant clocking rate, the total time taken to process 1000 data items on this pipeline will be
120.4 microseconds
 
160.5 microseconds
 
165.5 microseconds
 
590.0 microseconds

1st instruction × 4 × clock time + 999 instruction × 1 × clock time
1 × 4 × 165ns + 999 × 1 × 165ns
= 1654.95ns
= 165.5μs
Question 70 
satisfiable but not valid
 
valid
 
a contradiction
 
None of the above

(P→(Q∨R)) → (P∨Q)→R
If P=T; Q=T; R=T
(P→(T∨T)) → ((T∨T)→R)
(P→T) → (T→R)
(T→T) → (T→T)
T→T
T(Satisfiable)
Question 71 
infinitely many
 
two distinct solutions
 
unique
 
none

rank = r(A) = r(AB) = 2
rank = total no. of variables
Hence, unique solution.
Question 73 
{1}  
{1}, {2, 3}
 
{1}, {1, 3}
 
{1}, {1, 3}, (1, 2, 3, 4}, {1, 2, 3, 5}

For the set {1, 2, 3, 4, 5} there is no supremum element i.e., {1}.
Then clearly we need to add {1}, then it is to be a lattice.
Question 74 
An examination paper has 150 multiple choice questions of one mark each, with each question having four choices. Each incorrect answer fetches 0.25 marks. Suppose 1000 students choose all their answers randomly with uniform probability. The sum total of the expected marks obtained by all these students is
0  
2550  
7525  
9375 
Probability of selecting a wrong answer = 3/4
For correct answer +1, for wrong answer0.25;
Expected marks for each question = (1/4) × 1 + (3/4) (0.25)
= 1/4 + (3/16)
= 43/16
= 1/16
= 0.0625
Expected marks for 150 questions = 150 × 0.625 = 9.375
The sum total of expected marks obtained by 1000 students is = 1000×9.375 = 9375
Question 75 
Mala has a colouring book in which each English letter is drawn two times. She wants to paint each of these 52 prints with one of k colours, such that the colourpairs used to colour any two letters are different. Both prints of a letter can also be coloured with the same colour. What is the minimum value of k that satisfies this requirement?
9  
8  
7  
6 
Each is printed twice the no. of letters = 26×2 = 52
If Mala has k colours, she can have k pairs of same colours.
She also can have ^{k}C_{2} different pairs in which each pair is having different colours.
So total no. of pairs that can be coloured = k+^{k}C_{2}
k+^{k}C_{2} ≥ 26
k+k(k1)/2 ≥ 26
k(k+1)/2 ≥ 26
k(k+1) ≥ 52
k(k+1) ≥ 7*8
k≥7
Question 76 
≤ a+b  
≤ max(a, b)
 
≤ min(Ma, Nb)
 
≤ min(a, b)

→ Such that a row can have maximum of a elements and no row has separate element and for b also same.
→ By combining the both, it should be ≤ (a,b).
Question 77 
2  
3  
4  
5 
→ a, b, c, d = 4
→ The minimum no. of colours required to colour a graph = 4 (no two adjacent vertices have same colours)
Question 78 
^{n}C_{d} /2^{n}
 
^{n}C_{d} / 2^{d}
 
d/2^{n}
 
1/2^{d}

Total no. of cases where n positions have any binary bit = 2^{n}
The probability of 'd' bits differ = ^{n}C_{d} / 2^{n}
Question 79 
Maximum no. of vertices = n(n1)/2 = v
No. of graphs with minimum b edges is
= C(v,e) + C(v,e+1) + C(v,e+2) + ... + C(v,v)
= C((v,ve) + C(v,v(e+1)) + C(v,v(e+2)) + ... + C(v,0)
= C(a,n) + C(a,n1) + C(a,n2) + ... + C(a,0) (since ab=n)
= C(n(n1)/2,n) + C(n(n1)/2,n1) + ... + C(n(n1)/2,0)
Question 80 
Above diagram shows the scenario of our question.
The length p of our position vector (x,y) is
Now we need to calculate the probability density function of X and Y.
Since distribution is uniform,
X goes from 0 to 1, so PDF(x) = 1/10 = 1
Y goes from 0 to 2, so PDF(y) = 1/20 = 1/2
Now we evaluate,
Question 81 
cannot have a cut vertex
 
must have a cycle
 
must have a cutedge (bridge)
 
has chromatic number strictly greater than those of G_{1} and G_{2}

(A)
False, since in G_{1}∪G_{2} 'C' is a cut vertex.
(B) True, for all conditions.
(C)
False. G_{1}∪G_{2} has no bridge.
D)
False. G_{1}∪G_{2}, G_{1}, G_{2} all the three graphs have chromatic number of 2.
Question 82 
Ω(n^{2})
 
Ω(nlog n) and O(n^{2})
 
θ(n)
 
o(n)

If the string contains all one's then it takes O(n) time, because counter++ can execute n times.
If it contains half 0's and half 1's then also it takes O(n) time.
Question 83 
O(n)
 
O(n log n)
 
O(n^{2})
 
O(2^{n})

return(1)
else
return(recursive(n1) + recursive(n1))
n>0:
T(2) = T(1) + T(1) = 2T(1)
T(3) = T(2) + T(2) = 2T(2) = 2⋅2T(1) = 2^{2}T(1)
T(4) = 2^{3}⋅T(1)
⋮
T(n) = 2^{n}⋅T(1) = O(2^{n})
Question 84 
2^{n+1} – n – 2  
2^{n} – n
 
2^{n+1} – 2n – 2  
2^{n} + n

T(n) = 2T(n1) + n
T(2) = 2T(1) + 2 = 2 + 2 = 4
T(3) = 2T(2) + n = 2(4) + 3 = 11
T(4) = 2T(3) + 4 = 22 + 4 = 26
Let check with the options:
Option A:
n=4
2^{4+1}  4  2
32  6
26 (✔️)
Option B:
n=4
2^{n}n
2^{4}4
12(✖️)
Option C:
n=4
2^{4+1}  2(4)  8
32  10
22(✖️)
Option D:
n=4
2^{n}  n
2^{4}  4
12(✖️)
Question 85 
A program takes as input a balanced binary search tree with n leaf nodes and computes the value of a function g(x) for each node x. If the cost of computing g(x) is min(number of leafnodes in leftsubtree of x, number of leafnodes in rightsubtree of x) then the worstcase time complexity of the program is
Θ (n)
 
Θ (n log n)
 
Θ (n^{2})
 
Θ (n^{2} log n)

⇒ g(x) = min (no. of leaf nodes of leftsubtree of x, no. of leaf nodes in the rightsubtree of x)
→ Total no. of leaves = n
Time complexity for a binary search = log n
Time complexity of the program is = O(n(log n))
Question 86 
divisible by 3 and 2
 
odd and even
 
even and odd
 
divisible by 2 and 3

For example 001 consists of even no. of zero's and odd no. of one's. It is not accepted by TM.
So, it is false.
Option C:
For example 110, contains even 1's and odd 0's but not accepted by TM.
So, it is false.
Option D:
For example 11000, where no. of 1's divisible by '2', and no. of zero's divisible by 3, but not accepted by TM.
So, it is false.
Option A:
It accepts all string where no. of 1's divisible by 3, and no. of zero's divisible by 2.
It is true.
Question 87 
regular
 
contextfree but not regular
 
context sensitive but not context free
 
type0 but not context sensitive

PUSH z_{0} into stack
PUSH K to stack of occurance of a
PUSH L to stack of occurance of b
POP K and L for the occurance of c
→ After POPno elements in the stack. So, this is context free language.
Note:
Regular:
R = {a^{n}  n ≥ 1}, Example.
CFL:
R = {a^{n}b^{m}  n,m ≥ 1}, Example.
Question 88 
{wN_{a}(w) > 3N_{b}(w)}
 
{wN_{b}(w) > 3N_{a}(w)}  
{wN_{a}(w) = 3k, k Î {0, 1, 2, ...}}
 
{wN_{b}(w) = 3k, k Î {0, 1, 2, ...}}

S→baA
S→babA
S→babaB
S→babaa
n(a)=3; n(b)=2
Option A:
N_{a}(w) > 3N_{b}(w)
3 > 3(2)
3 > 6 (✖️)
Option B:
N_{b}(w) > 3N_{b}(w)
2 > 3(2)
2 > 6 (✖️)
Option D:
N_{b}(w) = 3k
2 = 3k(✖️)
S = aA
S→aA
S→abA
S→abaB
S→abaa
n(a)=3
n(a)=3
→ Answer: Option C(✔️)
Question 89 
Both S_{1} and S_{2} are true
 
S_{1} is true but S_{2} is not necessarily true
 
S_{2} is true but S_{1} is not necessarily true  
Neither is necessarily true

L_{1} = recursively enumerable language
L_{2} over Σ∪{#} as {w_{i}#w_{j}  w_{i}, w_{j} ∈ L_{1}, i < j}
S_{1} is True.
If L_{1} is recursive then L_{2} is also recursive. Because, to check w = w_{i}#w_{j} belongs to L_{2}, and we give w_{i} and w_{j} to the corresponding decider L_{1}, if both are to be accepted, then w∈L_{1} and not otherwise.
S_{2} is also True:
With the corresponding decider L_{2} we need to make decide L_{1}.
Question 90 
P  2, Q  3, R  4, S  1
 
P  4, Q  3, R  2, S  1
 
P  3, Q  4, R  1, S  2
 
P  3, Q  4, R  2, S  1

Q) Logic is also declarative but involves theorem proving.
R) Object oriented is imperative statement based and have abstract data types.
S) Imperative programs are made giving commands and follow definite procedure.