0

Data Structures

Description: This test consists of multiple choice questions related to data structure concept for computer science students and gate aspirants.
Number of Questions: 15
Created by:
Tags: Data strucuture cs gate Data Structure
Attempted 0/15 Correct 0 Score 0

What is the mean of 'MAX' term in the syntax below? typedef struct stack{ int data[MAX]; int top;}stack;

  1. It defines the maximum value of the elements in the stack.

  2. It defines the maximum size of the stack.

  3. It defines the number of integer values.

  4. It defines the number of elements in the stack.

  5. Both (2) and (4).


Correct Option: E
Explanation:

Yes, both are true statements.

Serving requests of a single shared resource and transferring data asynchronously is an example of ___ data structure?

  1. Stack

  2. Queue

  3. Array

  4. Tree

  5. None of the above


Correct Option: B
Explanation:

A queue data structure is responsible for that. It maintains a queue for the jobs.

What will be the pre-order traversal of the given in-order traversal of tree SQTPURV?

  1. PQSTRUV

  2. PQSTRVU

  3. TQSPRUV

  4. TSQPRUV

  5. None of the above


Correct Option: A
Explanation:

The given in-order traversal of tree SQTPURV has root node P (the middle element of tree) and left of P is left subtree and right of P is right subtree, so in pre-order traversal, the root node comes first followed by left and right subtree like PQSTRUV.

Which of the following field in the doubly linked list contains the address of the first element of the list?

  1. Previous pointer field

  2. Next pointer field

  3. Information field of the node

  4. Tail

  5. Head


Correct Option: E
Explanation:

Head contains the address of the first element of the list.

Which of the following is not a true statement?

  1. A binary search tree is represented by the linked list using pointers.

  2. In linked list representation of binary tree, the left pointer points to the data field of the next node.

  3. A binary search tree should have data field in the linked list representation.

  4. Doubly linked list can be used to represent the binary search tree.

  5. None of the above


Correct Option: E
Explanation:

All of the above are the true statements.

Which of the following is/are not a true statement(s)?

  1. A binary search tree may be empty.

  2. In a binary search tree, the left and right subtree of the root are also binary search trees.

  3. A binary search tree can be represented using linked list.

  4. A binary search tree can be represented using a array.

  5. None of the above


Correct Option: E
Explanation:

All of the above are the true statements.

Which of the following value will be represented by the previous pointer field in the doubly linked list, if there is no preceding element in the list?

  1. Zero

  2. Null

  3. Void

  4. It does not return any value if the preceding element is absent

  5. None of the above


Correct Option: B
Explanation:

It returns Null value if there is no preceding element.

Which of the following will be the sentinel value for front variable for the underflow condition of queue?

  1. 0

  2. 1

    • 1
  3. Null

  4. None of the above


Correct Option: C
Explanation:

The sentinel value of front variable is -1 for underflow condition of queue.

Which of the following field in the doubly linked list should be Null in case of empty linked list?

  1. prev

  2. next

  3. head

  4. tail

  5. both (3) and (4)


Correct Option: E
Explanation:

Yes, head and tail both should be Null for the empty doubly linked list.

A priority queue can be implemented by using ____?

  1. Linked list

  2. Heap

  3. Multiple queues

  4. All of the above

  5. Only (2) and (3)


Correct Option: D
Explanation:

All of the above are used to implement the priority queue.

Elements can be added and removed from the either end in ____?

  1. Priority queue

  2. Deque

  3. Linear queue

  4. Circular queue

  5. None of the above


Correct Option: B
Explanation:

Yes, deque is called Double-ended queue, in which elements can be added and removed from the either end.

What is the mean of shape property of a heap data structure?

  1. It means that the node, which is the smallest of all its children, is called min heap.

  2. It means that the node, which is the largest of all its children, is called max heap.

  3. It means that the heap is a completely or nearly complete binary tree.

  4. Both (2) and (3)

  5. None of the above


Correct Option: C
Explanation:

This is called Shape property of a heap.

Which of the following has hierarchical representation of data structure?

  1. Stack

  2. Tree

  3. Queue

  4. Graph

  5. Both (2) and (4)


Correct Option: E
Explanation:

Yes, both have hierarchical representation of data.

Which of the following is a false statement?

  1. A data structure is a logical representation of a particular data.

  2. Stack and queue are linear data structures.

  3. A heap is called a binary tree.

  4. Data structures also have merging operation.

  5. None of the above


Correct Option: E
Explanation:

Yes, all of the above are the true statements.

Which of following stack operation returns a Boolean value?

  1. push()

  2. pop()

  3. size()

  4. isEmpty()

  5. peek()


Correct Option: D
Explanation:

This operation tests to see whether the stack is empty and it returns the value true or false.

- Hide questions