You are on page 1of 52

# 2018-02-21 20:37:54

## Test: Mock GATE Test – 1

Mock GATE Test – 1

## Points: 34.040 / 100.000 (34%)

Correct: 25 / 65 (38%)

1. On an aptitude test in 1986, an argument posited that the possibility of conducting banking transactions
from home was as likely as flying cars, an argument that today sounds ___________. ( Marks: 0.00 )
A. preposterous
Explanation:
Preposterous. The blank must agree with the clue that the possibility is remote. Note that
prescient is the opposite of what you want — because the prediction about the future was
entirely wrong, it did not sound prescient.

B. paradoxical

C. pithy

D. presumptuous

## 2. What will be the output of the following program?

Void main()
{
int a = -5;
a >> = 2;
a << = 2;
printf(“%d”,a);
}
( Marks: -0.33 )
A. -5

B. None

C. -6

D. -8
Explanation:
Binary Left Shift Operator. The left operands value is moved left by the number of bits specified
by the right operand.
Binary Right Shift Operator. The left operands value is moved right by the number of bits
specified by the right operand.

## -5 = 11111011 (2’s complement representation)

a>>2 = 00111110
a<<2 = 11111000 => -8

3. Let a relation ‘R’ be defined on the set of all real numbers by aRb⇔1+ab>0.Thus R is ( Marks: 2.00 )
A. An equivalence relation

## B. Reflexive, Symmetric, but not transitive

Explanation:
C. Symmetric, transitive, but not reflexive

## D. Reflexive, Transitive, but not symmetric

4. Suppose you know that there will only be 4 processes running at the same time, each with a Resident
Set Size (RSS) of 512MB and a working set size of 256KB. Assuming the same system with 32 bit
virtual and physical address space with 4KB page size, what is the minimum amount of TLB entries
that your system would need to support to be able to map/cache the working set size for one process?
( Marks: 0.00 )
A. 512

B. 128

C. 64
Explanation:
A process has a working set size of 256KB which means that the working set fits in 64 pages.
(256KB/4KB) = 64 pages. A TLB contains page entries for translation so, A TLB should have
atleast 64 entries.

D. 1024

5. Consider an L1 cache, L2 cache, and main memory. The hit rates and hit times for each are:
70% hit rate, 5 ns hit time for L1.
90% hit rate, 14 ns hit time for L2.
100% hit rate, 150 ns hit time for main memory
If there a total of 300 memory accesses, how many of these accesses are serviced from main
memory? ( Marks: 1.00 )
A. 90

B. 45

C. 9
Explanation:
L1 miss rate = 1 − 0.7 = 0.3
L2 miss rate = 1-0.90 = 0.1
Out of all 300 memory accesses 30% (90 accesses ) come to L2. From the 90 memory
accesses that come to L2 cache, 10% of them (9 accesses) come to main memory. So total no.
of memory accesses serviced from main memory = 9.

D. 18

6. Which of the following is correct TRIPLE representation of the given below assignment statement.
z[i] = x * y ( Marks: 2.00 )

A.

B.
Explanation:
The triple representation of x[i]=a is:

C.
D.

## 7. The number of distinct positive integer factors of 1615 ( Marks: 1.00 )

A. 8
Explanation:
Integral factors are prime factors.
So we need to find the prime factors of 1615.
1615 can be written as 5×17×19.
So, we can have combination of three distinct numbers.
So, 23=8 numbers of such distinct positive integer factors are possible.

B. 5

C. 7

D. 16

## 8. Let L1 and L2 are two languages over Σ={a} such that:

L1 ={ax | x is even}
L2 ={ax | x is odd}
Then select the correct option. ( Marks: 2.00 )
A. None of the above is correct
Explanation:

B. L1∙L2 = L1
C. L1∙L2 is Σ*

D. L1∙L2≠L2∙L1

9. Consider the relational schema R(A, B, C, D) along with the functional dependencies:
F = {AB→C, AB→D, C→A, D→B}
How many number of candidate keys are possible for R? ( Marks: 1.00 )
A. 3

B. 5

C. 2

D. 4
Explanation:

10. The RavindraBabuRavula company uses a compression technique to encode the secret message
before transmitting over the network. (Note: Each character in input message takes 1 byte.)Suppose
the secret message contains the following characters with their frequency:
If the compression technique used is Huffman Coding, how many bits will be saved in the
message________(NAT) ( Marks: 2.00 )
555

Explanation:

## Total number of characters in the message = 100.

Each character takes 1 byte. So total number of bits needed = 8*100 ⇒ 800.
After Huffman Coding, the characters can be represented with:
Step-1: Arrange frequencies in descending order:
Step-5:
5×4+10×4+15×3+20×2+23×2+27×2
⇒20+40+45+40+46+54
⇒245
Step-6:
Total number of bits needed = 245
∴The total number of bits saved = 800 – 245 = 555

11. Assume that you have a disk with the following parameters:
• 1TB in size
• 6000RPM
• Data transfer rate of 4MB/s (4×106 bytes/sec)
• Average seek time of 3ms
• I/O controller with 1ms of controller delay
• Block size of 4000 bytes
What is the average time it takes to read 1 random block? Assume no queuing delay. ( Marks: 2.00 )
A. 5 millisecnonds

B. 1 millisecnonds

C. 12 millisecnonds

