UGC NET · Computer Science

Data Structures Previous Year Questions (page 2)

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.

  • 57 questions
  • Official answer key
  • Free

Other Computer Science topics

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?
  1. AEvery minimum spanning tree of G must contain Eₘᵢₙ
  2. BIf Eₘₐₓ is in minimum spanning tree, then its removal must disconnect G.
  3. CNo minimum spanning tree contains Eₘₐₓ
  4. 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++?
  1. AUnary Operator
  2. BLogical not
  3. CArray element access
  4. 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++):
  1. A*(ptrdata++)
  2. B(*ptrdata)++
  3. C*(ptrdata)++
  4. 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?
  1. AIndexed addressing mode
  2. BBase Register addressing mode
  3. CRelative address mode
  4. 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?
  1. Ae = i + n
  2. Be = i + 2n
  3. Ce = 2i + n
  4. 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?
  1. AO(b + m)
  2. BO(bm)
  3. CO(bᵐ)
  4. 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 :
  1. Ause dynamic scope rules
  2. Bsupport dynamic data structures
  3. Csupport recursion
  4. 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.