2025!!
1. Rule of the party is that participants that
Stack
arrive later will leave earlier; what data
structure is appropriate to store participants
-Stack
-Array List
-Linked List
-All of the above
2. Your program frequently tests whether a DVD is avail- array list
with binary
able in a set of sorted DVDs. which is the best solu-
search
tion?
-store in a linked list and use binary search
-store in a array list and use binary search
-store in a array list and use sequential search
-store in a linked list and use sequential search
3. Which of the following is the correct way to instantiate T[] x = (T[])
(new Ob-
an array of 10 generic objects? ject[10]);
•T[] x = new T[10];
•T[10] x = new T[];
•T[] x = (T[])(new
Object[10]);
4. A linked implementation of a stack adds and removes Front
elements from the of the linked list.
•Front
•Rear
•Middle
•None of the above
5. What is the output of the following program
, Java Data Structures Exam Latest Update With Complete Solutions
2025!!
3+++***---+++***
public class recurse2
{
, Java Data Structures Exam Latest Update With Complete Solutions
2025!!
public static void main (String[] statemen
args) ts: int[ ]
{ p = new
recurse(3); int[100];
System.out.print("-- int[ ] s =
-"); recurse(2); p;
}
public static void recurse(int x)
{
if (x<=1)
System.out.print("***
"); else if ((x % 2)
== 0)
{
System.out.print("+
++"); recurse(x-2);
}
else
{
System.out.print(
x); recurse(x-1);
}
}
}
•3***+++***---+++
•3+++***---+++***
•3*******++++----
•None of the above
6. Consider the following
, Java Data Structures Exam Latest Update With Complete Solutions
2025!!
• p[99] = 75;