D. 10 millisecnonds
Explanation:
Solution 10 millisecnonds
Avg Time = Rotationaly latency + Seek time + Controller delay + Transfer time
Rotational latency = 1/2 * [(60sec/min)/6000RPM] = 5ms
Seek time = 3ms
Controller delay = 1ms
Transfer time = 4000 bytes / 4×106 bytes/sec = 1ms
So, Avg time = 1 + 3 + 5 + 1 = 10ms

12. Consider DFS over undirected graph with 4 vertices <A;B;C;D>. The discovery and finishing times of
them in the order A to D are given. Select the option from following showing more than one connected
components:
1) <(1,6), (2,5), (3,4), (8,10)>
2) <(6,7), (2,5), (3,4), (8,9)>
3) <(4,5), (2,8), (1,7), (3,6)>
4) <(7,8), (1,2), (5,6), (3,4)> ( Marks: 2.00 )
A. 1, 2, 4
Explanation:
In this question the given information is:
1. Graph is connected
2. There are 4 vertices of the graph
3. The DFS algorithm is performed on the given graph, starting from P to S (in this order only)

Now, we need to find the correct option of the DFS traversal, in terms of discovery and finish
time. As it is said that graph is connected, this states that from 4 options, 3 DFS traversals will
be for not-connected graph.

Call DFS for each option according to there start and Finish time.(<U,V> meaning U is starting
time and V is finish time of vertex)

1) <(1,6) (2,5) (3,4) (8,10)>: This option having 2 connected component as 1/6,2/5,3/4 and 8/10
so not connected graph

2) <(6,7) (2,5) (3,4) (8,9)>: In this graph having 3 connected component like (2/5,3/4) as one
component,(6/7) is second and (8/9) is third component so it also not connected graph.

3) <(4,5) (2,8) (1,7) (3,6)>: In this graph is connected as having single connected component as
1/8,2/7,3/6,4/5.

## 4) <(7,8) (1,2) (5,6) (3,4)> : graph having 4 connected component as (1/2),(3/4),(5/6),(7/8).

Only 3rd option is for connected component graph, 1,2,4 are non-connected components.

B. 1, 2 ,3

C. 1, 2

D. 1 , 2, 3, 4

13. Napoleon is of course most famous for his military triumphs, but his innovative code of law had a
subtler but more _____ impact, as its principles strongly influenced legal codes well into the 20th
century. ( Marks: 0.00 )
A. insidious
B. enduring
Explanation:
Enduring. The blank must agree with strongly influenced legal codes well into the 20th century;
thus, the code of law is enduring. Note that incorrect choice fleeting is exactly the opposite of
the intended meaning.

C. fleeting

D. martial

14. A seller uses 840 gm in place of 1 kg to sell his goods. Find his actual % profit/loss when he sells his
article at 4% loss on cost price. ( Marks: 2.00 )
A. 13 4/5 %

B. 12 5/7 %

C. 13 2/7 %

D. 14 2/7 %
Explanation:
Let,
C.P of article =Rs 100
Loss =4%=4/100×100=Rs 4
SP of article = CP – loss =100-4=Rs 96
As false weight is weight
Actual Profit/loss =96×1000/840-100
=114.28-100
=14.28
As positive value ⇒ Profit
Profit % =14.28/100×100
=14.28%
=142/7 %

## 15. Read the passage and answer the question below

The Vijaynagar corner needs a speed-breaker. Loyola school children cross this intersection, on their
way to the school, and many a times do not check out for traffic. I get to read regular reports of cars
and other vehicles hitting children. I know that speed-breakers are irritating for drivers, and I know that
children cannot be protected from every danger, but this is one of the worst intersections in town. There
needs to be a speed-breaker so that vehicles have to slow down and the children be made safer.
Which of the following arguments is used in the above passage? ( Marks: 0.00 )
A. Personalization - telling the story of one child’s near accident at the intersection.

## B. Statistical analysis - noting the number of children hit by vehicles.

C. Attack - pointing out people who are against speed-breakers as being uncaring about
children

## D. Emotive - referring to the safety of children to get people interested.

Explanation:
Option (Statistical analysis - noting the number of children hit by vehicles.) is not used (“I get to
read regular reports of cars and other vehicles hitting children”). The number is not mentioned.
Option (Personalization - telling the story of one child’s near accident at the intersection.) is out
of scope. No one is telling anything.
Option (Attack - pointing out people who are against speed-breakers as being uncaring about
children.) is not true (“speed-breakers are irritating for drivers”). Doesn’t point out anybody.
Option (Emotive - referring to the safety of children to get people interested.) is used and it can
be seen in the passage how the writer describes how the safety of children.(“ There needs to be
a speed-breaker so that vehicles have to slow down and the children be made safer”)
So, Option (Emotive - referring to the safety of children to get people interested.) is the answer.

## 16. Consider the given below Turing Machine

If the input “babaa” is given to Turing Machine then, what will be output and position of head when TM
reaches to HALT state? Assume highlighted and underlined character depicts the head position at end
and β represents blank symbol. ( Marks: 0.00 )
A. βababbβ

B. βaababβ

C. βabaaaβ

D. βbabbaβ
Explanation:
17. Consider the following figure

## Then X is ______ MHz. ( Marks: 0.00 )

A. 1/n

B. None

C. n

D. 1
Explanation:
Mod of n-bit ring counter is n.
X= (n MHz)/(Mod of counter)=(n MHz)/n=1 MHz

