57 Data Structures (Computer Science) questions asked in UGC NET previous year papers, each with the correct answer and explanation. Read them free on UTpaper, or attempt the full papers as timed online tests.
Q51UGC NET Computer Science, November 2017 (Paper II & III, Selected Questions)
Let G be an undirected connected graph with distinct edge weight. Let Eₘₐₓ be the edge with maximum weight and Eₘᵢₙ the edge with minimum weight. Which of the following statements is false?
AEvery minimum spanning tree of G must contain Eₘᵢₙ
BIf Eₘₐₓ is in minimum spanning tree, then its removal must disconnect G.
CNo minimum spanning tree contains Eₘₐₓ
DG has a unique minimum spanning tree
Show answerHide answer
Correct answer: (C) No minimum spanning tree contains Eₘₐₓ
Explanation
With distinct edge weights the MST is unique and always contains Eₘᵢₙ. Eₘₐₓ can be in the MST (when it is a bridge, its removal disconnects G), so the statement "No minimum spanning tree contains Eₘₐₓ" is false.
Q52UGC NET Computer Science, November 2017 (Paper II & III, Selected Questions)
The associativity of which of the following operators is left to right, in C++?
AUnary Operator
BLogical not
CArray element access
DAddress of
Show answerHide answer
Correct answer: (C) Array element access
Explanation
Only array element access ([]) is left-to-right associative among the options listed. All others are unary operators and are right-to-left associative.
Q53UGC NET Computer Science, November 2017 (Paper II & III, Selected Questions)
'ptrdata' is a pointer to a data type. The expression *ptrdata++ is evaluated as (in C++):
A*(ptrdata++)
B(*ptrdata)++
C*(ptrdata)++
DDepends on compiler
Show answerHide answer
Correct answer: (A) *(ptrdata++)
Explanation
Postfix ++ has higher precedence than *, so *ptrdata++ is evaluated as *(ptrdata++): the value at ptrdata is used and then the pointer moves to the next location. (*ptrdata)++ would instead increment the value stored at that location.
Q54UGC NET Computer Science, November 2017 (Paper II & III, Selected Questions)
Which of the following addressing mode is best suited to access elements of an array of contiguous memory locations?
AIndexed addressing mode
BBase Register addressing mode
CRelative address mode
DDisplacement mode
Show answerHide answer
Correct answer: (A) Indexed addressing mode
Explanation
Indexed addressing mode is best suited for accessing an array in contiguous memory location.
Q55UGC NET Computer Science, November 2017 (Paper II & III, Selected Questions)
Consider a full binary tree with n internal nodes, internal path length i, and external path length e. The internal path length of a full binary tree is the sum, taken over all nodes of the tree, of the depth of each node. Similarly, the external path length is the sum, taken over all leaves of the tree, of the depth of each leaf. Which of the following is correct for the full binary tree?
Ae = i + n
Be = i + 2n
Ce = 2i + n
De = 2ⁿ + i
Show answerHide answer
Correct answer: (B) e = i + 2n
Explanation
For a full binary tree with n internal nodes, e = i + 2n. Example: a full binary tree with 7 internal nodes of depth up to 2 has i = 0 + 1×2 + 2×4 = 10 and 8 leaves at depth 3, so e = 24 = 10 + 2×7.
Q56UGC NET Computer Science, November 2017 (Paper II & III, Selected Questions)
If b is the branding factor and m is the maximum depth of the search tree, what is the space complexity of greedy search?
AO(b + m)
BO(bm)
CO(bᵐ)
DO(mᵇ)
Show answerHide answer
Correct answer: (C) O(bᵐ)
Explanation
In the worst case greedy (best-first) search keeps all generated nodes in memory. With branching factor b and maximum depth m, the space complexity is O(bᵐ).
Q57UGC NET Computer Science, November 2017 (Paper II & III, Selected Questions)
Heap allocation is required for languages that :
Ause dynamic scope rules
Bsupport dynamic data structures
Csupport recursion
Dsupport recursion and dynamic data structures
Show answerHide answer
Correct answer: (B) support dynamic data structures
Explanation
Heap allocation is required for languages that support dynamic data structures, whose storage is allocated and freed at run time in an arbitrary order.
How to use these UGC NET Computer Science questions
Every question here was asked in a real UGC NET paper; the paper and shift are shown on the card, and the number opens the question on its own page. Try each one before tapping Show answer, then attempt the full UGC NET papers as timed tests to check your speed under exam conditions.