Computer Science Study Materials for Competitive Exams

Sample Questions, Previous Year Solved Papers, Study Materials For Competitive Examinations Like UGC NET, SET And GATE Computer Science.

Sunday, 28 February 2016

21.       Consider a 4-bit Johnson counter with an initial value of 0000. The counting sequence of this counter is
(A) 0, 1, 3, 7, 15, 14, 12, 8, 0
(B) 0, 1, 3, 5, 7, 9, 11, 13, 15, 0
(C) 0, 2, 4, 6, 8, 10, 12, 14, 0
(D) 0, 8, 12, 14, 15, 7, 3, 1, 0
Answer: D
22.       For computers based on three-address instruction formats, each address field can be used to specify which of the following:
(S1) A memory operand
(S2) A processor register
(S3) An implied accumulator register
(A) Either S1 or S2                  (B) Either S2 or S3
(C) Only S2 and S3                 (D) All of S1, S2 and S3
Answer: A
23.       Suppose two hosts use a TCP connection to transfer a large file. Which of the following statements is/are FALSE with respect to the TCP connection?
I. If the sequence number of a segment is m, then the sequence number of the subsequent segment is always m+1.
II. If the estimated round trip time at any given point of time is t sec, the value of the retransmission timeout is always set to greater than or equal to t sec.
III. The size of the advertised window never changes during the course of the TCP connection.
IV. The number of unacknowledged bytes at the sender is always less than or equal to the advertised window.
(A) III only                      (B) I and III only
(C) I and IV only           (D) II and IV only
Answer: B
24.       Suppose that everyone in a group of N people wants to communicate secretly with the N-1 others using symmetric key cryptographic system. The communication between any two persons should not be decodable by the others in the group. The number of keys required in the system as a whole to satisfy the confidentiality requirement is
(A) 2N                (B) N(N-1)
(C) N(N-1)/2      (D) (N-1)2
Answer: C
25.       Which of the following statements is/are FALSE?
I. XML overcomes the limitations in HTML to support a structured way of organizing content.
II. XML specification is not case sensitive while HTML specification is case sensitive.
III. XML supports user defined tags while HTML uses pre-defined tags.
IV. XML tags need not be closed while HTML tags must be closed.
(A) II only                       (B) I only
(C) II and IV only                      (D) III and IV only
Answer: C

26.       Which one of the following fields of an IP header is NOT modified by a typical IP router?
(A) Checksum              (B) Source address
(C) Time to Live (TTL) (D) Length
Answer: B
27.       In one of the pairs of protocols given below, both the protocols can use multiple TCP connections between the same client and the server. Which one is that?
(A) HTTP, FTP              (B) HTTP, TELNET
(C) FTP, SMTP             (D) HTTP, SMTP
Answer: A
28.       For any two languages L1 and L2 such that L1 is context-free and L2 is recursively enumerable but not recursive, which of the following is/are necessarily true?
I. L1’ (complement of L1) is recursive
II. L2’ (complement of L2) is recursive
III. L1’ is context-free
IV. L1L2 is recursively enumerable
(A) I only                        (B) III only
(C) III and IV only         (D) I and IV only
Answer: D
29.       Consider a system with byte-addressable memory, 32-bit logical addresses, 4 kilobyte page size and page table entries of 4 bytes each. The size of the page table in the system in megabytes is ................
Answer: 4
30.    The following two functions P1 and P2 that share a variable B with an initial value of 2 execute concurrently.
P1( )       {                                   P2( )    {
C = B – 1;                               D = 2 * B;
B = 2 * C;                               B = D - 1;
}                                                  }
The number of distinct values that B can possibly take after the execution is ...............
Answer: 3

Thursday, 25 February 2016

Q. 11 – Q. 35 carry one mark each.
11.       If g(x)=1−x and h(x)=x/x-1, then g(h(x))/h(g(x)) is:
(A) h(x)/g(x)       (B) -1/x
(C) g(x)/h(x)      (D) x/(1-x)2
Answer: A
g(h(x)) = g(x/(x-1)) = 1 - x/(x-1) = -1/(x-1)
h(g(x)) = h(1-x) = (1-x)/((1-x)-1) = -(1-x)/x
g(h(x)) / h(g(x)) = [-1/(x-1)] / [-(1-x)/x]
                   = -x/(x-1)2
h(x) / g(x) = [x/(x-1)] / (1-x) = [x/(x-1)] / -(x-1)
                            = -x/(x-1)2
So answer is option (A).
12.       Limx→∞ x1/x is
(A) ∞                   (B) 0
(C) 1                   (D) Not defined
Answer: C
x1/x = e1/x log x
limx→∞ x1/x limx→∞ e1/x log x
                     = e ^ limx→∞1/x log x
                     = e^0 [numerator = finite, denominator = infinite and finite/infinite = 1/∞ = 0]
                     = 1