18.
Choose correct statements about Hasse diagram:
(I) Maximal elements of this Hasse diagram are i, j.
(II) Minimum element of this Hasse diagram are a, b, d.
(III) Maximal elements of this Hasse diagram are b, d, i, j.
(IV) Minimal element of this Hasse diagram is a.
(V) Minimum element of this diagram is a. ( Marks: 0.00 )
A. II, III, IV

B. III, IV, V
Explanation:
→ If in a poset, an element is not related to any other element, then it is called maximal
element.
(Suppose relation “<”, if x<y then ‘x’ is related to y)
→ For the given diagram, i, j, b, d are not related to any other element. So they are maximal
element.
→ Minimal element: If in a poset, if no element is related to an element then it is called minimal
element.
→ For the given diagram we have only ‘a’, which is minimal element.
→ If there is one unique minimal element, then it is called as minimum element. For the given
diagram it is 2.

C. I, II, IV

D. I, IV, V

19. Given IP = 220.60.120.142 and subnet mask = 255.255.255.224. Calculate the last host of first subnet?
( Marks: 0.00 )
A. 220.60.120.255

B. 220.60.120.32

C. 220.60.224.254

D. None of these
Explanation:
A given IP is class C, so first three octets part will be fixed.
Last octet bit binary representation of subnet mask is 255.255.255.11100000 (3 bits are subnet
and 5 bits are for the host)
possible subnet bits are 2^3 = (000(first),001,010,011,100,101,110,111(last))
Last host of the first subnet is 220.60.120.000 11110.
Therefore, 220.60.120. 30
so correct answer would be 220.60.120. 30

20. The stage delays in a 4-stage pipeline are 600, 400, 300 and 250 picoseconds. The first stage with
delay 600 picoseconds is replaced with functionally equivalent two stages of delays 450 picoseconds
and 200 picoseconds. The throughput increase of the pipeline in percentage_______?(NTA)
( Marks: 0.00 )
25

Explanation:

In a pipelined processor the throughput is 1/clock cycle time. Cycle time = max of all stage delays. In
the first case max stage delay = 600. So throughput= 1/600 initially. After replacing this stage with two
stages of delays 450, 200... the cycle time = maximum stage delay = 450, so the new throughput =
1/450.

The new throughput > old throughput..and the increase in throughput = 1/450 - 1/600.

The increase in throughput is 1/450 - 1/600. But when we calculate the percentage increase in
throughput it is calculated w.r.t initial throughput, so the % increase in throughput = (1/450 - 1/600) /
(1/600) * 100 = ((600 / 450) - 1 ) * 100 = ( (4/3)-1 ) * 100 = 33.33%

## 21. Match column A with Column B

Column A Column B
DNS (i) port-53
SMTP (ii) port-23
TELNET (iii) port-25
SSH (iv) port-22
( Marks: 0.00 )
A. 1- (iii), 2-(v), 3-(i), 4-(ii)

## B. 1- (i), 2-(iii), 3-(ii), 4-(iv)

Explanation:
DNS - 53, SMTP - 25, TELNET - 23, SSH - 22

## C. 1-(iii), 2-(iv), 3-(ii), 4-(i)

D. None of these

22. As we know that, PDA=Finite Automata + one Stack. Assume a modified PDA M1 in which, in place of
stack if we use counter (where counter is able to count the number of occurrences of terminals in input
string), i.e., PDA M1 = Finite Automata + one counter.
Consider the given below languages:
L1={an bn |n>0}
L2={wwr| w ϵ {a,b}*}
L3= {w | na(w) = nb(w)}
Select the correct option. ( Marks: -0.66 )
A. M1 is able to recognize L3 but cannot recognize L1 and L2.

## B. M1 is able to recognize L1 and L3 but cannot recognize L2.

Explanation:
Since counter is able to count the number of occurrences of terminals in an input string, but it
doesn’t have the LIFO (last in first out) property of stack. So it can only recognize those
language where the order of occurrence of terminals doesn’t matter, i.e., only count is required.
As in L2 ={wwr| w ∈ {a,b}*} the order and count both matters hence the modified PDA cannot
recognize these languages. But in L1 and L3 only count matters hence M1 can recognize L3

## D. M1 cannot recognize L1, L2 and L3.

23. Six jobs are waiting to be run. Their expected running times are 10, 8, 6, 3, 1, and X. Which one of the
following order will NOT minimize average completion time using Shortest Job First (SJB) ?
( Marks: 0.00 )
A. 1, 3, 6, 8, 10, X and X > 10

B. X, 1, 3, 6, 8, 10 and X <= 2
Explanation:
X, 1, 3, 6, 8, 10 and X <= 2
Possible orders are : (scheduling X by ordering the processes in ascending order by running
times )
X <= 1 X, 1, 3, 6, 8, 10
1 < X <= 3 1, X, 3, 6, 8, 10
3 < X <= 6 1, 3, X, 6, 8, 10
6 < X <= 8 1, 3, 6, X, 8, 10
8 < X <= 10 1, 3, 6, 8, X, 10
X > 10 1, 3, 6, 8, 10, X

## D. 1, 3, X, 6, 8, 10 and 3 < X <= 6

24. If a complete undirected graph has ‘6’ vertices then what is the number of distinct Hamiltonian cycles in
that graph? ( Marks: 0.00 )
A. 30

B. 120

C. 60
Explanation:
There are (n-1)!/2 distinct Hamiltonian cycles in a complete graph of ‘n’ vertices
n=6⇒5!/2=60

D. 90

25. Find the link utilization in stop and wait protocol if the bandwidth of the line 2 kbps, round trip time is 40
second and the packet size is 4000 bytes. (in percentage) ( Marks: -0.66 )
A. 14.44 %

B. 12.22 %

C. None of these.

D. 16.66 %
Explanation:
Link utilization=efficiency=Tt/(Tt+2Tp)
Tt=L/B = 2000*8/(4000) = 4 s
Efficiency = 4/(4+20) = 4/24 = 01666=16.66 %
26. How many 4-digit numbers can be formed using digits 0 to 6 without repetition such that the number is
divisible by 9? ( Marks: 0.00 )
A. 84

B. 78
Explanation:
For a number to be divisible by 9, the sum of digits in that number should be a multiple of 9.
Cases satisfying above condition are:
Case-1: 0, 1, 2, 6 ⇒ No. of numbers = 4! – 3! = 18
Case-2: 0, 2, 3, 4 ⇒ No. of numbers = 4! – 3! = 18
Case-3: 0, 1, 3, 5 ⇒ No. of numbers = 4! – 3! = 18
Case-4: 3, 4, 5, 6 ⇒ No. of numbers = 4! = 24
∴ Total number of 4-digit numbers that can be formed = 18 + 18 + 18 +24 = 78
Note: (4! – 3!)is because, 4! using all digits (even 0) and subtracting those from cases where ‘0’
is starting digit.

C. 64

D. 68

## 27. Consider the grammar with given productions and SDT

S→ S \$ S {print (‘₹’)}
S→ S ₹ S {print(‘\$’)}
S→ id {print(‘id.name’)}
If a top down parser carries out the SDT for the string “a\$b₹c” and considerthe given below outputs.
op1: “ab₹c\$”
op2: “a₹b\$c”
op3: “abc\$₹”
Select the correct option. ( Marks: 2.00 )
A. Only op1 is correct output for given string

B. op1 and op3, both are correct output for the given string
Explanation:
C. op1 and op2, both are correct output for the given string

## 28. Thread-specific data is data that ____. ( Marks: 0.00 )

A. has been modified by the thread but not yet updated to the parent process

## B. is copied and not shared with the parent process

Explanation:
is not associated with any process is False beacuse thread is always associated with a
process.
has been modified by the thread but not yet updated to the parent process is False , thread is
path of execution of parent process
is generated by the thread independent of the thread's process is False, thread is always
associated with a process.
is copied and not shared with the parent process id True, the data that only belongs to thread
but not shared to process.

## 29. Consider the given below grammar.

S→ aSb | aaSb | aaaSb | a
Then the language generated by the grammar G is: ( Marks: 0.00 )
A. {ax by | y ≤ x ≤ 4y}

B. {ax by | y ≤ x ≤ 3y}

## C. None of the above

Explanation:
“aaaaaaabb” is one of the string generated by the grammar. Here x=7 y=2, so none of the
above is correct. The correct language is {ax by | y ≤ x ≤ 3y+1}.

D. {ax by | x ≤ y ≤ 3x}

30. Assume that for a certain processor, main memory access time is 120 nanoseconds and cache access
time is 10 nanoseconds. It is estimated that 70% of the main memory requests are for read operation
and the rest for write operation. Suppose while running a program, it was observed that 90% of the
processor’s read requests result in a cache hit. If this is a write through cache which can do
simultaneous write operation, the average memory access time in nanoseconds
is____________(NTA). ( Marks: 0.00 )

Explanation:

## If nothing is mentioned whether it is a simultaneous memory access or hierarchical memory access, we

need to consider it as hierarchical memory access only. Here in this question nothing is given about
read operation so we need to take it as hierarchical memory access for read operation. But for write it is
given as write through policy, which will result in simultaneous memory access. Since write operations
in write-through cache always goes to the main memory, in main memory its hit rate is 100%. Hence Hit
rate for write= 1.

Since there are 70% read operations and 30% write operations,
Average memory access time = 0.70 * Time spent for read + 0.30 * Time spent for write

Time spent for reading = Hit-rate-for-read * cache access time + Miss-rate-for-read(cache access time
+ main memory access time)
= ( 0.9 ⨯ 10 + 0.1 ⨯ (120+10) )
= 9+13 = 21ns

## Average memory access time = 0.70 * 21 + 0.30 * 120 = 50.7ns

31. Mrudul divides Rs.3903 between P and Q so that P’s share at the end of 7 years may equal Q’s share
at the end of 9 years, compound interest being at 4 percent. What is Q’s share? ( Marks: 0.00 )
A. 1350

B. 1575

C. 1875
Explanation:
D. 1950

## The frequency X is _______ KHz. ( Marks: 0.00 )

A. None

B. 1000

C. 250
D. 500
Explanation:
Mod value of 5-bit Johnson counter is 10.
So, X/10=Y
⇒X=10Y
Y/(Mod of Ripple counter)=Y/5=10 KHz
⇒Y=50 KHz
X=10Y
=10.50 KHz
=500 KHz

## 33. Consider the following C function:

int f(int n)
{
static int r = 0;
if (n <= 0) return 1;
if (n > 3)
{ r = n;
return f(n-1) + 2;
}
return f(n-2) + r;
}
What is the value of f(5)?
( Marks: 1.00 )
A. 13
Explanation:
f(5) = f(4)+2
The line "r = n" changes value of r to 5. Since r is static, its value is shared by all subsequence
calls. Also, all subsequent calls don't change r because the statement "r = n" is in a if condition
with n > 3.

