ExamVeda
Login
Home
71
What is the functionality of the following piece of Java code?
Assume: 'a' is a non empty array of integers, the Stack class creates an array of specified size and provides a top pointer indicating TOS(top of stack), push and pop have normal meaning.
public void some_function(int[] a)
{
	Stack S=new Stack(a.length);
	int[] b=new int[a.length];
	for(int i=0;i<a.length;i++)
	{
		S.push(a[i]);
	}
	for(int i=0;i<a.length;i++)
	{
		b[i]=(int)(S.pop());
	}
	System.out.println("output :");
	for(int i=0;i<b.length;i++)
	{
		System.out.println(b[i]);
	}
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
72
Select the code snippet which return true if the stack is empty, false otherwise.
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
73
What is the time complexity to insert a node based on key in a priority queue?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
74
What happens when you pop from an empty stack while implementing using the Stack ADT in Java?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
75
What would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of the list?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
76
The data structure required to check whether an expression contains a balanced parenthesis is?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
77
Which of these best describes an array?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
78
Given only a single array of size 10 and no other memory is available. Which of the following operation is not feasible to implement (Given only push and pop operation)?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
79
In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
80
Which of the following is false about a doubly linked list?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board