Classical

Data Structures - Algorithms

1:  

The running time of an algorithm T(n),where 'n' is the input size, of a recursive algorithm is given as follows.is given by

          T(n) =c + T(n - 1), if n > 1

            d, if n  ≤  1
The order of this algorithm is

 

A.

n2

B.

n

C.

n3

D.

nn

 
 

Option: B

Explanation :

By recursively applying the relation we finally arrive at
T(n-I) = c(n-I) + T (1) = c(n-I)+d
So, order is n

 ≤  1
The order of this algorithm is

 

'>
2:  
Six files Fl, F2, F3, F4, F5 and F6 have 100,200,50,80, 120, 150 number of records respectively. In what order should they be stored so as to optimize access time? Assume each file is accessed with the same frequency.
 
A.

 F3, F4, FI, F5, F6, F2

B.

 F2, F6, F5, Fl, F4, F3

C.

Fl, F2, F3, F4, F5, F6

D.

Ordering is immaterial as all files are accessed with the same frequency

 
 

Option: A

Explanation :

Since the access is sequential, greater the distance, greater will be the access time. Since all the files are referenced with equal frequency, overall access time can be reduced by arranging them as in option (a).


3:  
In  previous question,  the average access time will be
 
A.

268 units

B.

 256 units

C.

293 units

D.

210 units

 
 

Option: A

Explanation :

Since each file is referenced with equal frequency and each record in a particular file can be referenced with equal frequency, average access time will be (25 + (50 + 40) + (50 + 80 + 50) + ... )/6 = 268 (approximately).


4:  
An algorithm is made up of 2 modules Ml and M2. If order of M1 is f(n) and M2 is g(n) then the order of the algorithm is
 
A.

max (f (n) ,g (n))

B.

min (f (n) ,g (n) )

C.

f (n) + g (n)

D.

f (n) x g (n )

 
 

Option: A

Explanation :

 

By definition of order, there exists constants c1, ec2, n1, n2 such that
T (n)   ≤ c1 x f (n) , for all n  ≥ n1.
T (n)   ≤ c2 x f (n) , for all n  ≥ n2.
N = max (n1, n2) andC = max (c1, c2). So,
T (n)  ≤ C x f(n) for all n  ≥ N
T (n)  ≤  C x g (n) for all n  ≥  N
T(n) ≤ C/2 x (f(n)+g(n))
Without loss of generality, let max ( f (n), g (n)) =f(n) .
So, T (n)   ≤ C / 2 (f(n) + f (n) ) ≤ C x f(n) .
So, order is  f(n) , which is max (f(n), g (n) ) , by our assumption.

 


5:  
There are 4 different algorithms AI, A2, A3, A4 to ·solve a given problem with the order Iog(n), log(log(n)), nIog(n) ,n / log(n) respectively. Which is the best algorithm?
 
A.

A1

B.

A2

C.

A4

D.

A3

 
 

Option: B

Explanation :




Suggest an improvement

 


Syllabus covered in this section is-

  • Abstract data types
  • Algorithms
  • Stacks, Queues
  • Linked Lists
  • Trees, Binary search trees
  • Binary heaps

This Section covers Data Structures Questions Answers using C language .
Who can benefit - 

  • Any student who is pursuing B.Sc. in Information Technology can also use this Data Structures mcq section. 
  • Data Structures MCQs can also be used by any student who is pursuing any undergraduate or postgraduate degree in Computer Science.
  • Any candidate who has to appear for DOEACC A, B or C level Exam can also use Data Structures Questions Answers to gain credits in their exams.
  • Candidates appearing for Kendriya Vidyalya Sangathan Entrance Exam can also use Data Structures Multiple Choice Questions Answers for the preparation of their exams.
  • Data Structures Questions Answers can also be used by MCA students for the preparation of their exams.
  • You can also get Data Structures mcq pdf if you purchase an e-book from site.
  • You can download Data Structures MCQ pdf from this site.
  • You can get access to Data Structures Multiple Choice Questions Answers  EBook.

Various Search Terms used for this section are

  • Data Structures quiz questions with answers

  • Data Structures exam questions answers

  • Data Structures MCQ questions Answers

  • Data Structures MCQ

  • Data Structure MCQ Pdf Download