f(4) = f(3)+2
f(3) = f(1)+5
f(1) = f(-1)+5 =1 + 5 = 6

So f(5) = 6+5+2 = 13

B. 7
C. 9

D. 5

34.
The initial state of the circuit is equal to the value 4. The state sequence of the circuit is ( Marks: 2.00 )
A. 4, 6, 7, 3, 0, 1

B. 4, 6, 3, 7, 1, 0

C. 4, 6, 7, 3, 1, 0
Explanation:

## State Sequence is 4-6-7-3-1-0

D. None
35. Let f(x)=ax2+bx+c where a, b, c are constants. Given that limx→4f(x)=k∙a, where ‘k’ is also a constant
and a+4b+c=0. What is the value of ‘k’? ( Marks: 1.00 )
A. 4

B. 16

C. 2

D. 15
Explanation:
36.
( Marks: 0.00 )
A. Priority First

Explanation:

## D. Longest Remaining Time First

37. Consider the following keys that are hashed into the hash table in the order given using the hash
function:

## P(k) = (3k +5) mod 11

12, 44, 13, 88, 23, 94, 11, 39, 20, 16, 5
where to handle the collision, chaining is used, after inserting all the above keys in table if 2 new keys
inserted into table the what is the probability new items hashed into empty slot ? ( Marks: -0.66 )
A. (5/11)*(4/11)

B. 2*(5/11)*(4/11)
Explanation:
Description:

## Answer = 2*5/11 *4/11

See, If we think like this that : We need to insert 2 keys and they are distinct eg 30 and 40

p1=5/11 *4/11

p1=5/11 *4/11

## Total probability =p1+p2 = 2*5/11 *4/11

To add comment in your answer we can also say that As the order of insertion is not given
hence both keys will be inserted in 2 ways hence 2 is multiplied to 5/11 * 4/11.

C. 9/11

D. 20/11

38. If a language L is recursive enumerable. Then select the correct option about LC (compliment of L).
( Marks: 1.00 )
A. LC is necessarily recursive enumerable.

## B. None of the these.

Explanation:
: L is recursive enumerable, so it can also be recursive (as every recursive is recursive
enumerable also) and as we know the compliment of recursive is recursive, so none of them is
correct.
Please note that, if it is given that L is recursive enumerable but not recursive then its
compliment cannot be recursive enumerable (i.e., in that case, LC is necessarily not recursive
enumerable will be true statement). The reason is, according to theorem, if L and LC both are
recursive enumerable then L must be recursive and we already assume that L is not recursive,
so LC cannot be recursive enumerable

## D. LC is necessarily not recursive.

39. The number of ways possible to form injective function from set A to set B, where set ‘A’ has 3
elements, set ‘B’ has 5 elements such that i^th element of set A should not be matched with i^th
element of set B ( Marks: 0.00 )
A. 32
Explanation:
image:s39.PNG

B. 35

C. 34

D. 60
40. Choose the correct option to fill exp1 and exp2, so that the program below prints an input string in reverse
#include<stdio.h>
void reverse(void) {
int c;
if (exp1) reverse();
exp2;
}
main(){
printf ("Enter Text ") ;
printf ("\n") ;
reverse();
printf ("\n") ;
}
( Marks: -0.66 )
A. exp1 :(c!='\n' ; exp2 : putchar(c);

## C. exp1 :(c=getchar())!='\n' ; exp2 : putchar(c);

Explanation:
#include<stdio.h>
void reverse(void) {
int c;
if ((c=getchar())!='\n') reverse();
putchar(c);
}
main(){
printf ("Enter Text ") ;
printf ("\n") ;
reverse();
printf ("\n") ;
}
Here c is declared as int.
Unlike some other languages you may have used, chars in C are integers. char is just another integ
In C we can convert between char and other integer types using a cast, or just by assigning.
Unless EOF occurs, getchar() is defined to return "an unsigned char converted to an int" so if it hel
[note:we can convert this back to an unsigned char just by a cast or assignment, we can convert it t

Recursion:
Eg string = load
we get the input text character by character using getchar() function until it get new line
character. after taking each character the function call itself until is reach the end-of-line and the
get the newline character. When it reaches the end-of-line then it start to print using putchar()
function, (so first '\n' will be printed) and return to the previous recursive call of the function in
the recursion and print the second last character (here 'd') and return to the upper function
which call this function(which will putchar - a), this will recursively happens till the initial call of
reverse

## 41. Consider the given below grammars.

G1:S → S+S | id
G2:S → SS+ | id
Select the correct option: ( Marks: 1.00 )
A. Both G1 and G2 are LR(1) grammar.

## C. G1 is operator grammar and G2 is LR(1) grammar.

Explanation:
G1 is an ambiguous grammar so it can’t be LR(1) , while it can be operatorgrammar. G2 can’t
be operator grammar as in operator grammar two variablescan’t be together. But G2 is
unambiguous grammar as well as LR(1) grammar.

## 42. Consider the following statements:

S1: An Implication Gate is fully functionally complete.
S2: f= x’+y is partially functionally complete.
Which of the above statements are true? ( Marks: 0.00 )
A. Both S1 and S2 are false.

B. Only S1 is true

C. Only S2 is true
Explanation:
f= x’+y is the function implemented by an Implication Gate. That is functionality of both is same.
But f(x,y)=x’+ y is partially complete
f(x,0)= x’ ← NOT
f(f(x,0),y) = (x’)’+ y= x+y ← OR

## D. Both S1 and S2 are true

43. In a 2500 m race, Charan beats Ganesh by 300 m. In the same race, Ganesh beats Nag by 500 m. By
what distance does Charan beat Nag? ( Marks: 0.00 )
A. 740 km
Explanation:

B. 660 km

C. 540 km

D. 600 km
44. Which of the following is used to get back all the transactions back after rollback? ( Marks: 0.00 )
A. Flashback
Explanation:
From Oracle Ver. 9i Oracle has introduced Flashback Query feature. It is useful to recover from
accidental statement failures.
For example, suppose a user accidently deletes rows from a table and commits it also then,
using flashback query he can get back the rows.

B. Redo

C. Commit

D. Rollback

## 45. Consider the given below grammar

S→ cAd
A→ bA | aA | b
If a recursive descent parser is used for string “cbababd” then number of back trackin worst case is:
( Marks: -0.33 )
A. 10
Explanation:
S→ cAd
A→ bA | aA | b
String “cbababd”

B. 3

C. 6
D. 8

## 46. Arrange the following functions in decreasing asymptotic order.

A)n6/4 B)1.5n C)en
D)n^(log22) E)n2/3 ( Marks: 1.00 )

