file · web viewopt(c) opt(d) (a) false, call swap(x, y) does not swap the value of (x,...

21
CS-2004 Q1. Opt(C) Q2. Opt(D) (a) False, Call swap(x, y) does not swap the value of (x, y), because it’s call by value and in call by value a and b does not share common memory location. (b) false, its swap the address of x and y. (c) False, (d) True, swap(x, y) cannot be used as the parameters are passing by value. Q3. Opt(D) Correct condition for stack full is: Top2= Top1+1 or Top1= Top2 -1, Q4. Opt(B) and (C) The binary search tree for given order is: Here are two possibility of height; if we count the height of root from 0 then Height of the tree is 3. Q5. Opt(B) Best Data Structure is stack to check arithmetic expression has balanced parentheses. Q6. Opt(D) Q7. Opt(C)

Upload: lylien

Post on 06-Feb-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: file · Web viewOpt(C) Opt(D) (a) False, Call swap(x, y) does not swap the value of (x, y), because it’s call by value and in call by value a and b does not share common

CS-2004

Q1. Opt(C)

Q2. Opt(D)(a) False, Call swap(x, y) does not swap the value of (x, y), because it’s call by value and in call by value a and b does not share common memory location.(b) false, its swap the address of x and y.(c) False, (d) True, swap(x, y) cannot be used as the parameters are passing by value.

Q3. Opt(D)Correct condition for stack full is:Top2= Top1+1 or Top1= Top2 -1,

Q4. Opt(B) and (C)The binary search tree for given order is:

Here are two possibility of height; if we count the height of root from 0 then Height of the tree is 3.

Q5. Opt(B)Best Data Structure is stack to check arithmetic expression has balanced parentheses.

Q6. Opt(D)Q7. Opt(C)

Statement i and ii are true.

Q8. Opt(B)Operator precedence Grammar does not have two consecutive non terminals and no epsilon production, so statement ‘i’ and ‘iii’ violate the rule of Grammar.

Q9. Opt(C)

Page 2: file · Web viewOpt(C) Opt(D) (a) False, Call swap(x, y) does not swap the value of (x, y), because it’s call by value and in call by value a and b does not share common

CS-2004

Q10. Opt(B)Because, by doing so, time required for saving and loading E1 as the first operand is saved.

Q11. Opt(A)I. False, Context Switching is Faster in user level threads, not in kernel level threading.II. TrueIII. TrueIV. True

Q12. Opt(D)Because, it is single sequential process it doesn’t make any change using FCFS or SSTF.

Q13. Opt(B)

c(R1)-d(R2)

This query contain the minus operator which means result of query is tuple selected from R1 cannot be the part of the tuple selected from R2 but in tables there exist the concept of referential integrity, Colum C is the foreign key of table R1 which is define on the primary key of the relation R2(D), so result of query necessarily a empty relation.

Q14. Opt(A)Student (RollNO, Name, Address)Enroll (RollNo, CourseNo, CourseName)

Maximum no of tuple in (Student* Enroll): Number of tuple presents in child table, because of Natural join i.e 8.Minimum no of tuple in (Student* Enroll): Number of tuple presents in child table, because of Natural join i.e 8.Ans is 8, 8

Q15. Opt(A) P-1, Q-4, R-3

Q16. Opt(B)Bridge use MAC address while routers uses IP address

Q17. Opt(D)x’y’+ xy + x’y

Ans: X’+ Y

Page 3: file · Web viewOpt(C) Opt(D) (a) False, Call swap(x, y) does not swap the value of (x, y), because it’s call by value and in call by value a and b does not share common

CS-2004

Q18. Opt(C) Indeterminate state means that state can not be determined because it may be toggling. But in SR ff toggling does not occur. So no indeterminate state is possible.

Q19. Opt(D)X=8, Y=11(73)8=(54)11

7x+3=5y+47x-5y=1Put x=8 and y=117*8-5*11=1

Q20. Opt(C)Q21. Opt(A)

Q22. Opt(B) Here mode of the transmission is asynchronous; in asynchronous mode we have to transmitSome extra bits per character, like start bit, end bit and parity bits. Start and end bit are compulsory, if not given then you have to add 1-bit for both respectively.So, transmit character will be: 1 start bit + 8 data bit + 2 stop bit +1 parity bit = 12 bits to transmit per character.if encoding tech is not given then Bit rate= Baud RateSo 8 bit character can be transmits in 1 sec= baud rate/ total bits for one character

9600/12 =800 characters

Q23. None of the option is right.x [ boy(x) y [ girl(y) taller(x, y) ] ]

Q24. Opt(B)For reflexive (x = y)And for transitive y>x then correct option:{(x,y) | y>=x and x,y {0,1,2,3,…}}

Q25. Opt(A) Total favorable Cases: {TTHH, THTH, HTHT, HTTH, THHT, HHTT} =6

Total no of Cases: 24=16Then probability = 6/16= 3/8

Page 4: file · Web viewOpt(C) Opt(D) (a) False, Call swap(x, y) does not swap the value of (x, y), because it’s call by value and in call by value a and b does not share common

CS-2004

Q26. Opt(C)

No of symmetric Relations will Be 2N(N+1)/2

Q27. Opt(B)

ABCD =IAB = D-1C-1 (AB)-1 = (D-1C-1)-1

B-1A-1 = CDB-1 = CDA

Q28. Opt(A)Taking first expression:(113. + -111.) + 7.512. + 7.519.51Here all three steps satisfied three digit floating point.

Now taking second expression:113. + ( -111. + 7.51)113. + ( -118.51) {but it is wrong because -118.51 is greater than three digit floating point number so first we have to round up 7.51 to 8 then next step will be:}113. + ( -111. + 8)113. + - 103.10.0

Q29. Opt(C)The tightest lower Bound on the no of comparison in worst case for comparison Based sorting is (nlong)

Q30. Opt(C)3-SAT- belong to NP- Complete, and 2- SAT –belong to P- class

Q31. Opt(C)

Page 5: file · Web viewOpt(C) Opt(D) (a) False, Call swap(x, y) does not swap the value of (x, y), because it’s call by value and in call by value a and b does not share common

CS-2004

Output=7

Q32. Opt(A)

Q33. Opt(D)

It’s print null string, after the execution of the for loop Array P look like this:

\n g n i r t

Because %s – print string up to \n (blank character) and first character of array P is \n, the print statement print only \n and terminate.

Q34. Opt(A)

Q35. Opt(B)Atleast in order are compulsory to identify a tree uniquely So:(a) False(b) True(c) True

Q36. Opt(A)To perform in Constant time in circular linked list P should point to the last node of list (Rear):If P point to last node Enqueue-O(1);

Dequeue-O(1);

Q37. Opt(A)32, 15, 20, 30, 12, 25, 16

Page 6: file · Web viewOpt(C) Opt(D) (a) False, Call swap(x, y) does not swap the value of (x, y), because it’s call by value and in call by value a and b does not share common

CS-2004

Q38. (A) +,*,- all are left Associative,^ is right associative. Precedence order from L to R ^, *, +, -Postfix expression for infix expression:a+b*c-d^e^fa+b*c-d^ef^a+b*c-def^^a+bc*-def^^abc*+-def^^abc*+def^^-

Q39. Opt(D)

Q40. Opt(D)(a) Union O(n2): to merge the list first we have to traverse first list up to last node and add pointer to first node of second list and again n complexity for suppress delicacy in the list, so total complexity O(n2)(b) Intersection O(n2), Membership O(n)(c) Membership O(n), Cardinality O(n)(d) Union O(n2), intersection O(n2)

Q41. Opt(C)

Q42. Opt(C)Note: Correction in code: m/m is replace by m/x

Q43. Opt(D) By closely analyzing the program, it is seen, the height of the tree is the evaluated by comparing the height of left subtree and right subtree of the tree using MAX function.

Q44. Opt(B)

Page 7: file · Web viewOpt(C) Opt(D) (a) False, Call swap(x, y) does not swap the value of (x, y), because it’s call by value and in call by value a and b does not share common

CS-2004

Vertex Set { P, Q, R, U, S, T}

Q45. Opt(C) Expression: 2 # 3 & 5 # 6 & 4

E. Value= 160

Q46. Opt(A)Gantt chart:

Turnaround time = Completion time – Arrival time P1=12-0=12P2= 4-1=3

Page 8: file · Web viewOpt(C) Opt(D) (a) False, Call swap(x, y) does not swap the value of (x, y), because it’s call by value and in call by value a and b does not share common

CS-2004

P3=8-2=6P4=5-4=1Avg. turnaround time= (12+3+6+1)/4=5.50

Q47. None of the option are correct

Q48. Opt(D)To avoid deadlock the order of waiting call should be same in all processes, so correct ans would be option D.

Q49. Opt(C)10 direct, 1 single, 1 double, 1 triple indirect pointer.Address size = 32 bit = 4 Byte No of address in one block = (Block Size)/ Address Size

= 210/22 = 28

Then maximum total Size of file = ( 10+ 28 + 28 x 28 + 28 x 28 x 28) x Block size= ( 10+ 28 + 28 x 28 + 28 x 28 x 28) x 210 Byte=16.06 GB approx

= 2^34 BYTES.

Q50. Opt(B)Candidate Key of relation will be: (RollNo, CourseNo) And (Name, CourseNo)1st FD: It is in BCNF2nd FD : BCNF3rd FD: Violate BCNF property but satisfied 3NF Property.4th FD: Violate BCNF but in 3NF.

So whole data base system in 3NF.

Q51. Opt(D)Query uses the theta join.Name of the girl student with more than all the boy students.

Q52. Opt(C)C= 6 byte, K= 14 byte, B= 512 byteOrder of the internal node:(N-1)K+ N*C= B(N-1)14+ N*6= 51214N-14+ 6N= 51220N= 526So N = Floor [526/20] = Floor [26.3]= 26.

Q53. Opt(D)

Page 9: file · Web viewOpt(C) Opt(D) (a) False, Call swap(x, y) does not swap the value of (x, y), because it’s call by value and in call by value a and b does not share common

CS-2004

the average salary of male employee more than the average salary in company.

Q54. Opt(B)A and B are two station on Ethernet A and B attempt to transmit a frame, collide and A win the Race and transmit its first frame. At the end of this successful transmission of A, Now again both attempt to transmit and collide, it is a first collision for station A and second collision for station B. so First station select the random number between 0 to 1 and station B select random number between 0 to 3 using exponential back off Algorithm 2i-1, where I is the collision number.

The probability of A wins the second Back off race is:Total Favorable Cases = {01, 02, 03, 12, 13}= 5Total Number of Cases = 8 P (win’s)= 5/8= 0.625

Q55. Opt(A)To forward the Packet Routers use the concept of “Longest Matching Prefix”, in this Net ID with highest number of one’s in sub net mask is used to check the route of packet.

Then next subnet mask:

So 1st packet will be delivered to Eth1.Similarly for next packet 192.12.17.10 will be forward to Eth2, which is the default Address of Router.

Q56. Opt(D)TCP Header = 20 byte,IP Header = 20 byte,Network caring capacity(MTU):For A = 1000 byte B = 100 byte C = 1000 byte

Page 10: file · Web viewOpt(C) Opt(D) (a) False, Call swap(x, y) does not swap the value of (x, y), because it’s call by value and in call by value a and b does not share common

CS-2004

So At the Network C delivered byte including Header will be 260 (80+20+80+20+40+20).Note: Header of Same layer of the other network will be removing by network and add itself header to packet.

Q57. Opt(B)Taking 512KB as data rate because it is bottleneck :By unitary method 512/260 = x/180 x= (512*180)/260 = 354.46

Q58. Opt(B)O/p = 1 If the Digit > 5 then corresponding Minterms are F= (5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) K-Map for Minterms:

F = BD+ CB+A = B(C+D) + ASo minimum number of Gates required is=3

Q59. Opt(A)F( a, b, c) = a’c + ac’ + bc’Make K-Map of given expression.

ac’ and ac’ are essential prime implicants.

Q60. Opt(A)

Page 11: file · Web viewOpt(C) Opt(D) (a) False, Call swap(x, y) does not swap the value of (x, y), because it’s call by value and in call by value a and b does not share common

CS-2004

Choose option one by one using option elimination method you would get R to X, 1 to Y, T to Z

Q61. Opt(D)

F= Q1’Q2+ Q1Q2’

Q62. Opt(B) 4 bit carry look adder has 4 level of circuitry if EX-OR gate is used, if EX-OR gate is implemented by AND & OR gate then it became 6 level circuitry.

Q63. Opt(D)Return Address Save in Stack will be:(2+ 1 +1+2+1)* size of the word + Base Address;7*4+1000=1028Size of the word = 32 bit = 4 byte

Q64. Opt(B)

Page 12: file · Web viewOpt(C) Opt(D) (a) False, Call swap(x, y) does not swap the value of (x, y), because it’s call by value and in call by value a and b does not share common

CS-2004

Q65. Opt(C) 2 –way set associative, 4 blocks thenNumber of sets = 4/2 = 2(Block Address) mod (No of set) = set number

8 mod 2 = 0 miss12 mod 2 = 0 miss0 mod 2 = 0 miss12 mod 2 = 0 hit8 mod 2 = 0 miss

Total number of miss: = 4

Q66. Opt(A) A = 11111010B = 00001010

A is the negative 2’s compliment number so original number is: - (00000110)2 = - (6)10 B = (00001010)2 = (10)10

So A* B= -(6)*(10) = -(60) = -(00111100)2 Negative number is represent is system in 2’s compliments form so number is: (11000100)2

Q67. Opt (A) In MUX there are 8 status lines for that we need 3 selection line so 3 bit for MUX, And control memory is 26 bit, in this 13- bit for micro operation and 3 bit for MUX and remaining 10-bit for control add register. So X = 10, Y = 3, 1024 words in control memory.

Q68. Opt(D)Transfer Rate = 10Mbyte,Frequency of processor = 600Mhz,Instillation Takes = 300 cycle

Page 13: file · Web viewOpt(C) Opt(D) (a) False, Call swap(x, y) does not swap the value of (x, y), because it’s call by value and in call by value a and b does not share common

CS-2004

Termination takes = 900 cycleData to transfer = 20KbyteSo data transfer time =

Total time = Initiate + Data transfer + termination

= 2002 microsec So % of processor time consumed = (Initialization + Termination)/ Total time; = (0.5 + 1.5)/ 2002

= 0.09% approx. 0.1%

Q69. Opt(C)Clock cycle time of pipeline processor: 160+5 = 165 ns So first instruction takes = 165*4 nsAnd remaining 999 takes = 999*165 ns So total number of cycle = 165*4+999*165 = 165495 ns = 165.5s

Q70. Opt(A)

Q71. (C) Since there are 3 equations while there are only 2 variables,,,,This system of equations will always have some unique solution.

Q72. Opt(D) E is the identity element of group and by using the associative property and using option elimination method correct option (d)a*a-1 = e inverse propertynow a*c = e = c*a by using commutative law.

Q73. Opt(A)

Page 14: file · Web viewOpt(C) Opt(D) (a) False, Call swap(x, y) does not swap the value of (x, y), because it’s call by value and in call by value a and b does not share common

CS-2004

Only {1} is sufficient to make s a complete Poset.

Q74. (D)Exp(marks per question) = 0.25*1 + 0.75*(-0.25)=0.0625Exp(marks obtained per student) = 150*0.0625 = 9.375 Exp(marks obtained by 1000 student) =9.375*1000=9375

Q75. (C)let X colors will be needed..then X self pairs of letters will have these X colors and remaining letters will have C(X,2) colors..such that X + C(X,2)>=26 pair of lettersThe minimum number of colors which is sufficient to satisfy this inequality is 7.

Q76. Opt(D)

Q77. Opt(C)Q78. (A)

Page 15: file · Web viewOpt(C) Opt(D) (a) False, Call swap(x, y) does not swap the value of (x, y), because it’s call by value and in call by value a and b does not share common

CS-2004

Suppose the bit Pattern is 1101 then 1 bit differ pattern are: {0101, 1001, 1111, and 1100} = 4 casesSo total favorable cases corresponding to bit pattern 1101 = 24 * 4.

Q79. (D) Total possible edges = C(n,2) = n(n-1)/2so number of graphs possible with n(n-3)/2 edges are=

= C( n(n-1)/2 , n(n-3)/2) + C( n(n-1)/2 , n(n-3)/2 +1) + C( n(n-1)/2 , n(n-3)/2 + 2) +….. + C( n(n-1)/2 , n(n-1)/2 -2)+ C( n(n-1)/2 , n(n-1)/2 -1 ) + C( n(n-1)/2 , n(n-1)/2)……….(1)

Note: since C(n,r) = C(n,n-r)Hence C( n(n-1)/2 , n(n-3)/2) = C( n(n-1)/2 , n(n-1)/2 -n(n-3)/2) C( n(n-1)/2 , n(n-3)/2) = C( n(n-1)/2 ,n) …………………(2)similarly C( n(n-1)/2 , n(n-3)/2 + 1) =C(n(n-1)/2 , n-1)And also C( n(n-1)/2 , n(n-1)/2) = C( n(n-1)/2 , 0) =1

Thus we can rewrite the expression (1) as follows:= C(n(n-1)/2 , n) + C(n(n-1)/2 , n-1) + C(n(n-1)/2 , n-2) + …… C(n(n-1)/2 , 2) + C(n(n-1)/2 , 1) + C(n(n-1)/2 , 0)or

= C(n(n-1)/2 , 0) + C(n(n-1)/2 , 1) + C(n(n-1)/2 , 2) + …… C(n(n-1)/2 ,n- 2) + C(n(n-1)/2 , n-1) + C(n(n-1)/2 , n)

or

= SUM { C ( n(n-1)/2 , k )} k=0 to nHence option (d) is correct.

Page 16: file · Web viewOpt(C) Opt(D) (a) False, Call swap(x, y) does not swap the value of (x, y), because it’s call by value and in call by value a and b does not share common

CS-2004

Q80. (D)

Q81. Opt(B)

(a) False, G1U G2 has a cut vertex.(b) True(C) False, Because G1U G2 does not have cut-edge.(D) False, G1 is 3 colorable, G2 is 2 colorable but G1 U G2 is also 3 colorable.

Q82. Opt(C)Loop’s run for n- time so complexity of loop run is (n) and for function (m)So hole complexity =(n) + (m) i.e. (n)

Q83. Opt(D)T(n) = 2T(n-1) + 1Solve the recursion using Iterative method, you will get the Complexity = (2n)

Page 17: file · Web viewOpt(C) Opt(D) (a) False, Call swap(x, y) does not swap the value of (x, y), because it’s call by value and in call by value a and b does not share common

CS-2004

Q84. Opt(A) T(1) = 1,T(n) = 2T(n-1) + n n >= 2Check though option elimination method, Put n= 2 in recursion relation.T(n) = 2 T(2-1) + 2

2 T(1) + 22*1 + 2 = 4

(a) 4, True (b) 2, False (c) 6, False (d) 2, False

Q85. Opt(A)The program has linear worst case complexity hence complexity is (n);

Q86. Opt(A)Number of 1’s is Divisible of 3 and number of 0’s is divisible of 2.

Q87. Opt(B)We can design the PDA for that given language hence it is CFG but not Regular because Number of c’s is the sum of number of a’s and b’s , so here counting is involve and DFA does not count, it is memory less Automata.

Q88. Opt(C)Q89. Opt(C)

L1: Set of strings which can be enumerated by a TM…thus there can be strings with infinite length too…but possible to be enumerated effectively.L2 : {W1#W2 ,W1#W3,….W1#W_infinity……….W2#W3,,,,,,W2#W_infinity…}It means there is no TM which can enumerate this kind of set of strings.

Hence L2 is the reduced form (i.e. enhanced version) of L1,,which means if L2 is solvable then L1 is definitely solvable..Thus only S2 is true.

Q90. Opt(D)