Description

This mock test of Computer Science And IT (CS/IT) Mock Test 2 For Gate for GATE helps you for every GATE entrance exam.
This contains 65 Multiple Choice Questions for GATE Computer Science And IT (CS/IT) Mock Test 2 For Gate (mcq) to study with solutions a complete question bank.
The solved questions answers in this Computer Science And IT (CS/IT) Mock Test 2 For Gate quiz give you a good mix of easy questions and tough questions. GATE
students definitely take this Computer Science And IT (CS/IT) Mock Test 2 For Gate exercise for a better result in the exam. You can find other Computer Science And IT (CS/IT) Mock Test 2 For Gate extra questions,
long questions & short questions for GATE on EduRev as well by searching above.

QUESTION: 1

The candidate from our constituency was attacked during his __________ for the MP elections.

Solution:

canvas – a type of cloth

canvass – a campaign or surve

QUESTION: 2

Which of the following has the closest meaning to the sentence below :

She is an __________ writer. Everyone in the industry respects her.

Solution:

imminent – about to happen, to take place very soon

eminent – remarkable, distinguished

QUESTION: 3

Which of the following pairs are not related :

Solution:

Irritate and Nettle are synonyms. Both mean to excite a feeling of anger. Rest all are antonyms.

QUESTION: 4

Select the most appropriate option that would solve the problem.

**Problem** – What is the profit made by the shopkeeper?

**Statements:**

(I) The shopkeeper sold 200 articles at Rs.10 each.

(II) The profit per article is same as the cost price per article.

Solution:

From (I), selling price per article = Rs. 10

From (II), cost price per article = profit per article

Now, selling price = cost price + profit

So, cost price per article = profit per article = Rs. 5

Total 200 articles are sold.

Thus, total profit = Rs. 1000

Therefore, both (I) and (II) are together sufficient, but neither alone.

QUESTION: 5

What is the probability of getting atmost two tails when an unbiased coin is tossed thrice?

Solution:

Sample space = {HHH, HHT, HTH, THH, HTT, THT, TTH, TTT}

Desired options are HHH, HHT, HTH, THH, HTT, THT, TTH.

Thus, P(atmost two tails) = 7/8

QUESTION: 6

Select the option closest to the meaning of the idiom – Skeleton crew

Solution:

Skeleton crew means the least number of employees required to keep a work running

QUESTION: 7

For the given statement, select the assumption(s) that follow:

**Statement** – A large number of people from city S are moving to city T owing to extremely high temperature.

**Assumption :**

(I) City T has lower temperature than city S.

(II) City T has adequate resources to meet this shift.

Solution:

I is true as city T must be having lower temperature than city S. That is the reason why the people of city S have decided to move to city T.

QUESTION: 8

A bag contains 5 balls out of which some or maybe all are black. 2 balls are drawn from the bag and both are found to be black. What is the probability that all balls in the bag are black?

Solution:

Since 2 black balls were drawn, the number of black balls may be either of 2,3,4,5.

Let A2 = bag contains 2 black balls

A3 = bag contains 3 black balls

A4 = bag contains 4 black balls

A5 = bag contains 5 black balls

E = 2 black balls are drawn

P(E / A2) = ^{2}C_{2} / ^{5}C_{2} = 1/10

P(E / A3) = ^{3}C_{2} / ^{5}C_{2} = 3/10

P(E / A4) = ^{4}C_{2} / ^{5}C_{2} = 3/5

P(E / A5) = ^{5}C_{2} / ^{5}C_{2} = 1

Since the number of black balls is unknown, all events A2, A3, A4, A5 are equally likely.

So, P(A2) = P(A3) = P(A4) = P(A5) = 1/4

By Bayes’ theorem,

P(A5 / E) = **{**P(A5) X P(E / A5) **} / [{**P(A2) X P(E / A2) **}** + **{**P(A3) X P(E / A3) **}** + **{**P(A4) X P(E / A4) **}** + **{**P(A5) X P(E / A5) **}]**