A. C,E,A,D,B

B. E,D,A,B,C

C. C,B,A,D,E
Explanation:
image:s1.PNG

D. C,A,B,E,D

## 47. Consider the below given statements.

S1: If all the states of a DFA except initial state are final states then the language accepted by DFA
must be Σ+.
S2: If all the states of an NFA are final states then the language accepted by NFA must be Σ*.
Select the correct option. ( Marks: -0.33 )
A. S2 is true but S1 is false.

## D. Both S1 and S2 are false.

Explanation:
S1 is false: Assume a Language over Σ={0,1} such that it has “0” as substring. The DFA for L1
is: In this DFA every state is final state except initial state.
image:s19.PNG
Clearly this language L is notΣ+.
S2 is false: Assume a Language L2 over Σ={0, 1} such that every string starts with “0” and
empty string is also in language.
The NFA for L2 is: In this NFA every state is final state.
image:s20.PNG
The corresponding DFA of L2 is
image:s21.PNG
Clearly the language accepted by NFA is not Σ*.

48. Let R = (a, b, c, d, e, f) be a relational schema with the following dependency c→f, e→a, ec→d, a→b.
Which one of the following is True about the R? ( Marks: 2.00 )
A. The schema is not in 2NF
Explanation:
R = (a, b, c, d, e, f)
c→f
e→a
ec→d
a→b
(ce)+=cefadb
ce is a Candidate key and e→a, c→f are partial dependencies. So, the schema is not in 2NF,
but only in 1NF.

## 49. Consider the following relational schemas:

Employee(eno,ename,loc)
Dept(eno,dno,dname)
Where the primary keys are shown underlined. The number of tuples in the Employee and Dept tables
are 100 and 10 respectively. What are the maximum and minimum number of tuplesthat can be present
in(Employee⊕Dept), where ⊕ denotes natural join? ( Marks: 0.00 )
A. 1000, 100

B. 10, 10
Explanation:
If 10 different employees from 100 employees in Employee table works with departments in
Dept tables then there will be only one match results in 10 tuples (one for each department
works).

C. 1000, 10

D. 100, 10

50. Suppose we have Single Source Shortest Path on the following Adjacency Matrix with vertex 0 as the
source.
image:s3.PNG
Find out total cost for reaching source node to all other vertices for which the shortest path distances
are finalized(Note: No need to calculate Infinity cost vertices) ____ (NAT) ( Marks: 0.00 )

Explanation:

Use Dijkstra’s Algorithm for SSST because all the edge weights are positive. When compared to
bellman ford algorithm, Dijkstra’s algorithm is faster
image:s4.PNG
Step-2:
The source vertex is 0, make all the vertices cost infinity. The ‘0’ vertex having only 1 our going edge.
image:s5.PNG
Perform all the vertices in same procedure; the dijkstra’s is following greedy method. So, it will select
every time minimum cost edge.
Step-3:
image:s6.PNG
image:s7.PNG
image:s8.PNG
Step-9:
The total cost for reaching source node to all other nodes.
0+1+6+7+8+10+18=50
Note: We are only considered possible edge weights, according to actual procedure; we have drawn
entire logical representation and all edge weights.

## 51. Read the passage and answer the question below

In search for energy the fungus has become the earth’s major source of rot and decay. Wherever you
see mold forming on a piece of bread, or a pile of leaves turning to compost, or blown- down tree
becoming pulp on the ground, you are watching a fungus eating. Without fungus action the earth would
be piled high with dead plant life of past centuries
The author is primarily concerned with ( Marks: 0.00 )
A. Describing the actions of fungi
Explanation:
Options Warning people the dangers of fungi, Writing a humorous essay on fungi and Relating
how plants use solar energy. don’t relate much with the passage, whereas option Describing the
actions of fungi ) is very evident from the passage.

## D. Writing a humorous essay on fungi

