Analysis of Algorithms and Computational Complexity Questions and Answers

Practice Mode
Showing 10 of 239 questions
Q141
Which of the following lines of code will delete two successive nodes of a singly linked linear list (WITH MORE THAN 2 NODES) ? Assume this code is in the main program, not a subprocedure
  • A LINK[X]:=LINK [LINK[X]];
  • B X : = LINK [LINK [X];
  • C LINK [LINK [X]] : = X;
  • D LINK [X]: = LINK [LINK [LINK[X]]]
Answer: Option D
Q142
If memory for the run-time stack is only 150 cells (words), how big can N be in Factorial (N) before encountring stack overflow?
  • A 24
  • B 15
  • C 66
  • D 50
Answer: Option C
Q143
How many comparisons are required to sort an array of length 5 if a straight selection sort is used and the array is already sorted in the opposite order ?
  • A 0
  • B 1
  • C 15
  • D 20
Answer: Option D
Q144
With round-robin CPU scheduling in a time-shared system
  • A using very large time slices (quantas) degenerates into FCFS (First-Come First-Served) algorithm
  • B Using very small time slices (quantas) degenerates into LIFO (last-In First-Out) algorithm
  • C using extremely small time slice improves performance
  • D using medium sized time slice leads to SRTF (Shortest Remaining Time First) scheduling policy
Answer: Option A
Q145
Sorting data means to arrange it in ------order
  • A alphabetical
  • B numerical
  • C either alphabetical or numerical
  • D none of these
Answer: Option C
Q146
Data sorted from the largest value to the smallest value is sorted in
  • A ascending
  • B descending
  • C randomly
  • D none of these
Answer: Option B
Q147
If the binary search algorithm determines that the search argument is in the upper half of the array, which of the following statements will set the appropriate variable to the appropriate value?
  • A start Sub = middle Sub - 1;
  • B start Sub = middle Sub + 1;
  • C stop Sub = middle Sub - 1;
  • D stop Sub = middle Sub + 1;
Answer: Option A
Q148
Which of the following statements is used in the binary search algorithm to halve the array ?
  • A middle Sub = (start Sub + stop Sub)/2
  • B middle Sub = sdtart Sub + stop Sub/2
  • C middle Sub = middle Sub/2;
  • D middle Sub = (stop Sub - start Sub)/2
Answer: Option B
Q149
The _____ algorithm works by comparing adjacent array that are out of order.
  • A alphabetic
  • B bubble
  • C compare
  • D list
Answer: Option A
Q150
When you use the bubble sort, the first step in swapping two of the elements in the salary array is to
  • A assign salary [X] to temp
  • B assign salary [X+2] to temp
  • C assign salary [X] to salary [X+1]
  • D assign temp to salary [X]
Answer: Option A
Questions and Answers for Competitive Exams Various Entrance Test