P(A5 / E) = **{**1/4 X 1**} / [{**1/4 X 1/10**}** + **{**1/4 X 3/10**}** + **{**1/4 X 3/5**}** + **{**1/4 X 1**}]**

P(A5 / E) = 1/2 = 0.5

QUESTION: 9

Answer the question on the basis of the given table.

**Q. If the number of male post–graduate employees in company H is 1800, what percent of female employees in that particular company is NOT post–graduate?**

Solution:

Number of post graduate employees in company H = 80% of 3360 = 2688

Number of male post–graduate employees in company H = 1800

Therefore, number of female post–graduate employees in company H = 2688 – 1800 = 888

Also, Total female employees in company H = (5 / 14) * 3360 = 1200

So, number of female non post–graduate employees in company H = 1200 – 888 = 312

Hence, required percentage = (312 / 1200) * 100 = 26 %.

QUESTION: 10

Answer the question on the basis of the given table.

**Q. Which company has the highest number of employees per office?**

Solution:

F = 2788 / 17 = 164

H = 3360 / 21 = 160

B = 2880 / 18 = 160

C = 2310 / 14 = 165

QUESTION: 11

Given h(z) = (z+2)^{2} + 3(z+2) – 8, determine two functions f(z) and g(z) which when composed together as f(g(z)) will generate h(z).

Solution:

From option C, f(g(z)) = f(z+2) = (z+2)^{2} + 3(z+2) – 8 = h(z)

QUESTION: 12

What is the value of lim_{x–>0} (cos x – 1) / x

Solution:

There is a property in limits that lim_{x–>0} (cos x – 1) / x = 0.

QUESTION: 13

Match the best case complexity :

Solution:

Selection sort has a complexity O ( n^{2} ) in every case.

Insertion sort has the best case when the input is already sorted. Every insert requires constant time.

Heap sort has a complexity O (n log(n)) in every case.

QUESTION: 14

Consider the below Pseudo code written in C style

**Q. Which of the following is true about above code.**

Solution:

T(n) = 2 T(n–1) + c, which is O(2^{n}).

Since there can be atmost O(n) elements in function call stack, extra space required is O(n).

QUESTION: 15

Consider the below Pseudo code written in C style

**Q. Which of the following is true about the function in the above code.**

Solution:

The function represents code for a variation of subset sum problem.

Here we find if there is a subsequences with sum of squares of elements equal to X or not.

QUESTION: 16

Consider the following tree. How many nodes will have the same position regardless of the fact whether the tree is traversed in DFS or BFS order? (Consider that we select children from right to left starting from the rightmost child)

Solution:

DFS – ACEFHGBD

BFS – ACFBEHGD

So, A,C and D have the same position.

Thus, 3 is the required answer.

QUESTION: 17

The following numbers are inserted into an empty binary search tree in the given order: 10, 1, 3, 5, 15, 12, 16, 4, 2. What is the height of the binary search tree?

(Here height is defined as number of edges on longest path from root to a leaf)

Solution:

The height of a binary search tree is the maximum distance of a leaf node from the root.

QUESTION: 18

Which of the following is true about the given grammar

(NOTE : Here, ‘eps’ represesnts epsilon)

Solution:

FIRST (S) = {i, a}

FIRST (E) = {e, eps}

FIRST (C) = {b}

FOLLOW (S) = {$, e}

FOLLOW (E) = {$, e}

FOLLOW (C) = {t}

When we make the LL(1) parse table, we get a conflict in E row.

Thus, the given grammar is not LL(1).

QUESTION: 19

Which of the following is equivalent to :

Solution:

QUESTION: 20

Which of the following sets will have same number of elements in their power set?

Set 1 = {1, 2, 3, 4, 5, 6}

Set 2 = {{1, 2}, {3, 4}, {5, 6}}

Set 3 = {1, 2, 3, 4, {5, 6}}

Set 4 = {{1, 2, 3}, {4, 5, 6}}

Solution:

No. of elements in Set 1 = 6. So, No. of elements in the power set of Set 1 = 2^{6} = 64

No. of elements in Set 2 = 3. So, No. of elements in the power set of Set 1 = 2^{3} = 8

No. of elements in Set 3 = 5. So, No. of elements in the power set of Set 1 = 2^{5} = 32

No. of elements in Set 4 = 2. So, No. of elements in the power set of Set 1 = 2^{2} = 4

*Answer can only contain numeric values

QUESTION: 21

Consider a 4 – bit Johnson Counter initialized to ‘0000’. What is the number of clock cycles required for the counter to reset to ‘0000’?

Solution:

The Johnson counter resets the input, i.e., reaches the initial input in ‘2n’ clock cycles, where ‘n’ is the number of bits. So, for 4 – bit counter, the counter will reset in 2 X 4 = 8 clock cycles.

QUESTION: 22

Consider register reference instructions. Which one of the following is true:

Solution:

In register reference instructions, the first 12 bits (0 – 11) specify the register operation.

The next three bits are 111 and specify opcode and the last bit of the instruction is mode which is 0.

Therefore, last 4 bits are always 1110.

QUESTION: 23

Which class of ports does the port number 48151 belongs?

Solution:

Port numbers 1 – 1023 belong to the ‘well – known’ ports.

Port numbers 1024 – 49151 belong to Registered ports

Port numbers 49152 – 65535 belong to Private ports.

*Answer can only contain numeric values

QUESTION: 24

Consider the fragment offset field in the IPv4 header. What is its maximum value in bytes ?

Solution:

The length of fragment offset field is 13 bits. Also, fragment offset is measured in 8 – byte blocks.

So, maximum offset is (2^{13} – 1) X 8 = 65528 bytes.

QUESTION: 25

Match the protocols with the port numbers.

Solution:

HTTPS – 443

SNMP – 161

SMB – 445

POP3 – 110

QUESTION: 26

Consider below the regular expressions over alphabet {0, 1, 2}

(i) (0 + 01 + 012))^{*}

(ii) 0^{*}(0 + 1)^{*}(0+1+2)^{*}

(iii) 0^{*}(ε + 01)^{*}(Φ + 012)^{*}

(iv) 0^{*} + (01)^{*} + (012)^{*}

**Q. Which of the above regular expressions represent same language as 0 ^{*}(01)^{*}(012)^{*}**

Solution:

Making a DFA is all that is required to get the correct answer.

QUESTION: 27

Assuming a 16 – bit address space with 12 logical pages. What is the size of each page ?

Solution:

It takes 4 bits to reference 12 logical pages (2^{4} = 16, so maximum 16 pages can be referenced in 4 – bits). Now, we are left with 16 – 4 = 12 bits, which can be used for pages.

So, page size = 2^{12} = 4K

QUESTION: 28

What is the output of the following C program :

Solution:

For calculating ‘m’, any non – zero value is considered TRUE. In conditional operator, ++i makes i = –1, which makes it go to the TRUE case of the conditional operator. Now, ––k will return 0 and since there is AND after that, it will not be calculated any further as False && False or False && True will always return False.

So, i = –1, j = 2, k = 0, m = 0.

QUESTION: 29

Consider a table STUDENTS and the following two SQL queries.

Query 1 – DELETE FROM STUDENTS;

Query 2 – TRUNCATE TABLE STUDENTS;

**Q. Which of the following is TRUE :**

Solution:

Both the queries will remove all the rows from the table. But, query 1 can be undone by using rollback whereas query 2 is permanent. Also, DELETE fires all the associated triggers whereas TRUNCATE does not.

QUESTION: 30

**Q. What is the sum of all the elements of the L and U matrices as obtained in the L U decomposition?**

Solution:

So, the sum of all elements is 9.

QUESTION: 31

What is the output of the following C program :

Solution:

Computation for ‘i’ would be done using integer arithmetic whereas for ‘j’, it would be done using double or floating point arithmetic. Also, the precedence of ‘*’ and ‘/’ would be same and the expression would be calculated from Left to Right.