52. When 4-way set associative mapping of cache memory is done and main memory size is 8GB and Tag
field has 12 bits. What will be the cache size (consider, memory is byte addressable) ( Marks: 2.00 )
A. 8 MB
Explanation:
Main memory size = 8GB = 2^33 Bytes (Byte addressable)

## Tag bits + x + y = 33 bits

x + y = 33-12 = 21 bits
Cache size = 2^(21+2) = 2^(23) B = 8 MB
Hence 8 MB is the answer.

B. 64 MB

C. 4 MB

D. 16 MB

53. In an Ethernet local area network, which one of the following statements is TRUE ? ( Marks: 1.00 )
A. The exponential backoff mechanism reduces the probability of collision on
retransmissions
Explanation:
(A station stops to sense the channel once it starts transmitting a frame.) This option is false as
in Ethernet the station is not required to stop to sense for the channel prior frame transmission.
( A station continues to transmit the packet even after the collision is detected.
) Once the collision has occurred the data transmission is stopped as the jam signal is sent.
Thus this option is also incorrect.
(The purpose of the jamming signal is to pad the frames that are smaller than the minimum
frame size.
) A signal is jammed to inform all the other devices or stations about collision that has occurred
so that further data transmission is stopped. Thus this option is also false
(The exponential backoff mechanism reduces the probability of collision on retransmissions
) To reduce the probability of collision on retransmissions an exponential back off mechanism is
used. Thus, only this option is true.

## B. A station stops to sense the channel once it starts transmitting a frame.

C. The purpose of the jamming signal is to pad the frames that are smaller than the minimum
frame size.

D. A station continues to transmit the packet even after the collision is detected.

54. A host in an organization has an IP address 150.32.64.34 and a subnet mask 255.255.240.0. What is
the address of this subnet? What is the range of IP addresses that a host can have on this subnet?
( Marks: 2.00 )
A. Subnet :150.32.64.0, Range: 150.32.64.0 to 150.32.79.255
Explanation:
The following mask operation derives the subnet address,(Bitwise AND)
Address : 10010110 00100000 01000000 00100010
Mask : 11111111 11111111 11110000 00000000

## Subnet : 10010110 00100000 01000000 00000000 (150.32.64.0)

As its class B, first 4 bits for subnet from third octet. Therefore,
The range of IP addresses that a host can have is as follows,
From : 10010110 00100000 01000000 00000000
To : 10010110 00100000 01001111 11111111

(150.32.64.0 to 150.32.79.255 )

## D. Subnet :150.32.92.0, Range: 150.32.64.0 to 150.32.160.255

55. Suppose ‘G’ is a bipartite graph with ‘8’ vertices, then what is the maximum possible number of edges.
( Marks: 1.00 )
A. 32

B. 16
Explanation:
Let one vertices set contain ‘n’ and other contain (8 – n) vertices.
Then number of edges =n×a-n
=8n-n2
=f(n) say
To maximize f(x)
f^' (x)=0⇒2n-8=0
n= 8/2=4
So a set has 4 & other set has 4 vertices.
Then each vertex from one set has edge with all other set vertices.
So 4×4=16 edges are present
C. 50

D. 24

56. Fresh fruit contains 64% water and dry fruit contains 19% water. How much dry fruit can be obtained
from 126 Kg of fresh fruits? ( Marks: 0.00 )
A. 70kg

B. 63kg

C. 56kg
Explanation:
image:s26.PNGFruit content in 126 kg of fresh fruit =36/100×126=45.36 Kg
This will be the amount of fruit content in the dry fruit.
But it constitutes to only 81% as 19% water is present in dry fruit
81%-45.36
100%- 45.36/81×100=56 Kg
We get 56 Kg dry fruit from 126 Kg of fresh fruit.

D. 75kg

## 57. SELECT stu_name

FROM Student
WHERE name IN(SELECT class_name
FROM Student
WHERE marks=100);
What will be the output? ( Marks: 2.00 )
A. the names of all students of all classes in which atleast one student has 100 marks in
mathematics
Explanation:
The inner query retrieves the name of the class in which atleast has 100 marks in mathematics.
The outer query will output the name of all students of the classes retrieved by the inner query.

B. the names of all students in all classes having 100 marks in mathematics
C. the list of names of students with 100 marks in mathematics

D. the names and class of all students whose marks in mathematics is 100

58. Suppose that we have a two-level page translation scheme with 4K-byte pages and 4-byte page table
entries (includes a valid bit, a couple permission bits, and a pointer to another page/table entry). What
is the format of a 32-bit virtual address ( Marks: 1.00 )
A. Outer Page Table Index : 10 bits, Inner Page Table Index : 10 bits, Offset : 12 bits
Explanation:
Solution : Outer Page Table Index : 10 bits, Inner Page Table Index : 10 bits, Offset : 12
Page size is 4KB so, Offset is 12 bits.
Outer page table should fit in one page. 4KB / 4byte = 1K entries or 10 bits. So, remaining
bits = (32-12-10) = 10 bits for inner page table.

B. Outer Page Table Index : 10 bits, Inner Page Table Index : 12 bits, Offset : 10 bits

C. Outer Page Table Index : 12 bits, Inner Page Table Index : 12 bits, Offset : 12 bits

D. Outer Page Table Index : 8 bits, Inner Page Table Index : 14 bits, Offset : 12 bits

59. Consider the following Knapsack bag. The Knapsack bag maximum Capacity is 25. Find out the
maximum profit of 0/1 Knapsack using bottom-up dynamic programming_______ (NAT).
image:s9.PNG ( Marks: 0.00 )