13.       Match the following:
(P) Prim’s algorithm for minimum spanning tree               (i) Backtracking
(Q) Floyd-Warshall algorithm for all pairs shortest paths (ii) Greedy method
(R) Mergesort                                                                           (iii) Dynamic programming
(S) Hamiltonian circuit                                                                        (iv) Divide and conquer
(A) P-iii, Q-ii, R-iv, S-i
(B) P-i, Q-ii, R-iv, S-iii
(C) P-ii, Q-iii, R-iv, S-i
(D) P-ii, Q-i, R-iii, S-iv
Answer: C
14.       Which one of the following is the recurrence equation for the worst case time complexity of the Quicksort algorithm for sorting (≥2) numbers? In the recurrence equations given in the options below, c is a constant.
(A) T(n) = 2T(n/2) + cn
(B) T(n) = T(n-1) + T(1) + cn
(C) T(n) = 2T(n-1) + cn
(D) T(n) = T(n/2) + cn
Answer: B
When the pivot is the smallest or largest element at partitioning on a block of size n the result yields
(i) one empty sub-block.
(ii) one element (pivot) in the correct place.
(iii) one sub block of size n-1.
Hence recurrence relation T(n) = T(n-1)+T(1)+Cn
15.       The height of a tree is the length of the longest root-to-leaf path in it. The maximum and minimum number of nodes in a binary tree of height 5 are
(A) 63 and 6, respectively                  (B) 64 and 5, respectively
(C) 32 and 6, respectively                  (D) 31 and 5, respectively
Answer: A
Maximum number of nodes is possible in a binary tree, if maximum number of nodes are present in each level. Thus, maximum number of nodes in a binary tree of height h is 2h+1 – 1.
A binary tree has minimum number of nodes, if each level has minimum number of nodes. Minimum nodes possible at every level is only one when every parent has one child. Such kind of trees are called skew binary trees. A skew binary tree of height h has h+1 nodes.

16.       Match the following:
(P) Condition coverage                      (i) Black-box testing
(Q) Equivalence class partitioning   (ii) System testing
(R) Volume testing                              (iii) White-box testing
(S) Alpha testing                                  (iv) Performance testing
(A) P-ii, Q-iii, R-i, S-iv              (B) P-iii, Q-iv, R-ii, S- i
(C) P-iii, Q-i, R-iv, S-ii              (D) P-iii, Q-i, R-ii, S-iv
Answer: C
17.       Which of the following is/are correct inorder traversal sequence(s) of binary search tree(s)?
I. 3, 5, 7, 8, 15, 19, 25
II. 5, 8, 9, 12, 10, 15, 25
III. 2, 7, 10, 8, 14, 16, 20
IV. 4, 6, 7, 9 18, 20, 25
(A) I and IV only                       (B) II and III only
(C) II and IV only                      (D) II only
Answer: A
18.       Which one of the following is TRUE at any valid state in shift-reduce parsing?
(A) Viable prefixes appear only at the bottom of the stack and not inside
(B) Viable prefixes appear only at the top of the stack and not inside
(C) The stack contains only a set of viable prefixes
(D) The stack never contains viable prefixes
Answer: C
19.       Which one of the following is NOT equivalent to p ↔ q?
(A) (┐p ˅ q) ˄ (p ˅ ┐q)             (B) (┐p ˅ q) ˄ (q → p)
(C) (┐p ˄ q) ˅ (p ˄ ┐q)             (D) (┐p ˄ ┐q) ˅ (p ˄ q)
Answer: C
20.    For a set A the power set of A is denoted by 2A. If A={5,{6},{7}}, which of the following options are TRUE?
I. ∅∈2A
II. ∅⊆2A
III. {5,{6}}2A
IV. {5,{6}}2A
(A) I and III only                        (B) II and III only
(C) I, II and III only                   (D) I, II and IV only
Answer: C

Thursday, 18 February 2016