QUESTION: 32

Consider following three function written in C style :

**Q. Which of the following is true :**

**i) Time Complexity of fun1() is Θ(n ^{3})
ii) Time Complexity of fun3() is Θ(n^{3})
iii) Time Complexity of fun2() is Θ(1)
iv) Time Complexity of fun1() is O(log n)
v) Time Complexity of fun3() is Θ(n^{2})**

Solution:

Time Complexity of fun1() – Θ(log (n^{3})) = Θ(log n)

Time Complexity of fun2() – O(1)

Time Complexity of fun3() – Θ(n^{3})

QUESTION: 33

Consider a network path with three links.

Link 1 – Speed : 10 Gbps, Propagation Delay : 40ms

Link 2 – Speed : 2 Gbps, Propagation Delay : 5ms

Link 3 – Speed : 2 Gbps, Propagation Delay : 10ms

Assume processing delay to be zero.

A data packet of 500 KB is sent from a source to a destination via the path : link 1 – link 3 – link 2.

**Q. What is the total delay in transmitting the packet?**

Solution:

Total delay = Propagation delay + Transmission Delay + Queuing delay + Processing delay

Total delay = 40ms + 10ms + 5ms + 500KB X (1/10Gbps + 1/2Gbps + 1/2Gbps)

Total delay = 59.40 ms

NOTE : Here, ‘B’ is bytes (in data) and ‘b’ is bits (in speed)

QUESTION: 34

Consider below statements about Heap Data Structure

i) Time complexity of making a Min Heap from n unsorted elements is O(n)

ii) Heap is preferred over Linked list for implementation of Doubly Ended Queue.

iii) Heap is preferred over Binary Search Tree for implementation of Priority Queue.

iv) To heapify a node in Heap, all subtrees of the node must be heapified.

v) If we use Singly Linked List instead of array for implementation Heap, then time complexity of build heap increases.

**Q.Which of the above are true?**

Solution:

QUESTION: 35

Consider below program

**Q. Which of the following is true about the program:**

Solution:

Comma is used either as a separator or an operator. Here, it is used in line 4 as a separator rather than operator. It should be written as :

*Answer can only contain numeric values

QUESTION: 36

Assume CSMA/CD protocol. Find the least frame length in bytes for a 2 Mbps bit rate and 1.5km long network where propagation delay is 4.25 nano seconds per metre.

Solution:

Minimum frame size for CSMA/CD = 2 X Propagation delay

Minimum frame size = 2 X Propagation Delay per metre X Length of the network X Bit Rate

Minimum frame size = 2 X 4.25 X 10^{– 9} X 1.5 X 10^{3} X 2 X 10^{6}

So, minimum frame size = 25.50/8 = 3.1875 bytes

QUESTION: 37

Which of the following has the longest range ?

Solution:

WiFi : 802.11n has the highest range among the other given choices.

QUESTION: 38

Which of the following follow commutative law but not associative law?

Solution:

All gates follow commutative law.

AND, OR, XOR and XNOR follow associative law.

*Answer can only contain numeric values

QUESTION: 39

Solve upto 2 places after the decimal :

Solution:

On opening the summation, we would be left with (1) + (1/2) – (1/11) – (1/12), which is equal to 175/132. Taking upto 2 places after the decimal, we get 1.32 as our answer.

QUESTION: 40

Consider a function f(A,B,C,D) defined by the summation of the terms 1, 5, 6, 7, 11, 12, 13, 15. What is the value of function ‘f’ in the SOP form?

Solution:

QUESTION: 41

Consider the recurrence relation T(n) = T(n–1) + T(n/2) + n.

Which of the following is a good tight upper bound on T(n)

Solution:

QUESTION: 42

WiFi is :

Solution:

WiFi is half duplex.

QUESTION: 43

Consider the grammar given below:

The grammar is :

(i) LL(1)

(ii)LR(0)