Explanation:

image:s10.PNG
Step-3: Arrange to recurrence relation, the maximum profit is 70.
Note: We can also Brute force method and Recursion tree method.
1. Bottom-up Dynamic programming the time Complexity is O(nW) where n is the number of items and
W is the capacity of knapsack.
2. Recursion tree time complexity is exponential O(2n)
3. Brute Force method time complexity is exponential O(n*2n)

## 60. . Which of the following statement(s) is/are false?

P: If a topological sort exists for the vertices in a directed graph, then a DFS on the
graph will produce no back edges.
Q: A depth-first search of a directed graph always produces the same number oftree edges (Hint:
independent of the order in which the vertices are provided andindependent of the order of the
adjacency lists). ( Marks: 0.00 )
A. Neither P nor Q

B. Only P

C. Only Q
Explanation:
P: True. Both parts of the statement hold if and only if the graph is acyclic.
Q: False. The DFS forest may contain different numbers of trees (andtreeedges) depending on
the starting vertex and upon the order in which verticesare searched. Consider the example
below. If the DFS starts at a, then it will visit b next, and(a, b) will become a tree edge. But if the
DFS visits b first, then a and b becomeseparate trees in the DFS forest, and (a, b) becomes a
cross edge.

D. Both P and Q

61. Choose the word which is opposite in meaning to PALTRY ( Marks: 0.00 )
A. Obsolete

B. Munificent
Explanation:
The word PALTRY means petty or trivial
Option Munificent means characterized by or displaying great generosity.
Option Improvident means not having or showing foresight; spendthrift or thoughtless.
Option Obsolete means no longer produced or used; out of date
Option Random means made, done, or happening without method or conscious decision
Therefore Option Munificent) is the right answer.

C. Improvident
D. Random

62. RavindrababuRavula is trying to adopt ‘Chiluvuru’ village and he wants to start constructing roads from
all the possible ways of a village. His friend Anand shared his idea that “If we start from any starting
point of a road there will be a possible path to cover all the roads and definitely, he has to reach at the
starting point”. According to the above problem statement, Please suggest best suitable technique that
will gives an optimal result. ( Marks: 1.00 )
A. Dynamic programming technique
Explanation:
The above problem is application of Travelling salesman problem(TSP). With the help of
dynamic programming we can achieve an optimal solution.

## C. Brute Force technique

D. Greedy technique

63. image:s38.PNG
Choose the correct statements
I) Set {d, e, f} has no lower bounds and no upper bounds
II) Set {a, c} has unique upper bound {h}; which is LUB of {a, c}
III) Set {b, d} has lower bound {a} and upper bound {g, i} ( Marks: 0.00 )
A. I, II, III

B. II, III

C. I, III

D. I, II
Explanation:
Set {d, e, f} has lower bounds ф, thus no GLB
{d, e, f} has upper bounds ф, thus no LUB.
Set {a, c} has lower bounds ф, thus no GLB
{a, c} has upper bound {h}, which is LUB also.
Set {b, d} has lower bounds {b}, which isGLB also
{b, d} has upper bounds {d, g}, since d<g, LUB is ‘d’

64. Identify the correct sequence in which the following packets are transmitted on the network by a host
when a browser requests a web page from a remote server,
assuming that the host has just been restarted. ( Marks: -0.33 )
A. HTTP GET request, DNS query, TCP SYN

## C. DNS query, TCP SYN, HTTP GET request

Explanation:
The concept to be followed.
Step 1: The client(browser) initiates a DNS query for remote server. It may be that they already
have this server in their DNS cache, in which case the client may simply send a TCP SYN
directly to the application server.
Step 2: The client will next send a connection request to the application server. This will be a
TCP SYN packet, the first in the TCP three-way handshake.
Step 3: Next, after the TCP connection has been established, the client will request data from
the server. In the web-based application, the client performs an HTTP GET.

## D. DNS query, HTTP GET request, TCP SYN

65. #include<stdio.h>
main ( )
{
int new ( );
new ( );
(*new) ( );
}

int new ( )
{
printf (“Welcome”);
}
( Marks: 0.00 )
A. prints Welcome Welcome
Explanation:
This is Function Pointer
What is Function Pointer?
In C function pointers are usual pointer variables, but they are little different from pointer to
objects. For example, function pointers are not allowed to cast void*. Also, pointer arithmetic is
also not defined anywhere in the C standard for pointer to function types. Leaving these
differences apart function pointer points to the address of a function as normal pointer variable
points to the address of a variable.

Being C programmers, we all know that a running C program occupies certain space in
memory. Both, the executable compiled program code and the variables used by the program,
are put inside the memory. And, every byte of memory is addressable. Thus a function in the
program code will have an address just like a character variable or any other variable stored in
memory. While, using function pointer; function's physical location or address in memory is
assigned to a pointer. Function's address is the entry point of the function and it is the address
used when the function is called. Once a pointer points to a function, the function can be called
through that pointer.

A function name, without a following set of parentheses, produces a pointer to that function.
The address operator can also be applied to a function name to produce a pointer to it. For
example, if myFunc is a pointer to a function, the corresponding function can be called either by
writing myFunc() or (*myFunc)(). If the function takes arguments, they can be listed inside the
parentheses.

B. prints Welcome

© 2018 - Raudra