Data Structure Questions and Answers updated daily – Computer Knowledge

Data Structure Questions: Solved 242 Data Structure Questions and answers section with explanation for various online exam preparation, various interviews, Computer Knowledge Category online test. Category Questions section with detailed description, explanation will help you to master the topic.

Data Structure Questions

41. If the given input array is sorted or nearly sorted, which of the following algorithm gives the best performance?




SHOW ANSWER
Correct Ans:Insertion sort
Explanation:
Workspace



42. Which of the following is not a non comparison sort?




SHOW ANSWER
Correct Ans:Shell sort
Explanation:
Workspace



43. Read the following statements carefully and pick the right most option.

I. A linear algorithm to solve a problem must perform faster than a quadratic algorithm to solve the same problem.
II. An algorithm with worst case time behavior of 3n takes at least 30 operations for every input of size n=10.




SHOW ANSWER
Correct Ans:(I) is TRUE but (II) is FALSE
Explanation:
As the first statement is true according to the definition of linear algorithms, the second is false as 30 operations are not needed.
Workspace



44. A node of a directed graph G having no out-degree and a positive in-degree is called




SHOW ANSWER
Correct Ans:Source node
Explanation:
Workspace



45. For the LCBB solution of knapsack problem with the data (p1–p4) = (10,10,12,18) and (w1–w4) = (2, 4, 6, 9) and m = 18, then the values of u(1) and ?(1) respectively are




SHOW ANSWER
Correct Ans:-32, -44
Explanation:
u(1) is the negation of sum of all profits so long as the weights as whole can be taken [ -(10+10+12)]. ?(1) is the value of u(1) and the negation of profit of the fraction of the next element taken to fill the knapsack [ u(1) + -( 6/9*18) ].
Workspace



46. The following is a weighted binary tree, then what is the weighted array for the TVS problem?





SHOW ANSWER
Correct Ans:[9, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 6, 4]
Explanation:
Workspace



47. For the quick sort algorithm, what is the time complexity of the best/worst case?




SHOW ANSWER
Correct Ans:best case: O(n*log(n)) worst case: O(n*n)
Explanation:
Workspace



48. For the bubble sort algorithm, what is the time complexity of the best/worst case? (assume that the computation stops as soon as no more swaps in one pass)




SHOW ANSWER
Correct Ans:best case: O(n) worst case: O(n*n)
Explanation:
Workspace



49. Consider Stack is implemented using the array.

#define MAX 10
struct STACK
{
int arr[MAX]
int top = -1;
}

In this implementation of stack maximum value of top which cannot cause overflow will _________.




SHOW ANSWER
Correct Ans:9
Explanation:
Workspace



50. Consider Stack is implemented using the array.

#define MAX 10
struct STACK
{
int arr[MAX]
int top = ___________;
}

What will be the initial value with which top is initialized.




SHOW ANSWER
Correct Ans:-1
Explanation:
Workspace



51. An item that is read as input can be either pushed to a stack and later popped and printed, or printed directly. Which of the following will be the output if the input is the sequence of items 1, 2, 3, 4, 5 ?




SHOW ANSWER
Correct Ans:3 4 5 2 1
Explanation:
Workspace



52. Stack A has 3 Elements in it Say X,Y and Z with X on top.

1) Stack B is empty.
2) An Element popped out from Stack A can be printed immediately or pushed to stack B.
3) An Element popped out from Stack B can only be printed.

In this arrangement, which of the following permutations of X,Y,Z are not possible ?




SHOW ANSWER
Correct Ans:Z X Y
Explanation:
Workspace



53. If memory for the run-time stack is only 150 cells(words), how big can N be in Factorial(N) before stack overflow?




SHOW ANSWER
Correct Ans:66
Explanation:
Workspace



54. Consider following Scenario -

1) The five items : P,Q,R,S and T are inserted into stack A one after another starting from T in reverse order
2) The stack is popped three times and each element is inserted into another stack B.
3) Then two elements are deleted from the stack B and pushed back onto the stack A.