(iii)LR(1)

Solution:

The Grammar is ambiguous. For a string “abab” two derivations are possible and no ambiguous grammar can be LR.

Derivation 1 : S → AS → SAS → ASAS → aSAS → abAS → abaS → abab

Derivation 2 : S → AS → aS → aAS → aSAS → abAS → abaS → abab

QUESTION: 44

Consider the automaton X over the alphabet {x,y,z}

**Q. Which of the below statements are true about the diagram:
(i) ε ∈ L(X)
(ii) The Automaton is a DFA.
(iii) yxzxyzx ∈ L(X)
(iv) yyxxzyxyzxz ∈ L(X)
(v) The Language accepted by X contains words that contain at least one x, y, y and x in that order.**

Solution:

(i) is false: empty strings can’t be accepted

(ii) is false: as we can go to multiple next states from state 1 and symbol x.

(iii) is false: There is no path that can lead to final state for yxzxyzx

(iv) is true : yyxxzyxyzxz is acceptable by NFA

(v) is true : We move to final state only when we have seen x, y, y and x in that order

QUESTION: 45

Which of the following statements are true?

S1 : A language accepted by Non – Deterministic PDA can also be accepted by Deterministic PDA.

S2 : A language accepted by Non – Deterministic FA can also be accepted by Deterministic FA.

S3 : A language accepted by Non – Deterministic Turing Machine can also be accepted by Deterministic Turing Machine.

Solution:

QUESTION: 46

Consider three processes P1, P2 and P3 arriving at 0ms, 4ms and 10ms respectively and have burst times 8ms, 4ms and 1ms respectively. Which of the following will have the highest average waiting time ?

Solution:

Round Robin with time quantum 1 will have the highest average waiting time of 3ms. Rest all will have average waiting time less than 3ms.

QUESTION: 47

Consider the following statements :

(i) T flip flop can be designed using D flip flop

(ii) JK flip flop can be designed using D flip flop

(iii) JK flip flop can not be designed using T flip flop

**Q. Which of the above are True ?**

Solution:

It is possible to design JK flip flop using T flip flop.

T = J Q_{n}‘ + K Q_{n}

*Answer can only contain numeric values

QUESTION: 48

Consider an instruction pipeline with four stages (S1, S2, S3 and S4) each with combinational circuit only. The pipeline registers are required between each stage and at the end of the last stage. Delays for the stages and for the pipeline registers are as given in the figure:

**Q. What is the approximate speed up of the pipeline in steady state under ideal conditions when compared to the corresponding non-pipeline implementation?**

Solution:

Time without pipeline = 8 + 1 + 12 + 15 ns = 36 ns

Time with pipeline = 15 + 1 ns = 16 ns

Speedup = 36/16 = 2.25

QUESTION: 49

Assume two relations R1(X,__Y__) with Primary key Y and 1000 tuples and R2(__Y,Z__) with primary key YZ and 2000 tuples and it is given that R2. Y is foreign key to R1.Y

What will be maximum and minimum number of tuples in natural join of R and S?

Solution:

QUESTION: 50

Select the option that will give highest number of page faults for the sequence – 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1.

Solution:

Optimal Page Replacement Algorithm with 3 frames – 9 page faults

Optimal Page Replacement Algorithm with 4 frames – 8 page faults

LRU Page Replacement Algorithm with 3 frames – 12 page faults

LRU Page Replacement Algorithm with 4 frames – 8 page faults

*Answer can only contain numeric values

QUESTION: 51

Solve :

Round off the answer to the nearest integer.

Solution:

*Answer can only contain numeric values

QUESTION: 52

What is mod(product of eigen values) for the matrix :

Solution:

Th eigen values of the matrix are 1, 2 and -2, the product of which is -4.

Taking mod, the answer is 4.

QUESTION: 53

Consider the following query on a relation REL(X,Y,Z) with candidate keys X and Y.

Q1: select count(*) from (select X,Y from REL)R1 NATURAL JOIN (select Y,Z from REL)R2;

