GATE CSE 2025 Set 2 question paper with solutions
All 65 questions of the GATE 2025 Set 2 Computer Science and Information Technology paper, in order, with the official answer key from IIT Roorkee.
Download the solved paper (PDF, 2.5 MB)- questions · 100 marks
- 65questions · 100 marks
- official answer key
- IIT Roorkeeofficial answer key
- question types
- 32 MCQ · 18 MSQ · 15 NATquestion types
GATE CSE 2025 Set 2 answer key
| Question | Type | Marks | Answer |
|---|---|---|---|
| Q.1 | MCQ | 1 | C |
| Q.2 | MCQ | 1 | C |
| Q.3 | MCQ | 1 | A |
| Q.4 | MCQ | 1 | A |
| Q.5 | MCQ | 1 | B |
| Q.6 | MCQ | 2 | B |
| Q.7 | MCQ | 2 | B |
| Q.8 | MCQ | 2 | A |
| Q.9 | MCQ | 2 | D |
| Q.10 | MCQ | 2 | C |
| Q.11 | MCQ | 1 | C |
| Q.12 | MCQ | 1 | A |
| Q.13 | MCQ | 1 | B |
| Q.14 | MCQ | 1 | A |
| Q.15 | MCQ | 1 | A |
| Q.16 | MCQ | 1 | B |
| Q.17 | MCQ | 1 | A |
| Q.18 | MCQ | 1 | D |
| Q.19 | MCQ | 1 | D |
| Q.20 | MCQ | 1 | A |
| Q.21 | MCQ | 1 | C |
| Q.22 | MCQ | 1 | C |
| Q.23 | MCQ | 1 | D |
| Q.24 | MCQ | 1 | A |
| Q.25 | MCQ | 1 | D |
| Q.26 | MCQ | 1 | D |
| Q.27 | MSQ | 1 | B, C |
| Q.28 | MSQ | 1 | D |
| Q.29 | MSQ | 1 | B, C, D |
| Q.30 | MSQ | 1 | B, C |
| Q.31 | MSQ | 1 | A, B, C |
| Q.32 | NAT | 1 | 13 |
| Q.33 | NAT | 1 | 21 |
| Q.34 | NAT | 1 | 250 |
| Q.35 | NAT | 1 | 4 |
| Q.36 | MCQ | 2 | A |
| Q.37 | MCQ | 2 | C |
| Q.38 | MCQ | 2 | A |
| Q.39 | MCQ | 2 | A |
| Q.40 | MCQ | 2 | C |
| Q.41 | MCQ | 2 | D |
| Q.42 | MSQ | 2 | B, C |
| Q.43 | MSQ | 2 | A, D |
| Q.44 | MSQ | 2 | A, B, C |
| Q.45 | MSQ | 2 | A |
| Q.46 | MSQ | 2 | C, D |
| Q.47 | MSQ | 2 | D |
| Q.48 | MSQ | 2 | C, D |
| Q.49 | MSQ | 2 | A, B, C |
| Q.50 | MSQ | 2 | B, C, D |
| Q.51 | MSQ | 2 | C, D |
| Q.52 | MSQ | 2 | A, C |
| Q.53 | MSQ | 2 | B |
| Q.54 | MSQ | 2 | A, C, D |
| Q.55 | NAT | 2 | 4.0 |
| Q.56 | NAT | 2 | 260.20 to 261.20 |
| Q.57 | NAT | 2 | 33 |
| Q.58 | NAT | 2 | 11 |
| Q.59 | NAT | 2 | 6 |
| Q.60 | NAT | 2 | 6 |
| Q.61 | NAT | 2 | 3.0 |
| Q.62 | NAT | 2 | 111 |
| Q.63 | NAT | 2 | 46 |
| Q.64 | NAT | 2 | 0.5 |
| Q.65 | NAT | 2 | 0.70 to 0.80 |
General Aptitude Q.1 to Q.10
- Q.1MCQ · 1 mark
Official answer: C
- Q.2MCQ · 1 mark
Official answer: C
- Q.3MCQ · 1 mark
Official answer: A
- Q.4MCQ · 1 mark
Official answer: A
- Q.5MCQ · 1 mark
Official answer: B
- Q.6MCQ · 2 marks
Official answer: B
- Q.7MCQ · 2 marks
Official answer: B
- Q.8MCQ · 2 marks
Official answer: A
- Q.9MCQ · 2 marks
Official answer: D
- Q.10MCQ · 2 marks
Official answer: C
Computer Science and Information Technology Q.11 to Q.65
- Q.11MCQ · 1 mark
If , then which ONE of the following is ?
- (A)
- (B)
- (C)
- (D)
Official answer: C
- (A)
- Q.12MCQ · 1 mark
The value of such that , satisfying the equation is
- (A)
- (B)
- (C)
- (D)
Official answer: A
- (A)
- Q.13MCQ · 1 mark
Consider a binary tree in which every node has either zero or two children. Let be the number of nodes in .
Which ONE of the following is the number of nodes in that have exactly two children?
- (A)
- (B)
- (C)
- (D)
Official answer: B
- (A)
- Q.14MCQ · 1 mark
Let , , and be non-singular matrices of order 3 satisfying the equations , and . Which ONE of the following is the value of the determinant of ?
- (A)
0
- (B)
1
- (C)
2
- (D)
3
Official answer: A
- (A)
- Q.15MCQ · 1 mark
Let be an arbitrary predicate over the domain of natural numbers.
Which ONE of the following statements is TRUE?
- (A)
- (B)
- (C)
- (D)
Official answer: A
- (A)
- Q.16MCQ · 1 mark
Consider the following statements:
(i) Address Resolution Protocol (ARP) provides a mapping from an IP address to the corresponding hardware (link-layer) address.
(ii) A single TCP segment from a sender S to a receiver R cannot carry both data from S to R and acknowledgement for a segment from R to S.Which ONE of the following is CORRECT?
- (A)
Both (i) and (ii) are TRUE
- (B)
(i) is TRUE and (ii) is FALSE
- (C)
(i) is FALSE and (ii) is TRUE
- (D)
Both (i) and (ii) are FALSE
Official answer: B
- (A)
- Q.17MCQ · 1 mark
Consider the routing protocols given in List I and the names given in List II:
For matching of items in List I with those in List II, which ONE of the following options is CORRECT?
- (A)
(i) – (a) and (ii) – (b)
- (B)
(i) – (a) and (ii) – (a)
- (C)
(i) – (b) and (ii) – (a)
- (D)
(i) – (b) and (ii) – (b)
Official answer: A
- (A)
- Q.18MCQ · 1 mark
A machine receives an IPv4 datagram. The protocol field of the IPv4 header has the protocol number of a protocol X.
Which ONE of the following is NOT a possible candidate for X?
- (A)
Internet Control Message Protocol (ICMP)
- (B)
Internet Group Management Protocol (IGMP)
- (C)
Open Shortest Path First (OSPF)
- (D)
Routing Information Protocol (RIP)
Official answer: D
- (A)
- Q.19MCQ · 1 mark
Consider the following C program:
#include <stdio.h> void stringcopy(char *, char *); int main(){ char a[30] = "@#Hello World!"; stringcopy(a, a + 2); printf("%s\n", a); return 0; } void stringcopy(char *s, char *t) { while(*t) *s++ = *t++; }Which ONE of the following will be the output of the program?
- (A)
@#Hello World!
- (B)
Hello World!
- (C)
ello World!
- (D)
Hello World!d!
Official answer: D
- (A)
- Q.20MCQ · 1 mark
Consider an unordered list of distinct integers.
What is the minimum number of element comparisons required to find an integer in the list that is NOT the largest in the list?
- (A)
1
- (B)
- (C)
- (D)
Official answer: A
- (A)
- Q.21MCQ · 1 mark
Consider the following statements about the use of backpatching in a compiler for intermediate code generation:
(I) Backpatching can be used to generate code for Boolean expression in one pass.
(II) Backpatching can be used to generate code for flow-of-control statements in one pass.
Which ONE of the following options is CORRECT?- (A)
Only (I) is correct.
- (B)
Only (II) is correct.
- (C)
Both (I) and (II) are correct.
- (D)
Neither (I) nor (II) is correct.
Official answer: C
- (A)
- Q.22MCQ · 1 mark
Given the following syntax directed translation rules:
Rule 1: { ; ; ; }
Rule 2: { ; ; }
Rule 3: { ; }Which ONE is the CORRECT option among the following?
- (A)
Rule 1 is S-attributed and L-attributed; Rule 2 is S-attributed and not L-attributed; Rule 3 is neither S-attributed nor L-attributed
- (B)
Rule 1 is neither S-attributed nor L-attributed; Rule 2 is S-attributed and L-attributed; Rule 3 is S-attributed and L-attributed
- (C)
Rule 1 is neither S-attributed nor L-attributed; Rule 2 is not S-attributed and is L-attributed; Rule 3 is S-attributed and L-attributed
- (D)
Rule 1 is S-attributed and not L-attributed; Rule 2 is not S-attributed and is L-attributed; Rule 3 is S-attributed and L-attributed
Official answer: C
- (A)
- Q.23MCQ · 1 mark
Consider a network that uses Ethernet and IPv4. Assume that IPv4 headers do not use any options field. Each Ethernet frame can carry a maximum of 1500 bytes in its data field. A UDP segment is transmitted. The payload (data) in the UDP segment is 7488 bytes.
Which ONE of the following choices has the CORRECT total number of fragments transmitted and the size of the last fragment including IPv4 header?
- (A)
5 fragments, 1488 bytes
- (B)
6 fragments, 88 bytes
- (C)
6 fragments, 108 bytes
- (D)
6 fragments, 116 bytes
Official answer: D
- (A)
- Q.24MCQ · 1 mark
Which ONE of the following languages is accepted by a deterministic pushdown automaton?
- (A)
Any regular language.
- (B)
Any context-free language.
- (C)
Any language accepted by a non-deterministic pushdown automaton.
- (D)
Any decidable language.
Official answer: A
- (A)
- Q.25MCQ · 1 mark
Let be Context Free Grammars (CFGs) and be a regular expression. For a grammar , let denote the language generated by .
Which ONE among the following questions is decidable?
- (A)
Is ?
- (B)
Is ?
- (C)
Is ?
- (D)
Is ?
Official answer: D
- (A)
- Q.26MCQ · 1 mark
Processes arrive in that order at times 0, 1, 2, and 8 milliseconds respectively, and have execution times of 10, 13, 6, and 9 milliseconds respectively. Shortest Remaining Time First (SRTF) algorithm is used as the CPU scheduling policy. Ignore context switching times.
Which ONE of the following correctly gives the average turnaround time of the four processes in milliseconds?
- (A)
22
- (B)
15
- (C)
37
- (D)
19
Official answer: D
- (A)
- Q.27MSQ · 1 mark
An audit of a banking transactions system has found that on an earlier occasion, two joint holders of account attempted simultaneous transfers of Rs. 10000 each from account to account . Both transactions read the same value, Rs. 11000, as the initial balance in and were allowed to go through. was credited Rs. 10000 twice. was debited only once and ended up with a balance of Rs. 1000.
Which of the following properties is/are certain to have been violated by the system?
- (A)
Atomicity
- (B)
Consistency
- (C)
Isolation
- (D)
Durability
Official answer: B, C
- (A)
- Q.28MSQ · 1 mark
Which of the following is/are part of an Instruction Set Architecture of a processor?
- (A)
The size of the cache memory
- (B)
The clock frequency of the processor
- (C)
The number of cache memory levels
- (D)
The total number of registers
Official answer: D
- (A)
- Q.29MSQ · 1 mark
Which of the following statements regarding Breadth First Search (BFS) and Depth First Search (DFS) on an undirected simple graph is/are TRUE?
- (A)
A DFS tree of is a Shortest Path tree of .
- (B)
Every non-tree edge of with respect to a DFS tree is a forward/back edge.
- (C)
If is a non-tree edge of with respect to a BFS tree, then the distances from the source vertex to and in the BFS tree are within of each other.
- (D)
Both BFS and DFS can be used to find the connected components of .
Official answer: B, C, D
- (A)
- Q.30MSQ · 1 mark
Consider the two lists List I and List II given below:
For matching of items in List I with those in List II, which of the following option(s) is/are CORRECT?
- (A)
(i) – (a), (ii) – (b), and (iii) – (c)
- (B)
(i) – (b), (ii) – (a), and (iii) – (c)
- (C)
(i) – (b), (ii) – (c), and (iii) – (a)
- (D)
(i) – (a), (ii) – (c), and (iii) – (b)
Official answer: B, C
- (A)
- Q.31MSQ · 1 mark
Consider the following logic circuit diagram.
Which is/are the CORRECT option(s) for the output function ?
Tap to open full size- (A)
- (B)
- (C)
- (D)
Official answer: A, B, C
- (A)
- Q.32NAT · 1 mark
The following two signed 2's complement numbers (multiplicand M and multiplier Q) are being multiplied using Booth's algorithm:
M: 1100 1101 1110 1101 and Q: 1010 0100 1010 1010
The total number of addition and subtraction operations to be performed is ___________. (Answer in integer)
Official answer: 13
- Q.33NAT · 1 mark
int x=126,y=105; do { if(x>y) x=x-y; else y=y-x; } while(x!=y); printf("%d",x);The output of the given C code segment is ________. (Answer in integer)
Official answer: 21
- Q.34NAT · 1 mark
In a 4-bit ripple counter, if the period of the waveform at the last flip-flop is 64 microseconds, then the frequency of the ripple counter in kHz is ________. (Answer in integer)
Official answer: 250
- Q.35NAT · 1 mark
Suppose the values are inserted in that order into an initially empty binary search tree. Let be the resulting binary search tree. The number of edges in the path from the node containing 19 to the root node of is ___________. (Answer in integer)
Official answer: 4
- Q.36MCQ · 2 marks
Suppose we are transmitting frames between two nodes using Stop-and-Wait protocol. The frame size is 3000 bits. The transmission rate of the channel is 2000 bps (bits/second) and the propagation delay between the two nodes is 100 milliseconds. Assume that the processing times at the source and destination are negligible. Also, assume that the size of the acknowledgement packet is negligible. Which ONE of the following most accurately gives the channel utilization for the above scenario in percentage?
- (A)
88.23
- (B)
93.75
- (C)
85.44
- (D)
66.67
Official answer: A
- (A)
- Q.37MCQ · 2 marks
Let be an edge-weighted undirected graph with positive edge weights. Suppose a positive constant is added to the weight of every edge.
Which ONE of the following statements is TRUE about the minimum spanning trees (MSTs) and shortest paths (SPs) in before and after the edge weight update?
- (A)
Every MST remains an MST, and every SP remains an SP.
- (B)
MSTs need not remain MSTs, and every SP remains an SP.
- (C)
Every MST remains an MST, and SPs need not remain SPs.
- (D)
MSTs need not remain MSTs, and SPs need not remain SPs.
Official answer: C
- (A)
- Q.38MCQ · 2 marks
A meld operation on two instances of a data structure combines them into one single instance of the same data structure. Consider the following data structures:
P: Unsorted doubly linked list with pointers to the head node and tail node of the list.
Q: Min-heap implemented using an array.
R: Binary Search Tree.
Which ONE of the following options gives the worst-case time complexities for meld operation on instances of size of these data structures?
- (A)
P: , Q: , R:
- (B)
P: , Q: , R:
- (C)
P: , Q: , R:
- (D)
P: , Q: , R:
Official answer: A
- (A)
- Q.39MCQ · 2 marks
For a direct-mapped cache, 4 bits are used for the tag field and 12 bits are used to index into a cache block. The size of each cache block is one byte. Assume that there is no other information stored for each cache block.
Which ONE of the following is the CORRECT option for the sizes of the main memory and the cache memory in this system (byte addressable), respectively?
- (A)
64 KB and 4 KB
- (B)
128 KB and 16 KB
- (C)
64 KB and 8 KB
- (D)
128 KB and 6 KB
Official answer: A
- (A)
- Q.40MCQ · 2 marks
Given a Context-Free Grammar as follows:
Which ONE of the following statements is TRUE?
- (A)
is neither LALR(1) nor SLR(1)
- (B)
is CLR(1), not LALR(1)
- (C)
is LALR(1), not SLR(1)
- (D)
is LALR(1), also SLR(1)
Official answer: C
- (A)
- Q.41MCQ · 2 marks
An array of length with distinct elements is said to be bitonic if there is an index such that is sorted in the non-decreasing order and is sorted in the non-increasing order.
Which ONE of the following represents the best possible asymptotic bound for the worst-case number of comparisons by an algorithm that searches for an element in a bitonic array ?
- (A)
- (B)
- (C)
- (D)
Official answer: D
- (A)
- Q.42MSQ · 2 marks
Let be the set of all functions from to . Define the binary relation on as follows:
if and only if , where .
Which of the following statement(s) is/are TRUE?
- (A)
is a symmetric relation
- (B)
is a partial order
- (C)
is a lattice
- (D)
is an equivalence relation
Official answer: B, C
- (A)
- Q.43MSQ · 2 marks
Given the following Karnaugh Map for a Boolean function (rows , columns , both in Gray-code order 00, 01, 11, 10):
Which one or more of the following Boolean expression(s) represent(s) ?
Tap to open full size- (A)
- (B)
- (C)
- (D)
Official answer: A, D
- (A)
- Q.44MSQ · 2 marks
Consider a system of linear equations where and . Suppose has an LU decomposition, , where and . Which of the following statement(s) is/are TRUE?
- (A)
The system can be solved by first solving and then .
- (B)
If is invertible, then both and are invertible.
- (C)
If is singular, then at least one of the diagonal elements of is zero.
- (D)
If is symmetric, then both and are symmetric.
Official answer: A, B, C
- (A)
- Q.45MSQ · 2 marks
Consider a stack data structure into which we can PUSH and POP records. Assume that each record pushed in the stack has a positive integer key and that all keys are distinct.
We wish to augment the stack data structure with an time MIN operation that returns a pointer to the record with smallest key present in the stack
1) without deleting the corresponding record, and
2) without increasing the complexities of the standard stack operations.Which one or more of the following approaches can achieve it?
- (A)
Keep with every record in the stack, a pointer to the record with the smallest key below it.
- (B)
Keep a pointer to the record with the smallest key in the stack.
- (C)
Keep an auxiliary array in which the key values of the records in the stack are maintained in sorted order.
- (D)
Keep a Min-Heap in which the key values of the records in the stack are maintained.
Official answer: A
- (A)
- Q.46MSQ · 2 marks
Consider the following relational schema along with all the functional dependencies that hold on them.
:
:
Which of the following statement(s) is/are TRUE?
- (A)
R1 is in 3NF
- (B)
R2 is in 3NF
- (C)
R1 is NOT in 3NF
- (D)
R2 is NOT in 3NF
Official answer: C, D
- (A)
- Q.47MSQ · 2 marks
Consider a demand paging system with three frames, and the following page reference string: 1 2 3 4 5 4 1 6 4 5 1 3 2. The contents of the frames are as follows initially and after each reference (from left to right):
The *-marked references cause page replacements.
Which one or more of the following could be the page replacement policy/policies in use?
Tap to open full size- (A)
Least Recently Used page replacement policy
- (B)
Least Frequently Used page replacement policy
- (C)
Most Frequently Used page replacement policy
- (D)
Optimal page replacement policy
Official answer: D
- (A)
- Q.48MSQ · 2 marks
consists of all active processes in an operating system. consists of single instances of distinct types of resources in the system.
The resource allocation graph has the following assignment and claim edges.
Assignment edges: (the assignment edge means resource is assigned to process , and so on for others)
Claim edges: (the claim edge means process is waiting for resource , and so on for others)
Which of the following statement(s) is/are CORRECT?
- (A)
Aborting makes the system deadlock free.
- (B)
Aborting makes the system deadlock free.
- (C)
Aborting makes the system deadlock free.
- (D)
Aborting and makes the system deadlock free.
Official answer: C, D
- (A)
- Q.49MSQ · 2 marks
Three floating point numbers , and are stored in three registers , , and , respectively in IEEE 754 single precision format as given below in hexadecimal:
=
0xC1100000, =0x40C00000, and =0x41400000Which of the following option(s) is/are CORRECT?
- (A)
- (B)
- (C)
- (D)
Official answer: A, B, C
- (A)
- Q.50MSQ · 2 marks
Which of the following Boolean algebraic equation(s) is/are CORRECT?
- (A)
- (B)
- (C)
- (D)
Official answer: B, C, D
- (A)
- Q.51MSQ · 2 marks
Consider two grammars and with the production rules given below:
: ;
: ; ;
where are the terminals. Which of the following option(s) is/are CORRECT?
- (A)
is not and is .
- (B)
is and is not .
- (C)
and are not .
- (D)
and are ambiguous.
Official answer: C, D
- (A)
- Q.52MSQ · 2 marks
Let . For and , let denote the number of occurrences of in .
Which one or more of the following option(s) define(s) regular language(s)?
- (A)
- (B)
- (C)
- (D)
Official answer: A, C
- (A)
- Q.53MSQ · 2 marks
Consider the database transactions T1 and T2, and data items X and Y. Which of the schedule(s) is/are conflict serializable?
Transaction T1: R1(X), W1(Y), R1(X), W1(X), COMMIT(T1)
Transaction T2: W2(X), W2(Y), COMMIT(T2)
Tap to open full size- (A)
R1(X), W2(X), W1(Y), W2(Y), R1(X), W1(X), COMMIT(T2), COMMIT(T1)
- (B)
W2(X), R1(X), W2(Y), W1(Y), R1(X), COMMIT(T2), W1(X), COMMIT(T1)
- (C)
R1(X), W1(Y), W2(X), W2(Y), R1(X), W1(X), COMMIT(T1), COMMIT(T2)
- (D)
W2(X), R1(X), W1(Y), W2(Y), R1(X), COMMIT(T2), W1(X), COMMIT(T1)
Official answer: B
- (A)
- Q.54MSQ · 2 marks
Consider the following relational schema:
Students (rollno: integer, name: string, age: integer, cgpa: real)
Courses (courseno: integer, cname: string, credits: integer)
Enrolled (rollno: integer, courseno: integer, grade: string)(Primary keys underlined: rollno in Students; courseno in Courses; (rollno, courseno) in Enrolled.)
Which of the following options is/are correct SQL query/queries to retrieve the names of the students enrolled in course number (i.e., courseno) 1470?
- (A)
SELECT S.name FROM Students S WHERE EXISTS (SELECT * FROM Enrolled E WHERE E.courseno = 1470 AND E.rollno = S.rollno); - (B)
SELECT S.name FROM Students S WHERE SIZEOF (SELECT * FROM Enrolled E WHERE E.courseno = 1470 AND E.rollno = S.rollno) > 0; - (C)
SELECT S.name FROM Students S WHERE 0 < (SELECT COUNT(*) FROM Enrolled E WHERE E.courseno = 1470 AND E.rollno = S.rollno); - (D)
SELECT S.name FROM Students S NATURAL JOIN Enrolled E WHERE E.courseno = 1470;
Official answer: A, C, D
- (A)
- Q.55NAT · 2 marks
Given a computing system with two levels of cache (L1 and L2) and a main memory. The first level (L1) cache access time is 1 nanosecond (ns) and the "hit rate" for L1 cache is 90% while the processor is accessing the data from L1 cache. Whereas, for the second level (L2) cache, the "hit rate" is 80% and the "miss penalty" for transferring data from L2 cache to L1 cache is 10 ns. The "miss penalty" for the data to be transferred from main memory to L2 cache is 100 ns.
Then the average memory access time in this system in nanoseconds is __________ . (rounded off to one decimal place)
Official answer: 4.0
- Q.56NAT · 2 marks
A 5-stage instruction pipeline has stage delays of 180, 250, 150, 170, and 250, respectively, in nanoseconds. The delay of an inter-stage latch is 10 nanoseconds. Assume that there are no pipeline stalls due to branches and other hazards. The time taken to process 1000 instructions in microseconds is __________ . (rounded off to two decimal places)
Official answer: 260.20 to 261.20
- Q.57NAT · 2 marks
In a B-tree where each node can hold at most four key values, a root to leaf path consists of the following nodes:
The *-marked keys signify that these are data entries in a leaf.
Assume that a pointer between keys and points to a subtree containing keys in , and that when a leaf is created, the smallest key in it is copied up into its parent.
A record with key value 23 is inserted into the B-tree.
The smallest key value in the parent of the leaf that contains 25* is ________. (Answer in integer)
Official answer: 33
- Q.58NAT · 2 marks
A computer system supports a logical address space of bytes. It uses two-level hierarchical paging with a page size of 4096 bytes. A logical address is divided into a -bit index to the outer page table, an offset within the page of the inner page table, and an offset within the desired page. Each entry of the inner page table uses eight bytes. All the pages in the system have the same size.
The value of is ___________ . (Answer in integer)
Official answer: 11
- Q.59NAT · 2 marks
Consider the following algorithm someAlgo that takes an undirected graph G as input.
someAlgo(G) 1. Let v be any vertex in G. Run BFS on G starting at v. Let u be a vertex in G at maximum distance from v as given by the BFS. 2. Run BFS on G again with u as the starting vertex. Let z be the vertex at maximum distance from u as given by the BFS. 3. Output the distance between u and z in G.The output of someAlgo() for the tree shown in the given figure is ___________. (Answer in integer)
Tap to open full sizeOfficial answer: 6
- Q.60NAT · 2 marks
Let . For , let be the product of symbols in modulo 7. We take , where is the null string.
For example, .
Define .
The number of states in a minimum state DFA for is ___________. (Answer in integer)
Official answer: 6
- Q.61NAT · 2 marks
An application executes number of instructions in 6.3 seconds. There are four types of instructions, the details of which are given in the table. The duration of a clock cycle in nanoseconds is __________. (rounded off to one decimal place)
Instruction type Clock cycles required per instruction (CPI) Number of instructions executed Branch 2 Load 5 Store 4 Arithmetic 3
Tap to open full sizeOfficial answer: 3.0
- Q.62NAT · 2 marks
Consider the following C program:
#include <stdio.h> int main(){ int a; int arr[5] = {30,50,10}; int *ptr; ptr = &arr[0] + 1; a = *ptr; (*ptr)++; ptr++; printf("%d", a + (*ptr) + arr[1]); return 0; }The output of the above program is __________. (Answer in integer)
Official answer: 111
- Q.63NAT · 2 marks
Consider the following C program:
#include <stdio.h> int g(int n) { return (n+10); } int f(int n) { return g(n*2); } int main() { int sum, n; sum=0; for (n=1; n<3; n++) sum += g(f(n)); printf ("%d", sum); return 0; }The output of the given C program is ________. (Answer in integer)
Official answer: 46
- Q.64NAT · 2 marks
A quadratic polynomial over complex numbers is said to be square invariant if . Suppose from the set of all square invariant quadratic polynomials we choose one at random.
The probability that the roots of the chosen polynomial are equal is ______. (rounded off to one decimal place)
Official answer: 0.5
- Q.65NAT · 2 marks
The unit interval is divided at a point chosen uniformly distributed over in into two disjoint subintervals.
The expected length of the subinterval that contains is ___________. (rounded off to two decimal places)
Official answer: 0.70 to 0.80