What are the topmost elements of stack A and Stack B respectively?




SHOW ANSWER
Correct Ans:Q P
Explanation:
Workspace



55. Convert the following infix expression to postfix expression -
B * C - C + D / A / ( E + E )




SHOW ANSWER
Correct Ans:B C * C - D A / E E + / +
Explanation:
Workspace



56. Convert the following infix expression to postfix expression -
A / B ^ C + D * E - A * C




SHOW ANSWER
Correct Ans:A B C ^ / D E * + A C * -
Explanation:
Workspace



57. Evaluate Postfix expression from given infix expression.
A + B * (C + D) / F + D * E




SHOW ANSWER
Correct Ans:ABCD+*F/+DE*+
Explanation:
Workspace



58. Find the odd out




SHOW ANSWER
Correct Ans:Floyd-Warshall's All pair shortest path Algorithm
Explanation:
Floyd-Warshall's All pair shortest path Algorithm uses dynamic programming approach. All other mentioned algorithms use greedy programming approach
Workspace



59. In conversion from prefix to postfix using stack data-structure, if operators and operands are pushed and popped exactly once, then the run-time complexity is ?




SHOW ANSWER
Correct Ans:?(n)
Explanation:
Workspace



60. If queue is implemented using arrays, what would be the worst run time complexity of queue and dequeue operations?




SHOW ANSWER
Correct Ans:?(1), ?(1)
Explanation:
Workspace



Are you seeking for good platform for practicing Data Structure questions in online. This is the right place. The time you spent in Fresherslive will be the most beneficial one for you.

Online Test on Data Structure @ Fresherslive

This page provides important questions on Data Structure along with correct answers and clear explanation, which will be very useful for various Interviews, Competitive examinations and Entrance tests. Here, Most of the Data Structure questions are framed with Latest concepts, so that you may get updated through these Data Structure Online tests. Data Structure Online Test questions are granted from basic level to complex level.

Why To Practice Data Structure Test questions Online @ Fresherslive?

Data Structure questions are delivered with accurate answer. For solving each and every question, very lucid explanations are provided with diagrams wherever necessary.
Practice in advance of similar questions on Data Structure may improve your performance in the real Exams and Interview.
Time Management for answering the Data Structure questions quickly is foremost important for success in Competitive Exams and Placement Interviews.
Through Fresherslive Data Structure questions and answers, you can acquire all the essential idea to solve any difficult questions on Data Structure in short time and also in short cut method.
Winners are those who can use the simplest method for solving a question. So that they have enough time for solving all the questions in examination, correctly without any tense. Fresherslive provides most simplest methods to answer any tough questions. Practise through Fresherslive test series to ensure success in all competitive exams, entrance exams and placement tests.

Why Fresherslive For Data Structure Online Test Preparation?

Most of the job seekers finding it hard to clear Data Structure test or get stuck on any particular question, our Data Structure test sections will help you to success in Exams as well as Interviews. To acquire clear understanding of Data Structure, exercise these advanced Data Structure questions with answers.
You're Welcome to use the Fresherslive Online Test at any time you want. Start your beginning, of anything you want by using our sample Data Structure Online Test and create yourself a successful one. Fresherslive provides you a new opportunity to improve yourself. Take it and make use of it to the fullest. GOODLUCK for Your Bright Future.


Online Test for Data Interpretation
Online Test for C Language
FreshersLive - No.1 Job site in India. Here you can find latest 2023 government as well as private job recruitment notifications for different posts vacancies in India. Get top company jobs for both fresher and experienced. Job Seekers can get useful interview tips, resume services & interview Question and answer. Practice online test free which is helpful for interview preparation. Register with us to get latest employment news/rojgar samachar notifications. Also get latest free govt and other sarkari naukri job alerts daily through E-mail...
DMCA.com Protection Status