Q2: select count(*) from (select X,Y from REL)R1 NATURAL JOIN (select X,Z from REL)R2;

Q3: select count(*) from (select X,Z from REL)R1 NATURAL JOIN (select Y,Z from REL)R2;

**Q.The result of which queries will be equivalent ?**

Solution:

*Answer can only contain numeric values

QUESTION: 54

Predict the output of the C program:

If there is compile error, your answer should be 99.

If there is runtime error, your answer should be 999.

If the answer is any junk value, your answer should be 9999.

Solution:

Inside fun(), q is a copy of the pointer p. So if we change q to point something else then p remains unaffected.

QUESTION: 55

Consider a Binary Tree where the allowed height difference between left and right children of every node is at most one. What are the maximum and minimum possible heights of such a Binary Tree ?

Solution:

The binary tree as per the question would be an AVL Tree.

Height of AVL would be minimum when tree is complete like Heap, which is floor(log n).

Height would be maximum when differences between heights is exactly one for every internal node, which is approximately 1.44 log n.

QUESTION: 56

What is the solution of the following recurrence relation :

T(n) = T(n/4) + T(n/2) + n^{3}

T(1) = c

T(0) = 0

Solution:

*Answer can only contain numeric values

QUESTION: 57

Consider a system generating 20 bit frames and connected through a shared 20kbps channel. Find throughput in percent if slotted ALOHA is used and frame rate is 1000 fps.

Your answer should be rounded off to the nearest integer.

Solution:

Frame size = L = 20 bits

Rate = R = 20kbps

Transmission time,T = L/R = 1 X 10^{-3} s

Throughput, S = G e^{-G}, where G= Number of frames per T

So, G = 1.

Therefore, S = e^{-1} = 37 % approximately

QUESTION: 58

Consider a graph with ‘n’ nodes such that 1 node is master node and all other are slave nodes such that the master is connected to all slaves but no two slaves are connected. What is the chromatic number for such graph?

Solution:

Lets say that we give color RED to master. Since slaves are connected to the master, no slave can be given RED color but since all of them are mutually unconnected, they all can be given same color, say GREEN. So, we need only two colors.

QUESTION: 59

Match the correct choices :

Solution:

QUESTION: 60

In the Lexical Analysis, regular expression can be used to model

Solution:

The structure of all lexemes(of any length) in the program can be verified & described by a Regular Grammar, and a Regular Grammar can be described using a Regular Expression.

QUESTION: 61

Match the correct choices :

Solution:

QUESTION: 62

A relation R has no composite candidate keys. Which of the following is always true for relation R?

Solution:

A relation without composite keys will always satisfy the conditions for a relation to be in 2NF.

*Answer can only contain numeric values

QUESTION: 63

Consider a frame 1101011011 and a generator polynomial 10011. What is the number of 1’s in the transmitted frame?

________

Solution:

*Answer can only contain numeric values

QUESTION: 64

Consider a symmetric key cryptography system with 15 users. What is the number of keys required for this system?

________

Solution:

Number of keys = (15 X 14) / 2 = 105

QUESTION: 65

Consider following forwarding table in router

**Q. An incoming packet with IP address 201.10.7.17 is forwarded to outgoing link :**

Solution:

Routers use Longest Prefix Matching rule. The rule is to find the entry in table which has the longest prefix matching with incoming packet’s destination IP, and forward the packet to corresponding next hop.

- Computer Science And IT (CS/IT) Mock Test For Gate
Test | 65 questions | 180 min

- Sample GATE Mock Test - Computer Science And IT (CS/IT)
Test | 65 questions | 180 min

- Computer Science And IT (CS/IT) Mock Test - 5 For Gate
Test | 65 questions | 180 min

- Computer Science And IT (CS/IT) Mock Test 3 For Gate
Test | 65 questions | 180 min

- Computer Science And IT (CS/IT) Mock Test - 4 For Gate
Test | 65 questions | 180 min