General Aptitude
Q. No. 1 – 5 Carry One Mark Each
1.       Didn’t you buy ................. when you went shopping?
(A) any paper               (B) much paper
(C) no paper                 (D) a few paper
Answer: A
2.       Which of the following options is the closest in meaning to the sentence below?
She enjoyed herself immensely at the party.
(A) She had a terrible time at the party.
(B) She had a horrible time at the party.
(C) She had a terrific time at the party
(D) She had a terrifying time at the party
Answer: C
3.       Which of the following combinations is incorrect?
(A) Acquiescence – Submission
(B) Wheedle – Roundabout
(C) Flippancy – Lightness
(D) Profligate – Extravagant
Answer: B
4.       Based on the given statements, select the most appropriate option to solve the given question.
If two floors in a certain building are 9 feet apart, how many steps are there in a set of stairs that extends from the first floor to the second floor of the building?
(I) Each step is ¾ foot high.
(II) Each step is 1 foot wide.
(A) Statement I alone is sufficient, but statement II alone is not sufficient.
(B) Statement II alone is sufficient, but statement I alone is not sufficient.
(C) Both statements together are sufficient, but neither statement alone is sufficient.
(D) Statement I and II together are not sufficient.
Answer: A
5.       Given set A = {2, 3, 4, 5} and Set B = {11, 12, 13, 14, 15}, two numbers are randomly selected, one from each set. What is probability that the sum of the two numbers equals 16?
(A) 0.20              (B) 0.25
(C) 0.30                         (D) 0.33
Answer: A
There are 20 possible pairs from set A and set B.(5x4=20)
Out of which four pairs have sum 16.
(2, 14), (3, 13), (4, 12), (5, 11)
Probability = Favorable Outcomes/Total Outcomes
Probability = 4/20 = 0.20

Q. No. 6 – 10 Carry Two Marks Each
6.       Select the alternative meaning of the underlined part of the sentence.
The chain snatchers took to their heels when the police party arrived.
(A) took shelter in a thick jungle
(B) open indiscriminate fire
(C) took to flight
(D) unconditionally surrendered
Answer: C
7.       The given statement is followed by some courses of action. Assuming the statement to be true, decide the correct option.
There has been a significant drop in the water level in the lakes supplying water to the city.
Course of action:
(I) The water supply authority should impose a partial cut in supply to tackle the situation.
(II) The government should appeal to all the residents through mass media for minimal use of water.
(III) The government should ban the water supply in lower areas.
(A) Statements I and II follow.
(B) Statements I and III follow
(C) Statements II and III follow.
(D) All statements follow.
Answer: A
8.       The pie chart below has the breakup of the number of students from different departments in an engineering college for the year 2012. The proportion of male to female students in each department is 5:4. There are 40 males in Electrical Engineering. What is the difference between numbers of female students in the Civil department and the female students in the Mechanical department?
Answer: 32
No. of male students in Electrical Engineering = 40
Proportion of male to female students in each department is 5:4
Total no. of female students in Electrical Engineering Dept = 40 x (4/5) = 32
Total no. of students in Electrical Engineering Dept = (40 + 32) = 72 (which is 20%)
Total no. of students in the college = 72 x (100/20) = 360
Total no. of students in Civil department = 360 x (30/100) = 108
Total no. of female students in Civil Dept = 108 x (4/(5+4)) = 108 x (4/9) = 48
Total no. of students in Mechanical Dept = 360 x (10/100) = 36
Total no. of female students in Mechanical Dept = 36 x (4/9) = 16
The difference is 48 – 16 = 32.
9.       The probabilities that a student passes in Mathematics, Physics and Chemistry are m, p and c respectively. Of these subjects, the student has 75% chance of passing in at least one, a 50% chance of passing in at least two and a 40% chance of passing in exactly two. Following relations are drawn in m, p, c:
(I) p + m + c = 27/20
(II) p + m + c = 13/20
(III) (p)×(m)×(c) = 1/10
(A) Only relation I is true
(B) Only relation II is true
(C) Relations II and III are true.
(D) Relations I and III are true.
Answer: D
1 - (1 - m) (1 - p) (1 - c) = 0.75                                     ..............(1)
(1 - m)pc +  (1 - p)mc + (1 - c)mp + mpc = 0.5          ..............(2)
(1 - m)pc +  (1 - p)mc + (1 - c)mp  = 0.4        ..............(3)

From equations (2) and (3), we get, mpc = 0.1 = 1/10

After simplifying equation (1), we get.
p + c + m - (pc + mc + mp) + mpc = 0.75       
p + c + m - (pc + mc + mp) = 0.75 – mpc = 0.65
p + c + m - (pc + mc + mp) = 0.65                              ..............(4)

After simplifying equation (3), we get
pc + mc + mp - 3mpc = 0.4
pc + mc + mp = 0.4 + 3mpc = 0.4 + 3 x 0.1 = 0.7

After putting above value in equation (4), we get
 p + c + m - 0.7 = 0.65
 p + c + m = 1.35 = 27/20
10.    The number of students in a class who have answered correctly, wrongly, or not attempted each question in an exam, are listed in the table below. The marks for each question are also listed. There is no negative or partial marking.
Q No.
Answered Correctly
Answered Wrongly
Not Attempted
What is the average of the marks obtained by the class in the examination?
(A) 2.290           (B) 2.970
(C) 6.795           (D) 8.795
Answer: C
There are total 44 students. This can be obtained by adding last 3 columns of any row. Total marks = 2x21 + 3x15 + 1x11 + 2x23  + 5x31
            = 299
Average marks =  299/44 = 6.795