GATE 2011 Solution
This is my attempt to answer the questions appeared in GATE 2011 Computer Science paper. I cleared the exam with 35th rank. I have included some tips and reference books for the GATE aspirants. I have also tried to give an explanation for most of the solutions.
What I've seen from the 2011 and past papers is that almost all of the questions were from the standard books. I studied all subjects from the standard books while doing B.Tech. courses. And, for practice, I've used past papers from 2003-10. That's all I've done for my GATE preparation. I haven't joined any coaching or online test series for GATE.
Mathematics questions were mostly new and fresh. Also, you can never escape maths in computer science. So, you should have a strong mathematical base (especially Probability), if not then start with that.
If you have enough time along with preparation then spend your time on programming. Hackerrank is a very good site for that. You can challenge your programming skills along with mathematical skills on Projecteuler.
List of some standard books:
- Discrete mathematics: Kenneth H Rosen
- Digital Logic: Morris Mano
- Data Structure: Ellis Horowitz or Kruse (Kruse is easier with better examples)
- Algorithms: Coreman (you don't need anything else)
- Automata/TOC: Ullman (you don't need anything else)
- Compiler: Ullman
- Computer Networks: Frouzan (some topics are cleaner in Tanenbaum)
- Operating Systems: Galvin
- Database: Korth (Navathe for B and B+ Trees)
- Computer Organization/Architecture: Hamacher + Morris Mano (both have their strengths and weakness)
Questions: Index
Set-C ordering
Q.1 - Q.25 (1 mark questions)
Q.26 - Q.45 (2 mark questions)
Question 1
Consider a relational table with a single record for each registered student with the following attributes.
- Registration_Num: Unique registration number of each registered student
- UID: Unique identity number, unique at the national level for each citizen
- BankAccount_Num: Unique account number at the bank. A student can have multiple accounts or join accounts. This attribute stores the primary account number.
- Name: Name of the student
- Hostel_Room: Room number of the hostel
Which one of the following option is INCORRECT?
- BankAccount_Num is candidate key
- Registration_Num can be a primary key
- UID is candidate key if all students are from the same country
- If S is a superkey such that then is also a superkey
Explanation
"X is the candidate key of a relation R only if X→Y where Y is all subsets of R"
-- Navathe (Fundamentals of DBMS)
But it neither satisfies BankAccount_Num→UID nor BankAccount_Num→Registration_Num
Question 2
A computer handles several interrupt sources of which the following are relevant for this question.
- Interrupt from CPU temperature sensor (raises interrupt if CPU temperature is too high)
- Interrupt from Mouse (raises interrupt if mouse is moved or button is pressed)
- Interrupt from Keyboard (raises interrupt when a key is pressed or released)
- Interrupt from Hard Disk (raises interrupt when a disk read is completed)
Which one of these will be handled at HIGHEST priority?
- Interrupt from Hard Disk
- Interrupt from Mouse
- Interrupt from Keyboard
- Interrupt from CPU temperature sensor
Explanation
"Higher priority interrupt levels are assigned to requests which, if delayed or interrupted, could have serious consequences. Devices with high speed transfer such as magnetic disks are given high priority, and slow devices such as keyboard receive low priority."
-- Morris Mano (Computer System Architecture)
We know that mouse pointer movements are more frequent than keyboard ticks. So its obvious that its data transfer rate is higher than keyboard. Delaying a CPU temperature sensor could have serious consequences, overheat can damage CPU circuitry. From the above information we can conclude that priorities are:
CPU temperature sensor > Hard Disk > Mouse > Keyboard
Question 3
Which of the following is NOT desired in a good Software Requirement Specifications (SRS) document?
- Functional Requirements
- Non-Functional Requirements
- Goals of Implementation
- Algorithms for Software Implementation
Explanation
"An SRS document should clearly document the following aspects of a system: Functional Requirements, Non-Functional Requirements and Goals of implementation."
-- Rajib Mall (Fundamentals of Software Engineering)
Question 4
HTML (HyperText Markup Language) has language elements which permit certain actions other than describing the structure of the web document. Which one of the following actions is NOT supported by pure HTML (without any server or client side scripting) pages?
- Embed web objects from different sites into the same page
- Refresh the page automatically after a specified interval
- Automatic redirect to another page upon download
- Display the client time as the part of the page
Explanation
- <OBJECT> ... tag is used to embed object
- <META HTTP-EQUIV = "Refresh" CONTENT = "5"> is used to refresh page after every 5 seconds
- <META HTTP-EQUIV = "Refresh" CONTENT = "0" URL = "another-page.html"> is used to redirect
Question 5
Which of the following pairs have DIFFERENT expressive power?
- Deterministic Finite Automata (DFA) and Non-Deterministic Finite Automata (NFA)
- Deterministic push down automata (DPDA) and Non-Deterministic push down automata (NPDA)
- Deterministic single-tape Turing machine and Non-Deterministic single-tape Turing machine
- Single-tape Turing machine and Multi-tape Turing machine
Explanation
"A language L is accepted by some DFA if and only if L is accepted by some NFA."
"If MN is a nondeterministic turing machine, then there is a deterministic turing machine MD suchthat L(MN) = L(MD)"
"Every language is accepted by multitape turing machine is recursively enumerable."
-- Ullman (Automata theory, languages and computations)
Question 6
A company needs to develop digital signal processing software for one of its newest inventions. The software is expected to have 40000 lines of code. The company needs to determine the effort in person-months needed to develop this software using the basic COCOMO model. The multiplicative factor for this model is given as 2.8 for this software development on embedded systems, while the exponentiation factor is given as 1.20. What is the estimation effort in person-months?
- 234.25
- 932.50
- 287.80
- 122.40
Explanation
" "
-- Rajib Mall (Fundamentals of Software Engineering)
Question 7
Let the time taken to switch between user and kernel modes of execution be t1 while the time taken to switch between two processes be t2. Which of the following is TRUE?
- t1 > t2
- t1 = t2
- t1 < t2
- nothing can be said about the relationship between t1 and t2
Explanation
"Whenever a trap or interrupt occurs, the hardware switches from user mode to monitor mode (this is, changes the state of the mode bit to 0). Thus whenever the operating system gains control of the computer, it is in monitor mode. The system always switches to user mode (by setting the mode bit to 1) before passing the control to a user program."
"When a context switch occurs, the kernel saves the context of old process in its PCB and loads the saved context of the new process scheduled to run."
-- Galvin (Operating System Concepts)
As mode switching is a part of context switching, it's definitely less than context switch time. Alternatively, whenever context switch occurs between two user processes then there are two mode changes first from user to monitor and after that monitor to user.
Question 8
A company needs to develop a strategy for software product development for which it has a choice of two programming languages L1 and L2. The number of lines of code (LOC) developed using L2 is estimated to be twice the LOC developed with L1. The product will have to be maintained for five years. Various parameters for the company are given in the table below.
Parameter | Language L1 | Language L2 |
---|---|---|
Man years needed for development | LOC/10,000 | LOC/10,000 |
Development cost per man year | ₹ 10,00,000 | ₹ 7,50,000 |
Maintenance time | 5 years | 5 years |
Cost of maintenance per year | ₹ 1,00,000 | ₹ 50,000 |
Total cost of the project includes the cost of development and maintenance. What is the LOC for L1 for which the total cost of the project using L1 is equal to the cost of project using L2?
- 4000
- 5000
- 4333
- 4667
Explanation
Let LOC of , so LOC of
Hence,
Question 9
Consider the following activities related to email.
- m1: Send an email from mailbox server to a mail client
- m2: Download an email from mailbox server to a mail client
- m3: Checking email in a web browser
Which application level protocol used in each activity?
- m1:HTTP m2:SMTP m3:POP
- m1:SMTP m2:FTP m3:HTTP
- m1:SMTP m2:POP m3:HTTP
- m1:POP m2:SMTP m3:IMAP
Explanation
"SMTP is a push protocol; it pushes the message from the client to server"
"POP and IMAP supports pull protocol they can pull the message from the server"
"Web-Based mail: Mail transfer from Alice's browser to her mail server is done through HTTP. The message from the receiving server (the Web server) to Bob's browser is done through HTTP."
-- Forouzan (Data Communications and Networking)
It's now clear that
m1:SMTP | m2:POP or IMAP | m3:HTTP |
Question 10
If two fair coins are flipped and at least one of the outcomes is known to be head, what is the probability that both outcomes are heads?
- 1/3
- 1/4
- 1/2
- 2/3
Explanation
Let A = {at least one outcome is head} and B = {both outcomes are head}
So , , and
As , they are not independent events
Hence,
Alternatively,
Sample Space = {HT, TH, HH}
Event = {HH}
From axiomatic definition of probability
Question 11
A layer-4 firewall (a device that can look at all protocol headers up to the transport layer) CANNOT
- block entire HTTP traffic during 9:00PM and 5:00AM
- block all ICMP traffic
- stop incoming traffic from a specific IP address but allow outgoing traffic to the same IP address
- block TCP traffic from a specific user on a multi-user system during 9:00PM and 5:00AM
Explanation
"A packet-filter firewall cannot distinguish between different packets arriving at TCP port 80 (HTTP). Testing must be done at the application level (using URLs)."
-- Forouzan (Data Communications and Networking)
Entire HTTP traffic can be blocked by blocking TCP port 80 which is under the capabilities of L4 firewall. However, as L4 level firewall cannot access Application layer, it cannot block packets based on user identity.
Question 12
In a compiler, keywords of a language are recognized during
- parsing of the program
- the code generation
- the lexical analysis of the program
- dataflow analysis
Explanation
Lexical analysis includes recognition of keywords and identifiers.
-- Ullman (Compilers principles, techniques, & tools)
Question 13
An algorithm to find the length of the longest monotonically increasing sequence starting at index in the array.
Initialize
such that
Finally the length of the longest monotonically increasing sequence is .
Which of the following statement is TRUE?
- The algorithm uses dynamic programming paradigm
- The algorithm has a linear complexity and uses branch and bound paradigm
- The algorithm has a non-linear polynomial complexity and uses branch and bound paradigm
- The algorithm uses divide and conquer paradigm.
Explanation
It can be shown that algorithm has a linear complexity. As the array can be calculated from right to left in a single go. However it doesnot uses branch and bound paradigm. The branch and bound paradigm generally used to solve NP-hard problems. As it remove the recursions by solving each sub-problems only once it reflects the dynamic programming paradigm.
Question 14
Let be a regular language and be a context-free language such that . (For example, let be the language represented by the regular expression and be ). Then which of the following is ALWAYS regular?
Explanation
"If is a regular language over alphabet , then complement of is also a regular language."
-- Ullman (Automata theory, languages and computations)
Question 15
A max-heap is a heap where the value of each parent is greater than or equal to the value of its children. Which of the following is a max-heap?
Explanation
"-element heap has height ."
-- Cormen (Introduction to Algorithms)
While, C and D has correct height, they doesn't satisfy max-heap property.
Question 16
What does the following fragment of C program print?
char c[] = "GATE2011";
char *p = c;
printf("%s", p + p[3] - p[1]);
- GATE2011
- E2011
- 2011
- 011
Explanation
p[3] = 'E' = 69 (ASCII of E) and p[1] = 'A' = 65 (ASCII of A)
and p[3] - p[1] = 69 - 65 = 4
p is address of the first element of array and p+4 is the address of fifth element which is '2'.
So, printf will start from '2' and print till the end (until null character is found).
Question 17
Consider a hypothetical processor with an instruction of type LW R1, 20(R2), which during execution reads a 32-bit word from memory and stores it in a 32-bit register R1. The effective address of the memory location is obtained by the addition of a constant 20 and the contents of register R2. Which of the following best reflects the addressing mode implemented by this instruction for operand in memory?
- Immediate Addressing
- Register Addressing
- Register Indirect Scaled Addressing
- Base Indexed Addressing
Explanation
TODO:
Question 18
Let the page fault service time be 10ms in a computer with average memory access time being 20ns. If one page fault is generated for every 106 memory accesses, what is the effective access time for the memory?
- 21ns
- 30ns
- 23ns
- 35ns
Explanation
-- Galvin (Operating System Concepts)
p = 1/(10^6) = 0.000001
memory access time = 20ns
page-fault service time
= 10ms = 10000000ns
so effective access time
= .999999×20ns + .000001×10000000ns
= 29.99998ns ≈ 30ns
Question 19
The lexical analysis for a modern computer language such as Java needs the power of which one of the following machine models in a necessary and sufficient sense?
- Finite state automata
- Deterministic pushdown automata
- Non-Deterministic pushdown automata
- Turing Machine
Explanation
TODO:
Question 20
If the difference between expectation of the square of a random variable (E[X²]) and the square of the expectation of the random variable (E[X])² is denoted by R, then?
- R = 0
- R < 0
- R ≥ 0
- R > 0
Explanation
"Variance of a random variable X, V[X] = (E[X²]) - (E[X])²"
-- Cormen (Introduction to Algorithms)
Variance can never be less than zero. However, it can be zero.
Question 21
K4 and Q3 are graphs with the following structures (in order).
Which one of the following statements is TRUE in relation to these graphs?
- K4 is planar while Q3 is not
- Both K4 and Q3 are planar
- Q3 is planar while K4 is not
- Neither K4 nor Q3 are planar
Explanation
Both can be rearranged with no intersecting edges
Question 22
A thread is usually defined as a "light weight process" because an operating system (OS) maintains smaller data structures for a thread than for a process. In relation to this, which of the following is TRUE?
- On per-thread basis, the OS maintains only CPU register state
- The OS does not maintain a separate stack for each thread
- On per-thread basis, the OS does not maintain virtual memory state
- On per-thread basis, the OS maintains only scheduling and accounting information
Explanation
Os maintains separate stack, register and thread-specific data for different threads.
-- Galvin (Operating System Concepts)
Question 23
The minimum number of D flip-flops needed to design a mod-258 counter is
- 9
- 8
- 512
- 258
Explanation
"An -bit binary counter consists of flip-flops and can count in binary from to ."
-- Morris Mano (Digital logic and computer design)
So to count from to we needs at least flip-flops and
Question 24
The simplified SOP (Sum Of Product) form of the boolean expression is
Explanation
Solving using K-map answer is
Question 25
Which one of the following circuit is NOT equivalent to a 2-input XNOR (exclusive NOR) gate?
Explanation
Question 26
Consider evaluating the following expression tree on a machine with load-store architecture in which memory can be accessed only through load and store instructions. The variables a,b,c,d and e initially stored in memory. The binary operators used in this expression tree can be evaluate by the machine only when the operands are in registers. The instructions produce results only in a register. If no intermediate results can be stored in memory, what is the minimum number of registers needed to evaluate this expression?
- 2
- 9
- 5
- 3
Explanation
R1←c, R2←d, R2←R1+R2, R1←e, R2←R1-R2
Now to calculate the rest of the expression we must load a and b into the registers but we need the content of R2 later. So we must use another Register.
R1←a, R3←b, R1←R1-R3, R1←R1+R2
Question 27
Consider the following table of arrival time and burst time for three processes P0, P1 and P2.
Process | Arrival Time | Burst Time |
---|---|---|
P0 | 0 ms | 9 ms |
P1 | 1 ms | 4 ms |
P2 | 2 ms | 9 ms |
The pre-emptive shortest job first scheduling algorithm is used. Scheduling is carried out only at arrival or completion of processes. What is the average waiting time for the three processes?
- 5.0 ms
- 4.33 ms
- 6.33 ms
- 7.33 ms
Explanation
GANTT CHART
> Waiting time of P0 = 5 - 1 = 4
> Waiting time of P1 = 1 - 1 = 0
> Waiting time of P2 = 13 - 2 = 11
> Average waiting time = (4+0+11)/3 = 5
Question 28
A deck of 5 cards (each carrying a distinct number from 1 to 5) is shuffled thoroughly. Two cards are then removed one at time from the deck. What is the probability that the two cards are selected with the number on the first card being one higher than the number on the second card?
- 1/5
- 4/25
- 1/4
- 2/5
Explanation
You have to select 2 cards from 5. So, there are = 20 elementary events.
From which there are 4 favorable number of cases:
5 before 4, 4 before 3, 3 before 2 and 2 before 1.
Hence, probability = 4/20 = 1/5
Question 29
Consider a finite sequence of random values . Let be the mean and be the standard deviation of . Let another finite sequence of equal length be derived from this as , where and are positive constants. Let be the mean and be the standard deviation of this sequence. Which one of the following statements is INCORRECT?
- Index position of mode of X in X is the same as the index position of mode of Y in Y.
- Index position of median of X in X is the same as the index position of median of Y in Y.
Explanation
Adding a constant like b shift the distribution while multiplying to a constant like a stretch the distribution along median
Mode is the most frequent data of the distribution, so the index position of the mode will not change. From the above graph it is clear that index position of the median will also not change.
Now for the mean:
And for the standard deviation
Question 30
Consider a database table T containing two columns X and Y each of type integer. After the creation of the table, one record (X=1, Y=1) is inserted in the table.
Let MX and My denote the respective maximum values of X and Y among all records in the table at any point in time. Using MX and MY, new record is inserted in the table 128 times with X and Y values being MX+1, 2.MY+1 respectively. It may be noted that each time after the insertion, values of MX and MY change.
What will be the output of the following SQL query after the steps mentioned above are carried out?
SELECT Y FROM T WHERE X=7;
- 127
- 255
- 129
- 257
Explanation
increases as and so .
And, increases as and
So, at , value is
Question 31
Given , what will be the evaluation of the integral
- 0
- 2
Explanation