GATE-CS-2015 (Mock Test) Read Discuss Courses GATE-CS-2015 (Mock Test) Please wait while the activity loads. If this activity does not load, try refreshing your browser. Also, this page requires javascript. Please visit using a browser with javascript enabled. If loading fails, click here to try again Question 1The output of following C program is #include <stdio.h> char str1[100]; char *fun(char str[]) { static int i = 0; if (*str) { fun(str+1); str1[i] = *str; i++; } return str1; } int main() { char str[] = "GATE CS 2015 Mock Test"; printf("%s", fun(str)); return 0; }GATE CS 2015 Mock TesttseT kcoM 5102 SC ETAG Nothing is printed on screenSegmentation FaultGATE-CS-2015 (Mock Test) C String Discuss itQuestion 1-Explanation: The function basically reverses the given string.Question 2Consider the following two problems of graph. 1) Given a graph, find if the graph has a cycle that visits every vertex exactly once except the first visited vertex which must be visited again to complete the cycle. 2) Given a graph, find if the graph has a cycle that visits every edge exactly once. Which of the following is true about above two problems. Problem 1 belongs NP Complete set and 2 belongs to PProblem 1 belongs to P set and 2 belongs to NP Complete setBoth problems belong to P setBoth problems belong to NP complete setGATE-CS-2015 (Mock Test) Top MCQs on NP Complete Complexity with Answers Top 50 Algorithms MCQs with Answers Discuss itQuestion 2-Explanation: Problem 1 is Hamiltonian Cycle problem which is a famous NP Complete problem. Problem 2 is Euler Circuit problem which is solvable in Polynomial time.Question 3Routers forward a packet using forwarding table entries. The network address of incoming packet may match multiple entries. How routers resolve this? Forward it the router whose entry matches with the longest prefix of incoming packetForward the packet to all routers whose network addresses match.Discard the packet.Forward it the router whose entry matches with the longest suffix of incoming packetGATE-CS-2015 (Mock Test) Network Layer Discuss itQuestion 3-Explanation: The network addresses of different entries may overlap in forwarding table. Routers forward the incoming packet to the router which hash the longest prefix matching with the incoming packet.Question 4Consider the following routing table of a router. Consider the following three IP addresses. How are the packets with above three destination IP addresses are forwarded? 1->D, 2->B, 3->B1->D, 2->B, 3->D1->B, 2->D, 3->D1->D, 2->D, 3->DGATE-CS-2015 (Mock Test) Network Layer Discuss itQuestion 4-Explanation: Refer following source of this question for explanation. https://www.youtube.com/watch?v=PSC5omE3pX8&list=PLkHsKoi6eZnzJl1qTzmvBwTxrSJW4D2Jj&index=32Question 5 Which of the following is NOT true about User Datagram Protocol in transport layer? Works well in unidirectional communication, suitable for broadcast information. It does three way handshake before sending datagrams It provides datagrams, suitable for modeling other protocols such as in IP tunneling or Remote Procedure Call and the Network File System The lack of retransmission delays makes it suitable for real-time applications GATE-CS-2015 (Mock Test) Transport Layer Discuss itQuestion 5-Explanation: // UDP is a connectioness protocol, so it doesn't establish connection. Three way handshake is done by transport layer.A- UDP is a stateless protocol thus, useful in servers which answer small queries of large number of clients as it doesn’t need to store the state for each client. Thus, UDP is suitable for broadcast and unidirectional communication.B- Three way handshake is performed by TCP before establishing the connection in which it first sends SYN packet then SYN-ACK is received,then ACK packet is sent. UDP is a connectionless protocol and thus,doesn’t to perform 3-way handshake.C- IP tunneling is a communication channel between two different kind of networks .It is used to connect islands of IPv6 across the IPV internet by encapsulating the packets in the frame format of IPV4 . Remote procedure call is when a program causes a subroutine to run in another address space .This address space can be on server.It is a request response protocol and thus,UDP is suitable for it. Datagrams are also useful as UDP is a packet stream protocol.D- TCP retransmits the erroneous packets from source to destination while UDP discards them. Question 6Select the correct asymptotic complexity of an algorithm with runtime T(n, n) where T(x, c) = Θ(x) for c <= 2, T(c, y) = Θ(y) for c <= 2, and T(x, y) = Θ(x+y) + T(x/2, y/2) Θ(nLogn)Θ(n2)Θ(n)Θ(n2Logn)GATE-CS-2015 (Mock Test) Top MCQs on Complexity Analysis using Recurrence Relations with Answers Discuss itQuestion 6-Explanation: The recurrence is T(x, y) = Θ(x+y) + T(x/2, y/2) It can be written as below. T(x, y) = Θ(x+y) + Θ((x+y)/2) + Θ((x+y)/4) + Θ((x+y)/8) ..... T(x, y) = Θ((x+y) + (x+y)/2 + (x+y)/4 + (x+y)/8 ..... ) The above expression forms a geometric series with ratio as 2 and starting element as (x+y)/2 T(x, y) is upper bounded by Θ(x+y) as sum of infinite series is 2(x+y). It is lower bounded by (x+y) Source: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/assignments/MIT6_006F11_ps1.pdf Question 7The increasing order of following functions in terms of asymptotic complexity is: f1(n); f4(n); f2(n); f3(n)f1(n); f2(n); f3(n); f4(n); f2(n); f1(n); f4(n); f3(n)f1(n); f2(n); f4(n); f3(n)GATE-CS-2015 (Mock Test) Top MCQs on Complexity Analysis of Algorithms with Answers Discuss itQuestion 7-Explanation: Source: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/assignments/MIT6_006F11_ps1.pdfQuestion 8An ISP has a link of 100Mbps which is shared by its subscribers. Considering the fact that all of its subscribers are active 50% of the time and the probabilities of being active are independent, the ISP has promised 25 Mbps to its 6 subscribers. What is the probability that any subscriber gets degraded service (less than promised speed).1/325/161/27/64GATE-CS-2015 (Mock Test) Probability Discuss itQuestion 8-Explanation: The above question is an example of Binomial Experiment. Any user can be either Online(O) or Offline(F) Let be the Random Variable denoting the number of users online. The users get degraded service when or , Question 9 Which of the following changes to typical QuickSort improves its performance on average and are generally done in practice. 1) Randomly picking up to make worst case less likely to occur. 2) Calling insertion sort for small sized arrays to reduce recursive calls. 3) QuickSort is tail recursive, so tail call optimizations can be done. 4) A linear time median searching algorithm is used to pick the median, so that the worst case time reduces to O(nLogn) 1 and 2 2, 3, and 4 1, 2 and 3 2, 3 and 4 GATE-CS-2015 (Mock Test) Top MCQs on Sorting Algorithms with Answers Top MCQs on QuickSort Algorithm with Answers Discuss itQuestion 9-Explanation: The 4th optimization is generally not used, it reduces the worst case time complexity to O(nLogn), but the hidden constants are very high. Question 10Given an array that represents elements of arithmetic progression in order. It is also given that one element is missing in the progression, the worst case time complexity to find the missing element efficiently is:Θ(n)Θ(nLogn)Θ(Logn)Θ(1)GATE-CS-2015 (Mock Test) Top MCQs on Algorithms in DSA with Answers Top 50 Algorithms MCQs with Answers Discuss itQuestion 10-Explanation: We can use Binary Search to find the missing element. See following link for details. http://www.geeksforgeeks.org/find-missing-number-arithmetic-progression/ 12 There are 18 questions to complete. You have completed questions question Your accuracy is Correct Wrong Partial-Credit You have not finished your quiz. If you leave this page, your progress will be lost. Correct Answer You Selected Not Attempted Final Score on Quiz Attempted Questions Correct Attempted Questions Wrong Questions Not Attempted Total Questions on Quiz Question Details Results Date Score Hint Time allowed minutes seconds Time used Answer Choice(s) Selected Question Text Need more practice! Keep trying! Not bad! Good work! Perfect! Last Updated : 02 Dec, 2021