Basic CS-Data Structures [3i Infotech Placement]: Sample Questions 1 - 3 of 52

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 1

Data Structures
Edit

Describe in Detail

Essay▾

What is a hash table? When would you can use one?

Explanation

Understanding of Hash Table
  • Value is stored in a data structure called hash table.
  • Uses a hash function to compute an index into an array which element will search.
The Hash Table
  • Also used with key/value pairs to store and retrieve value using key.
  • Hash table access of data becomes very fast if we know the index of the desired data.
  • The average time required to search for an element in a hash table is O (1) .
  • Basic operation of hash table:
    • Search: search an element in a hash table.
    • Insert: insert an element in a hash table.
    • Delete: Delete an element from a hash table.

Question 2

Data Structures
Edit

Write in Short

Short Answer▾

If a binary tree has 20 nodes then it has how many null branches?

Explanation

  • A binary tree with 20 nodes has 21 many null branches.
  • Consider, a tree with 5 nodes (n = 5)
  • No. of null pointer = 2n- (n-1) = n + 1
  • When , n = 20
  • Then n + 1 = 20 + 1 = 21

Question 3

Data Structures
Edit

Write in Short

Short Answer▾

What are the differences between structures and array?

Explanation

Differences between Structures and Array
ArrayStructure
Collection of homogeneous data.The collection of heterogeneous data.
Data is accessed using indexElement are accessed using “.” operator.
Allocates static memory.Allocates dynamic memory.
Element accesses takes less time than structureElement access takes more time than array.

Developed by: