SlideShare a Scribd company logo
1 of 27
Mcq 15-20
Q15:
Which of the following trees are binary search trees?
. all of them
Q16:
Which of the following trees are binary search trees?
. all of them
Q17:
. all of them
Q18:
It is forbidden to place both private and abstract in front of a
method declaration.
. true
. false
Q19:
Consider the binary search tree below:
What is the post-order path of this binary search tree?
Remember this in the post-order walk: First, we go through the
left subtree. Then we cross the right subtree. Finally, we visit
the root.
Q20:
Consider the following two classes:
After executing the code, we will have the following display:
Mcqs 7- ?
Q7:
Suppose A is an interface, B is a class that realizes interface A,
and C is a class that extends class B.
Consider the following code:
Which of the test () method statements will print true to
standard output?
Reminder: The java.lang.Object.getClass () method returns the
runtime class of an object.
Q8:
Which ArrayList declaration is appropriate for a list that
contains values of type float?
Q9:
What does the following method do in the context of a simply
linked list?
. The method removes all nodes from the linked list.
. The method traverses the linked list without modifying it.
. The method reverses the linked list.
. The method removes every other node from the linked list.
Q10:
Suppose we have a single-linked sorted list whose nodes contain
integer values. What is the mystery () method for in the
following code snippet?
Question 10 options:
.The method removes every other node from the linked list.
.This method removes duplicates from the linked lis
.The method traverses the linked list without modifying it.
Q11:
Complete lines 27 and 28 of the following implementation
(blanks 1 and 2) so that addLast (E value) adds a value to the
end (back) of the doubly linked list.
Q12:
Consider the following doubly linked list. The values saved in
the list are integers.
Now, suppose we run the tweak () method, shown below, on this
doubly linked list.
Starting from the node designated by head, how will the values
of the nodes be read after executing tweak ()?
Q13:
Consider a simply linked list. We want to write a private
recursive method, E size (Node <E> current), to calculate the
size of the list starting with the node designated by head via the
public E size () method (also shown in the snippet below).
Which of the following choices corresponds to a correct
implementation of the E size (Node <E> current) method?
Q13 options :
Q14:
The following List interface declares a subset of the methods of
the java.util.List interface.
public interface List <E> {
void add ( int index , E elem ) ;
E remove (int index ) ;
boolean remove (E obj ) ;
int size ( ) ;
boolean isEmpty ( ) ;
//autres méthodes
}
For implementing this interface using an array, ArrayList.
Question 14 options:
.Insertions at intermediate positions in the list are always quick.
.Removing an item is always quick.
.Consulting the intermediate positions of the list is always fast.
.none of the above
Q15:
Consider the following simply chained list (the values stored in
the list are of type String).
What values will be stored in the list read from left to right
after calling the mystery (head, "C") method, shown below,
from the list above?
Mcqs :
Q1:
Suppose we have a queue q (front to back: 2, 4, 6, 8, 10) and an
initially empty stack s. We remove the elements from the queue
q one at a time and add them to s, until q becomes empty. Next,
we remove the elements from s one by one and put them in
queue q, until s becomes empty. What does q (front to back)
look like now?
Q2:
Consider an implementation of a queue based on a circular
table. Suppose we set the maximum capacity of the queue to 5,
or MAX_QUEUE_SIZE = 5. In other words, the underlying
array will have 5 elements, indexed 0, 1, 2, 3, 4. We define the
queue as follows :
CircularArrayQueue <String> queue = new CircularArrayQueue
<String> ();
Suppose the queue front variable is initially set to 0, as shown
below.
What will be the internal state of the array in the queue after
executing the following sequence of operations?
queue.enqueue("X");queue.enqueue("Z");queue.enqueue("S");qu
eue.dequeue();queue.enqueue("V");queue.dequeue();queue.enqu
eue("C");queue.enqueue("N");queue.dequeue();
Q3:
Either the following code:
Which of the following options is correct?
Question 3 options:
This code is correct (it can be compiled and executed)
This code is not correct (it cannot be compiled and executed)
Q4:
What is the result of the following program?
Q5:
What is the result of the following program?
Q6:
What is the result of the following program?
Iterator2.javaIterator2.javapublicinterfaceIterator<T>{
boolean hasNext();
T next();
}
java exam Programm 2.docx
Programm 2 :
Q26:
For this question, you are going to write a program that
transforms a given two-dimensional array (Matrix) of objects
(generic type E) into a linked grid-like structure. You will then
implement some operations as well as an iterator on the
resulting linked structure. Below, we illustrate the
transformation for a two-dimensional array of integer objects
(ie Integer [] []).
Each node in the grid is an instance of the Node (nested) class,
shown below. Each Node instance points to two other Node
instances: the node immediately to its right (right) and the node
immediately below (down). Grid lines end with a right null
pointer; columns end with a null pointer down, as shown above.
The grid has a perfectly rectangular shape; there are no missing
nodes in the grid structure.
Complete the implementation of the LinkedGrid class by writing
the methods requested in the questions that follow.
The first part of the class is below. Otherwise the complete
class is in the attached file in prohramme2: LinkedGrig.java.
/*Class LinkedGrid */
import java.util.NoSuchElementException;
public class LinkedGrid<E> {
/* Nested Node class */
public static class Node<T> {
private T data;
private Node<T> right, down;
Node(T data, Node<T> right, Node<T> down) {
this.data = data;
this.right = right;
this.down = down;
}
public T getData() { return data;}
public Node<T> getRight(){ return right; }
public Node<T> getDown(){ return down;}
}
/*Instance variables*/
private Node<E> topLeft; //first element of the grill
private int rowCount, columnCount; // number of rows and
number of columns
/* The rest is in the attached file in program2*/
}
Question 1) Complete the int getRowCount () method which
returns the number of rows of the grid in the space below
/*Instance methods*/
/*Returns the number of rows */
public int getRowCount() {
Votre ligne du code vient ici
}
Note for files provided attached in program 2:
You are provided with three files attached in program2:
LinkedGrid.java, the Iterator.java interface, and the Q2Test.java
test code to test your programs.
We have provided you with a Template implementation that
includes: (1) the declaration of the Node class (shown above),
(2) the signatures of the methods you need to implement in
Q26-Q33, (3) the skeleton code (y including the Iterator
interface) for the LinkedGridIterator class in Q33, (4) the full
implementation of the constructor for a single row grid
(LinkedGrid (E [] array)), (5) the full implementation of the
toString method () for LinkedGrid, and (6) a Q1Test class that
allows you to test your implementation.
Q27:
For the LinkedGrid class from question 26, Implement the
method in the space below,
int getColumnCount(): returns the number of columns in the
grid
/* Returns the number of columns in the grid */
public int getColumnCount () {
Your line of code comes here
}
Q28:
For the LinkedGrid class from question 26, Implement the
method,
boolean isEmpty(): renvoie true si la grille est vide
/* Returns true if the grid is empty */
public boolean isEmpty() {
Your line of code comes here
}
Q29:
For the LinkedGrid class from question 26, Implement the
method,
Node<E> getTopLeft(): returns the first element of the grid
/* Returns the first element of the grid */
public Node<E> getTopLeft(){
Your line of code comes here
}
Q30:
For the LinkedGrid class from question 26, Implement the
method,
E getElementAt (int row, int column): This method returns the
object stored in row i and column j.
For example, calling getElementAt (1, 2) on our illustrative
integer grid will return an Integer instance with the value 5.
/* Returns the object stored at row i and column j */
public E getElementAt(int row, int column) {
if (row < 0 || row >= rowCount || column < 0 ||
column >= columnCount)
throw new IllegalArgumentException("The both parameters
have to be within range");
Node<E> current = topLeft;
Your piece of the code comes here
return current.data;
}
Q31:
For the LinkedGrid class from question 26, Implement the
method,
void addFirstRow(E[] array);
/* create and add the first row of the grid */
private void addFirstRow(E[] array) {
if (!isEmpty())
throw new IllegalStateException("Grid must be empty to add a
first row");
topLeft = new Node<E>(array[0], null, null);
Node<E> current = topLeft;
Your piece of the code comes here
}
When this method is called (by the LinkedGrid constructor), the
first row of the grid is created and the topLeft instance variable
in LinkedGrid is made to point to the first node of that row. The
expected behavior of the method is illustrated in the figure
below. Additionally, the method should set rowCount instance
variables and columnCount in LinkedGrid (index: rowCount
should be set to 1 and columnCount should be set to
array.length).
Q32:
For the LinkedGrid class of question 26, complete the method
void addRow(E[] array) ; Add a line at the bottom of the grid
When called, this method adds a new row at the bottom of an
existing grid. This behavior is illustrated in the figure below.
Note that the addRow (E [] array) method can be called
iteratively, with each call adding a row to the bottom of the
grid.
To create the entire grid in our illustration, addRow must be
called twice, once with [3; 4; 5] as parameter then with [6; 7; 8]
as a parameter. Note that the first row (ie [0; 1; 2]) must have
been added beforehand by calling addFirstRow (array E [])
expanded in Q31. Calling addRow (array E []) should increase
the columnCount instance variable by one.
/* Add a line at the bottom of the grid */
public void addRow(E[] array) {
if (array == null)
throw new NullPointerException("array
cannot be null");
if (rowCount == 0)
throw new IllegalStateException("Need to
add first row first");
if (array.length != this.columnCount)
throw new IllegalArgumentException("array must contain " +
this.columnCount + " elements");
Node<E> prev = topLeft;
while(prev.down != null)
prev = prev.down;
Node<E> current = new Node<E>(array[0], null,
null);
prev.down = current;
Your piece of the code comes here
}
Q33/
Class LinkedGridIterator:
Complete the LinkedGridIterator () parameterless constructor of
the LinkedGridIterator class for initialization (of
currentIterator, headRow).
//constructor
public LinkedGridIterator() {
Your line of code comes here
}
LinkedGrid.javaLinkedGrid.javaimport java.util.NoSuchElemen
tException;
publicclassLinkedGrid<E>{
publicstaticclassNode<T>{
private T data;
privateNode<T> right, down;
Node(T data,Node<T> right,Node<T> down){
this.data = data;
this.right = right;
this.down = down;
}
public T getData(){return data;}
publicNode<T> getRight(){return right;}
publicNode<T> getDown(){return down;}
}
privateNode<E> topLeft;
privateint rowCount, columnCount;
publicLinkedGrid(E[] array){
if(array ==null)
thrownewNullPointerException("array cannot be null");
if(array.length ==0)
thrownewIllegalArgumentException("array must contain elemen
ts");
addFirstRow(array);
}
privatevoid addFirstRow(E[] array){
if(!isEmpty())
thrownewIllegalStateException("Grid must be empty to add a fir
st row");
// Add your code here
thrownewUnsupportedOperationException("not implemented yet
!");
}
publicvoid addRow(E[] array){
if(array ==null)
thrownewNullPointerException("array cannot be null");
if(rowCount ==0)
thrownewIllegalStateException("Need to add first row first");
if(array.length !=this.columnCount)
thrownewIllegalArgumentException("array must contain contain
"+this.columnCount +" elements");
// Add your code here
thrownewUnsupportedOperationException("not implemented yet
!");
}
publicLinkedGrid(E[][] array){
if(array ==null)
thrownewNullPointerException("array cannot be null");
thrownewUnsupportedOperationException("not implemented yet
!");
}
publicint getRowCount(){
// Add your code here
}
publicint getColumnCount(){
// Add your code here
}
publicboolean isEmpty(){
// Add your code here
}
publicNode<E> getTopLeft(){
// Add your code here
}
public E getElementAt(int row,int column){
if(row <0|| row >= rowCount || column <0|| column >= column
Count)
thrownewIllegalArgumentException("The row and column para
meters both have to be within range");
// Add your code here
thrownewUnsupportedOperationException("not implemented yet
!");
}
publicString toString(){
StringBuffer buffer =newStringBuffer();
for(int i =0; i < rowCount; i++){
for(int j =0; j < columnCount; j++){
buffer.append(getElementAt(i, j));
if(j < columnCount -1)
buffer.append(", ");
}
if(i < rowCount -1)
buffer.append(System.lineSeparator());
}
return buffer.toString();
}
privateclassLinkedGridIteratorimplementsIterator<E>{
privateNode<E> currentIterator, headRow;
publicLinkedGridIterator(){
// Add your code here
}
public E next(){
thrownewUnsupportedOperationException("not implemented yet
!");
}
publicboolean hasNext(){
thrownewUnsupportedOperationException("not implemented yet
!");
}
}
publicIterator<E> iterator(){
returnnewLinkedGridIterator();
}
}
Q2Test.javaQ2Test.javapublicclassQ2Test{
publicstaticvoid test(){
Integer[] integerFirstRow ={0,1,2};
Integer[] integerSecondRow ={3,4,5};
Integer[] integerThirdRow ={6,7,8};
LinkedGrid<Integer> integerGrid =newLinkedGrid<Integer>(int
egerFirstRow);
integerGrid.addRow(integerSecondRow);
integerGrid.addRow(integerThir dRow);
System.out.println("==== Integer grid with "+ integerGrid.getR
owCount()+
" rows x "+ integerGrid.getColumnCount()+" columns ====");
System.out.println("[Test LinkedGrid(E[] array) / addFirstRow(.
..) and addRow(...)]");
System.out.println("getTopLeft().getData(): "+ integerGrid.getT
opLeft().getData());
System.out.println("getTopLeft().getRight().getRight().getDown
().getData(): "+ integerGrid.getTopLeft().getRight().getRight().
getDown().getData());
System.out.println("getTopLeft().getDown().getDown().getData
(): "+ integerGrid.getTopLeft().getDown().getDown().getData()
);
System.out.println("getTopLeft().getDown().getRight().getDow
n().getRight().getData(): "+ integerGrid.getTopLeft().getDown(
).getRight().getDown().getRight().getData());
System.out.println();
System.out.println("[Test getElementAt(...)] Print integer grid v
ia toString() which uses getElementAt(...)");
System.out.println(integerGrid);
System.out.println();
System.out.println("[Test LinkedGridIterator] Grid via an iterat
or");
Iterator<Integer> iIterator = integerGrid.iterator();
StringBuffer iBuffer =newStringBuffer();
System.out.println();
}
publicstaticvoid main(String[] args){
test();
}
}
/**************************SORTIE QUE VOUS DEVEZ A
VOIR :**********************
==== Integer grid with 3 rows x 3 columns ====
[Test LinkedGrid(E[] array) / addFirstRow(...) and addRow(...)]
getTopLeft().getData(): 0
getTopLeft().getRight().getRight().getDown().getData(): 5
getTopLeft().getDown().getDown().getData(): 6
getTopLeft().getDown().getRight().getDown().getRight().getDat
a(): 8
[Test getElementAt(...)] Print integer grid via toString() which
uses getElementAt(...)
0, 1, 2
3, 4, 5
6, 7, 8
[Test LinkedGridIterator] Grid via an iterator
**************************************************** *
***************************/
Java exam.docx
Java exam:
Part 2 : Programming questions :
Two programs to be developed: Note that the two programs are
independent; program 1 (Q21-25) and program 2 (Q26-33)
Files for testing (Q1Test.java and Q2Test.java) are provided to
you and are attached in program 1 and program 2 respectively,
along with the interfaces and sketches of the corresponding
classes.
Program 1 :
Q 21:
For this question we develop a queue modeling using a simply
linked list of objects (of generic type D). So there is an
interface, named Queue, which is provided to you, as well as a
simple, named, LinkedQueue implementation that you are going
to make.
The LinkedQueue class realizes the Queue interface, it must
provide an implementation for all the methods of the interface:
LinkedQueue () : constructeur sans paramètre
boolean isEmpty() : renvoie true si la file (LinkedQueue) est
vide
void enqueue(D newElement): empiler la file (Insérer un
élément (newElement ))
D dequeue() : dépiler la file (retirer un élément et le renvoyer)
/* Classe LinkedQueue */
public class LinkedQueue<D> implements Queue<D> {
//nested class
private static class Elem<T> {
private T value;
private Elem<T> next;
private Elem(T value, Elem<T> next) {
this.value = value;
this.next = next;
}
}
//Instance variables
private Elem<D> front;
private Elem<D> rear;
//...la suite est dans le programme LinkedQueue.java fourni ci-
joint dans programme 1
}
Question 1: For this LinkedQueue class, implement the
parameterless constructor for initialization, in the space below
/* Constructor*/
public LinkedQueue () ){
Note for the files provided attached in program 1:
THREE FILES ARE ATTACHED IN PROGRAM 1: Queue.java,
LinkedQueue.java and Q1Test.java for testing.
We have provided you with an implementation that includes: (1)
the declaration of the Elem class (shown above), (2) the
signatures of the methods you need to implement in Q21-Q25,
(3) the skeleton code (including the Queue interface) for the
LinkedQueue class, (4) the full implementation of the toString
() method for LinkedQueue, (5) the skeleton code of the
UniquifiableLinkedQueue class for Q25, and a Q1Test class that
allows you to test your implementation .
Q22 :
For the LinkedQueue class from question 21, implement the
boolean isEmpty () method which returns true if the queue is
empty, in the space below.
/ * returns true if the queue is empty * /
public boolean isEmpty(){
Q23 :
For the LinkedQueue class from question 21, implement the
void enqueue (D newElement) method to stack the queue.
/* stack the queue */
public void enqueue(D newElement){
if(newElement == null) {
throw new NullPointerException("no null object in my
queue !");
}
Elem<D> newElem;
newElem = new Elem<D>(newElement,null);
Your piece of the code comes here
}
Q24:
For the LinkedQueue class from question 21, implement the D
dequeue () method to unstack the queue.
/* unstack the queue (remove an item and send it back)*/
public D dequeue() {
if(isEmpty()) {
throw new IllegalStateException("method called on an
empty queue");
}
D returnedValue;
returnedValue = front.value;
Your piece of the code comes here
}
Q25:
For this question, you are going to develop a specialization
(subclass) of LinkedQueue. The subclass, named
UniquiableLinkedQueue, provides a single additional method,
named uniquify ().
The uniquify () method does the following:
It returns a queue that is the same UniquifiableLinkedQueue
instance that the method is called for, except that the returned
queue does not contain any immediately consecutive duplicate
items.
To illustrate what "immediately consecutive duplicate elements"
are, consider the following example queue:
More precisely, two queue items are immediately consecutive
duplicate items, when they are adjacent and have identical
content. Having identical content for the (non-zero) queue
elements elem1 and elem2 means that elem1.equals (elem2) is
true. You can assume that all items in the queue are not null.
You complete the uniquify () method in the
UniquifiableLinkedQueue class below, so that a single instance
of immediately consecutive duplicate items would be kept. For
example, if uniquify () is called on the example file above (an
instance of UniquifiableLinkedQueue <String>), the result
should be as shown in the figure below.
Note that uniquify () is not intended to handle non-consecutive
duplicate items. In other words, the queue returned by uniquify
() may have duplicate items.
You can make calls to the preceding enqueue and dequeue
methods.
To test your implementation of uniquify (), you can use the
provided Q1Test.java code. The output from executing Q1Test
should be the same as that in the test code.
/*Class UniquifiableLinkedQueue*/
public
class UniquifiableLinkedQueue <E> extends LinkedQueue<E> {
/*uniquify method*/
public Queue<E> uniquify ( ) {
Queue<E> result = new LinkedQueue<E>();
Queue<E> temp = new LinkedQueue<E>();
Your piece of the code comes here
return(result);
}
}
LinkedQueue.javaLinkedQueue.javapublicclassLinkedQueue<D
>implementsQueue<D>{
privatestaticclassElem<T>{
private T value;
privateElem<T> next;
privateElem(T value,Elem<T> next){
this.value = value;
this.next = next;
}
}
privateElem<D> front;
privateElem<D> rear;
publicLinkedQueue(){
// Add your code here
}
publicboolean isEmpty(){
// Add your code here
}
publicvoid enqueue(D newElement){
if(newElement ==null){
thrownewNullPointerException("no null object in my queue !");
}
Elem<D> newElem;
newElem =newElem<D>(newElement,null);
// Add your code here
}
public D dequeue(){
if(isEmpty()){
thrownewIllegalStateException("Dequeue method called on an e
mpty queue");
}
D returnedValue;
returnedValue = front.value;
// Add your code here
}
publicString toString(){
String result ="Front -> [";
if(!isEmpty()){
Elem<D> p = front;
result += p.value;
while(p.next !=null){
p = p.next;
result +=", "+ p.value;
}
}
result +="] <- Rear";
return result;
}
}
Q1Test.javaQ1Test.javapublicclassQ1Test{
publicstaticvoid main(String[] args){
UniquifiableLinkedQueue<Integer> integerQueue =newUniquifi
ableLinkedQueue<Integer>();
integerQueue.enqueue(0);
integerQueue.enqueue(1);
integerQueue.enqueue(1);
integerQueue.enqueue(1);
integerQueue.enqueue(2);
integerQueue.enqueue(2);
integerQueue.enqueue(3);
integerQueue.enqueue(3);
integerQueue.enqueue(3);
integerQueue.enqueue(4);
System.out.println("Original Integer Queue: "+ integerQueue);
System.out.println("Integer Queue without immediately consecu
tive duplicates: "+ integerQueue.uniquify());
System.out.println("Original Integer Queue (after uniquify): "+
integerQueue);
System.out.println();
UniquifiableLinkedQueue<String> stringQueue =newUniquifiab
leLinkedQueue<String>();
stringQueue.enqueue("a");
stringQueue.enqueue("a");
stringQueue.enqueue("b");
stringQueue.enqueue("b");
stringQueue.enqueue("b");
stringQueue.enqueue("c");
stringQueue.enqueue("d");
stringQueue.enqueue("d");
stringQueue.enqueue("d");
stringQueue.enqueue("e");
stringQueue.enqueue("e");
System.out.println("Original String Queue: "+ stringQueue);
System.out.println("String Queue without immediately consecut
ive duplicates: "+ stringQueue.uniquify());
System.out.println("Original String Queue (after uniquify): "+ s
tringQueue);
System.out.println();
System.out.println("---- Now, testing with some non-
consecutive duplicates ----- ");
System.out.println();
UniquifiableLinkedQueue<String> stringQueueWithNonConsec
utiveDuplicates =newUniquifiableLinkedQueue<String>();
stringQueueWithNonConsecutiveDuplicates.enqueue("a");
stringQueueWithNonConsecutiveDuplicates.enqueue("b");
stringQueueWithNonConsecutiveDuplicates.enqueue("b");
stringQueueWithNonConsecutiveDuplicates.enqueue("c");
stringQueueWithNonConsecutiveDuplicates.enqueue("a");
stringQueueWithNonConsecutiveDuplicates.enqueue("d");
stringQueueWithNonConsecutiveDuplicates.enqueue("d");
stringQueueWithNonConsecutiveDuplicates.enqueue("e");
stringQueueWithNonConsecutiveDuplicates.enqueue("e");
stringQueueWithNonConsecutiveDuplicates.enqueue("d");
stringQueueWithNonConsecutiveDuplicates.enqueue("d");
stringQueueWithNonConsecutiveDuplicates.enqueue("d");
stringQueueWithNonConsecutiveDuplicates.enqueue("d");
stringQueueWithNonConsecutiveDuplicates.enqueue("b");
System.out.println("Original String Queue: "+ stringQueueWith
NonConsecutiveDuplicates);
System.out.println("String Queue without immediately consecut
ive duplicates: "+
stringQueueWithNonConsecutiveDuplicates.uniquify());
System.out.println("Original String Queue (after uniquify): "+ s
tringQueueWithNonConsecutiveDuplicates);
}
}
/**************************SORTIE QUE VOUS DEVEZ A
VOIR :**********************
Original Integer Queue: Front -> [0, 1, 1, 1, 2, 2, 3, 3, 3, 4] <-
Rear
Integer Queue without immediately consecutive duplicates: Fron
t -> [0, 1, 2, 3, 4] <- Rear
Original Integer Queue (after uniquify): Front -
> [0, 1, 1, 1, 2, 2, 3, 3, 3, 4] <- Rear
Original String Queue: Front -> [a, a, b, b, b, c, d, d, d, e, e] <-
Rear
String Queue without immediately consecutive duplicates: Front
-> [a, b, c, d, e] <- Rear
Original String Queue (after uniquify): Front -
> [a, a, b, b, b, c, d, d, d, e, e] <- Rear
---- Now, testing with some non-consecutive duplicates -----
Original String Queue: Front -
> [a, b, b, c, a, d, d, e, e, d, d, d, d, b] <- Rear
String Queue without immediately consecutive duplicates: Front
-> [a, b, c, a, d, e, d, b] <- Rear
Original String Queue (after uniquify): Front -
> [a, b, b, c, a, d, d, e, e, d, d, d, d, b] <- Rear
*****************************************************
********/
Queue2.javaQueue2.javapublicinterfaceQueue<E>{
boolean isEmpty();
void enqueue(E newElement);
E dequeue();
}
UniquifiableLinkedQueue.javaUniquifiableLinkedQueue.javapu
blicclassUniquifiableLinkedQueue<E>extendsLinkedQueue<E>
{
publicQueue<E> uniquify(){
// Add your code here
thrownewUnsupportedOperationException("not implemented yet
!");
}
}

More Related Content

Similar to Mcq 15-20Q15Which of the following trees are binary search tr

Array 31.8.2020 updated
Array 31.8.2020 updatedArray 31.8.2020 updated
Array 31.8.2020 updatedvrgokila
 
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfCreat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfaromanets
 
Topic20Arrays_Part2.ppt
Topic20Arrays_Part2.pptTopic20Arrays_Part2.ppt
Topic20Arrays_Part2.pptadityavarte
 
Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]Palak Sanghani
 
Sorted number list implementation with linked listsStep 1 Inspec.pdf
 Sorted number list implementation with linked listsStep 1 Inspec.pdf Sorted number list implementation with linked listsStep 1 Inspec.pdf
Sorted number list implementation with linked listsStep 1 Inspec.pdfalmaniaeyewear
 
Data Structure.pdf
Data Structure.pdfData Structure.pdf
Data Structure.pdfMemeMiner
 
Using-Python-Libraries.9485146.powerpoint.pptx
Using-Python-Libraries.9485146.powerpoint.pptxUsing-Python-Libraries.9485146.powerpoint.pptx
Using-Python-Libraries.9485146.powerpoint.pptxUadAccount
 
Data Structure Midterm Lesson Arrays
Data Structure Midterm Lesson ArraysData Structure Midterm Lesson Arrays
Data Structure Midterm Lesson ArraysMaulen Bale
 
COS30008 Semester 1, 2016 Dr. Markus Lumpe 1 Swinbu.docx
COS30008 Semester 1, 2016 Dr. Markus Lumpe  1 Swinbu.docxCOS30008 Semester 1, 2016 Dr. Markus Lumpe  1 Swinbu.docx
COS30008 Semester 1, 2016 Dr. Markus Lumpe 1 Swinbu.docxvanesaburnand
 
JAVA Question : Programming Assignment
JAVA Question : Programming AssignmentJAVA Question : Programming Assignment
JAVA Question : Programming AssignmentCoding Assignment Help
 
Computer Science CS Project Matrix CBSE Class 12th XII .pdf
Computer Science CS Project Matrix CBSE Class 12th XII .pdfComputer Science CS Project Matrix CBSE Class 12th XII .pdf
Computer Science CS Project Matrix CBSE Class 12th XII .pdfPranavAnil9
 
Please help solve this in C++ So the program is working fin.pdf
Please help solve this in C++ So the program is working fin.pdfPlease help solve this in C++ So the program is working fin.pdf
Please help solve this in C++ So the program is working fin.pdfankit11134
 
Please the following is the currency class of perious one- class Curre.pdf
Please the following is the currency class of perious one- class Curre.pdfPlease the following is the currency class of perious one- class Curre.pdf
Please the following is the currency class of perious one- class Curre.pdfadmin463580
 
Getting StartedCreate a class called Lab8. Use the same setup for .pdf
Getting StartedCreate a class called Lab8. Use the same setup for .pdfGetting StartedCreate a class called Lab8. Use the same setup for .pdf
Getting StartedCreate a class called Lab8. Use the same setup for .pdfinfo309708
 

Similar to Mcq 15-20Q15Which of the following trees are binary search tr (20)

Array 31.8.2020 updated
Array 31.8.2020 updatedArray 31.8.2020 updated
Array 31.8.2020 updated
 
Lec3
Lec3Lec3
Lec3
 
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfCreat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
 
[10 points]Add the.pdf
[10 points]Add the.pdf[10 points]Add the.pdf
[10 points]Add the.pdf
 
Topic20Arrays_Part2.ppt
Topic20Arrays_Part2.pptTopic20Arrays_Part2.ppt
Topic20Arrays_Part2.ppt
 
Lec3
Lec3Lec3
Lec3
 
Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]
 
Sorted number list implementation with linked listsStep 1 Inspec.pdf
 Sorted number list implementation with linked listsStep 1 Inspec.pdf Sorted number list implementation with linked listsStep 1 Inspec.pdf
Sorted number list implementation with linked listsStep 1 Inspec.pdf
 
Data Structure.pdf
Data Structure.pdfData Structure.pdf
Data Structure.pdf
 
Using-Python-Libraries.9485146.powerpoint.pptx
Using-Python-Libraries.9485146.powerpoint.pptxUsing-Python-Libraries.9485146.powerpoint.pptx
Using-Python-Libraries.9485146.powerpoint.pptx
 
Second chapter-java
Second chapter-javaSecond chapter-java
Second chapter-java
 
Data Structure Midterm Lesson Arrays
Data Structure Midterm Lesson ArraysData Structure Midterm Lesson Arrays
Data Structure Midterm Lesson Arrays
 
COS30008 Semester 1, 2016 Dr. Markus Lumpe 1 Swinbu.docx
COS30008 Semester 1, 2016 Dr. Markus Lumpe  1 Swinbu.docxCOS30008 Semester 1, 2016 Dr. Markus Lumpe  1 Swinbu.docx
COS30008 Semester 1, 2016 Dr. Markus Lumpe 1 Swinbu.docx
 
JAVA Question : Programming Assignment
JAVA Question : Programming AssignmentJAVA Question : Programming Assignment
JAVA Question : Programming Assignment
 
Computer Science CS Project Matrix CBSE Class 12th XII .pdf
Computer Science CS Project Matrix CBSE Class 12th XII .pdfComputer Science CS Project Matrix CBSE Class 12th XII .pdf
Computer Science CS Project Matrix CBSE Class 12th XII .pdf
 
05-stack_queue.ppt
05-stack_queue.ppt05-stack_queue.ppt
05-stack_queue.ppt
 
Lec2
Lec2Lec2
Lec2
 
Please help solve this in C++ So the program is working fin.pdf
Please help solve this in C++ So the program is working fin.pdfPlease help solve this in C++ So the program is working fin.pdf
Please help solve this in C++ So the program is working fin.pdf
 
Please the following is the currency class of perious one- class Curre.pdf
Please the following is the currency class of perious one- class Curre.pdfPlease the following is the currency class of perious one- class Curre.pdf
Please the following is the currency class of perious one- class Curre.pdf
 
Getting StartedCreate a class called Lab8. Use the same setup for .pdf
Getting StartedCreate a class called Lab8. Use the same setup for .pdfGetting StartedCreate a class called Lab8. Use the same setup for .pdf
Getting StartedCreate a class called Lab8. Use the same setup for .pdf
 

More from AbramMartino96

Homework assignmentPlease annotate one artwork you like from this.docx
Homework assignmentPlease annotate one artwork you like from this.docxHomework assignmentPlease annotate one artwork you like from this.docx
Homework assignmentPlease annotate one artwork you like from this.docxAbramMartino96
 
Homeland Security efforts are ably reinforced by Homeland Defense an.docx
Homeland Security efforts are ably reinforced by Homeland Defense an.docxHomeland Security efforts are ably reinforced by Homeland Defense an.docx
Homeland Security efforts are ably reinforced by Homeland Defense an.docxAbramMartino96
 
Homecoming is an annual tradition in the United States. In this repo.docx
Homecoming is an annual tradition in the United States. In this repo.docxHomecoming is an annual tradition in the United States. In this repo.docx
Homecoming is an annual tradition in the United States. In this repo.docxAbramMartino96
 
HomerAssignmentIIReadthreeofthebooksfromTheOdyss.docx
HomerAssignmentIIReadthreeofthebooksfromTheOdyss.docxHomerAssignmentIIReadthreeofthebooksfromTheOdyss.docx
HomerAssignmentIIReadthreeofthebooksfromTheOdyss.docxAbramMartino96
 
Homelessness in America has been a problem since the settlement of t.docx
Homelessness in America has been a problem since the settlement of t.docxHomelessness in America has been a problem since the settlement of t.docx
Homelessness in America has been a problem since the settlement of t.docxAbramMartino96
 
Homework Assignments One pagewhat the functional currency .docx
Homework Assignments One pagewhat the functional currency .docxHomework Assignments One pagewhat the functional currency .docx
Homework Assignments One pagewhat the functional currency .docxAbramMartino96
 
Homework Assignment Company Research  This assignment req.docx
Homework Assignment Company Research  This assignment req.docxHomework Assignment Company Research  This assignment req.docx
Homework Assignment Company Research  This assignment req.docxAbramMartino96
 
Homework Assignment #1Directions Please answer each of the foll.docx
Homework Assignment #1Directions Please answer each of the foll.docxHomework Assignment #1Directions Please answer each of the foll.docx
Homework Assignment #1Directions Please answer each of the foll.docxAbramMartino96
 
Homework Assignment 9Due in week 10 and worth 30 pointsSuppose t.docx
Homework Assignment 9Due in week 10 and worth 30 pointsSuppose t.docxHomework Assignment 9Due in week 10 and worth 30 pointsSuppose t.docx
Homework Assignment 9Due in week 10 and worth 30 pointsSuppose t.docxAbramMartino96
 
Homework Assignment 4 Guidelines1. Write the paper in Microsoft Wo.docx
Homework Assignment 4 Guidelines1. Write the paper in Microsoft Wo.docxHomework Assignment 4 Guidelines1. Write the paper in Microsoft Wo.docx
Homework Assignment 4 Guidelines1. Write the paper in Microsoft Wo.docxAbramMartino96
 
Hi we are a group doing a research and we split up the work ev.docx
Hi we are a group doing a research and we split up the work ev.docxHi we are a group doing a research and we split up the work ev.docx
Hi we are a group doing a research and we split up the work ev.docxAbramMartino96
 
hi I need research paper  about any topics in Manufacturing Proc.docx
hi I need research paper  about any topics in Manufacturing Proc.docxhi I need research paper  about any topics in Manufacturing Proc.docx
hi I need research paper  about any topics in Manufacturing Proc.docxAbramMartino96
 
HMIS Standards  Please respond to the followingFrom the e-A.docx
HMIS Standards  Please respond to the followingFrom the e-A.docxHMIS Standards  Please respond to the followingFrom the e-A.docx
HMIS Standards  Please respond to the followingFrom the e-A.docxAbramMartino96
 
Hi i need a paper about (Head On )German film ( Turkey part)3 to.docx
Hi i need a paper about (Head On )German film ( Turkey part)3 to.docxHi i need a paper about (Head On )German film ( Turkey part)3 to.docx
Hi i need a paper about (Head On )German film ( Turkey part)3 to.docxAbramMartino96
 
Hi i have new work can you do it, its due in 6 hours Boyd, Ga.docx
Hi i have new work can you do it, its due in 6 hours Boyd, Ga.docxHi i have new work can you do it, its due in 6 hours Boyd, Ga.docx
Hi i have new work can you do it, its due in 6 hours Boyd, Ga.docxAbramMartino96
 
HIT Management and Implementation  Please respond to the followi.docx
HIT Management and Implementation  Please respond to the followi.docxHIT Management and Implementation  Please respond to the followi.docx
HIT Management and Implementation  Please respond to the followi.docxAbramMartino96
 
History and TheoryConsiderthe eras, life histories.docx
History and TheoryConsiderthe eras, life histories.docxHistory and TheoryConsiderthe eras, life histories.docx
History and TheoryConsiderthe eras, life histories.docxAbramMartino96
 
History of an argument Are there too many people There h.docx
History of an argument Are there too many people There h.docxHistory of an argument Are there too many people There h.docx
History of an argument Are there too many people There h.docxAbramMartino96
 
history essays- 1000 words each essay- mla and 2 works cited. every .docx
history essays- 1000 words each essay- mla and 2 works cited. every .docxhistory essays- 1000 words each essay- mla and 2 works cited. every .docx
history essays- 1000 words each essay- mla and 2 works cited. every .docxAbramMartino96
 
Historical Background of Housing PolicyHousing is one of the requi.docx
Historical Background of Housing PolicyHousing is one of the requi.docxHistorical Background of Housing PolicyHousing is one of the requi.docx
Historical Background of Housing PolicyHousing is one of the requi.docxAbramMartino96
 

More from AbramMartino96 (20)

Homework assignmentPlease annotate one artwork you like from this.docx
Homework assignmentPlease annotate one artwork you like from this.docxHomework assignmentPlease annotate one artwork you like from this.docx
Homework assignmentPlease annotate one artwork you like from this.docx
 
Homeland Security efforts are ably reinforced by Homeland Defense an.docx
Homeland Security efforts are ably reinforced by Homeland Defense an.docxHomeland Security efforts are ably reinforced by Homeland Defense an.docx
Homeland Security efforts are ably reinforced by Homeland Defense an.docx
 
Homecoming is an annual tradition in the United States. In this repo.docx
Homecoming is an annual tradition in the United States. In this repo.docxHomecoming is an annual tradition in the United States. In this repo.docx
Homecoming is an annual tradition in the United States. In this repo.docx
 
HomerAssignmentIIReadthreeofthebooksfromTheOdyss.docx
HomerAssignmentIIReadthreeofthebooksfromTheOdyss.docxHomerAssignmentIIReadthreeofthebooksfromTheOdyss.docx
HomerAssignmentIIReadthreeofthebooksfromTheOdyss.docx
 
Homelessness in America has been a problem since the settlement of t.docx
Homelessness in America has been a problem since the settlement of t.docxHomelessness in America has been a problem since the settlement of t.docx
Homelessness in America has been a problem since the settlement of t.docx
 
Homework Assignments One pagewhat the functional currency .docx
Homework Assignments One pagewhat the functional currency .docxHomework Assignments One pagewhat the functional currency .docx
Homework Assignments One pagewhat the functional currency .docx
 
Homework Assignment Company Research  This assignment req.docx
Homework Assignment Company Research  This assignment req.docxHomework Assignment Company Research  This assignment req.docx
Homework Assignment Company Research  This assignment req.docx
 
Homework Assignment #1Directions Please answer each of the foll.docx
Homework Assignment #1Directions Please answer each of the foll.docxHomework Assignment #1Directions Please answer each of the foll.docx
Homework Assignment #1Directions Please answer each of the foll.docx
 
Homework Assignment 9Due in week 10 and worth 30 pointsSuppose t.docx
Homework Assignment 9Due in week 10 and worth 30 pointsSuppose t.docxHomework Assignment 9Due in week 10 and worth 30 pointsSuppose t.docx
Homework Assignment 9Due in week 10 and worth 30 pointsSuppose t.docx
 
Homework Assignment 4 Guidelines1. Write the paper in Microsoft Wo.docx
Homework Assignment 4 Guidelines1. Write the paper in Microsoft Wo.docxHomework Assignment 4 Guidelines1. Write the paper in Microsoft Wo.docx
Homework Assignment 4 Guidelines1. Write the paper in Microsoft Wo.docx
 
Hi we are a group doing a research and we split up the work ev.docx
Hi we are a group doing a research and we split up the work ev.docxHi we are a group doing a research and we split up the work ev.docx
Hi we are a group doing a research and we split up the work ev.docx
 
hi I need research paper  about any topics in Manufacturing Proc.docx
hi I need research paper  about any topics in Manufacturing Proc.docxhi I need research paper  about any topics in Manufacturing Proc.docx
hi I need research paper  about any topics in Manufacturing Proc.docx
 
HMIS Standards  Please respond to the followingFrom the e-A.docx
HMIS Standards  Please respond to the followingFrom the e-A.docxHMIS Standards  Please respond to the followingFrom the e-A.docx
HMIS Standards  Please respond to the followingFrom the e-A.docx
 
Hi i need a paper about (Head On )German film ( Turkey part)3 to.docx
Hi i need a paper about (Head On )German film ( Turkey part)3 to.docxHi i need a paper about (Head On )German film ( Turkey part)3 to.docx
Hi i need a paper about (Head On )German film ( Turkey part)3 to.docx
 
Hi i have new work can you do it, its due in 6 hours Boyd, Ga.docx
Hi i have new work can you do it, its due in 6 hours Boyd, Ga.docxHi i have new work can you do it, its due in 6 hours Boyd, Ga.docx
Hi i have new work can you do it, its due in 6 hours Boyd, Ga.docx
 
HIT Management and Implementation  Please respond to the followi.docx
HIT Management and Implementation  Please respond to the followi.docxHIT Management and Implementation  Please respond to the followi.docx
HIT Management and Implementation  Please respond to the followi.docx
 
History and TheoryConsiderthe eras, life histories.docx
History and TheoryConsiderthe eras, life histories.docxHistory and TheoryConsiderthe eras, life histories.docx
History and TheoryConsiderthe eras, life histories.docx
 
History of an argument Are there too many people There h.docx
History of an argument Are there too many people There h.docxHistory of an argument Are there too many people There h.docx
History of an argument Are there too many people There h.docx
 
history essays- 1000 words each essay- mla and 2 works cited. every .docx
history essays- 1000 words each essay- mla and 2 works cited. every .docxhistory essays- 1000 words each essay- mla and 2 works cited. every .docx
history essays- 1000 words each essay- mla and 2 works cited. every .docx
 
Historical Background of Housing PolicyHousing is one of the requi.docx
Historical Background of Housing PolicyHousing is one of the requi.docxHistorical Background of Housing PolicyHousing is one of the requi.docx
Historical Background of Housing PolicyHousing is one of the requi.docx
 

Recently uploaded

General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 

Recently uploaded (20)

General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 

Mcq 15-20Q15Which of the following trees are binary search tr

  • 1. Mcq 15-20 Q15: Which of the following trees are binary search trees? . all of them Q16: Which of the following trees are binary search trees? . all of them Q17: . all of them Q18: It is forbidden to place both private and abstract in front of a method declaration. . true . false Q19: Consider the binary search tree below: What is the post-order path of this binary search tree? Remember this in the post-order walk: First, we go through the left subtree. Then we cross the right subtree. Finally, we visit the root. Q20: Consider the following two classes: After executing the code, we will have the following display:
  • 2. Mcqs 7- ? Q7: Suppose A is an interface, B is a class that realizes interface A, and C is a class that extends class B. Consider the following code: Which of the test () method statements will print true to standard output? Reminder: The java.lang.Object.getClass () method returns the runtime class of an object. Q8: Which ArrayList declaration is appropriate for a list that contains values of type float? Q9: What does the following method do in the context of a simply linked list? . The method removes all nodes from the linked list. . The method traverses the linked list without modifying it. . The method reverses the linked list. . The method removes every other node from the linked list. Q10: Suppose we have a single-linked sorted list whose nodes contain integer values. What is the mystery () method for in the following code snippet? Question 10 options: .The method removes every other node from the linked list. .This method removes duplicates from the linked lis .The method traverses the linked list without modifying it. Q11:
  • 3. Complete lines 27 and 28 of the following implementation (blanks 1 and 2) so that addLast (E value) adds a value to the end (back) of the doubly linked list. Q12: Consider the following doubly linked list. The values saved in the list are integers. Now, suppose we run the tweak () method, shown below, on this doubly linked list. Starting from the node designated by head, how will the values of the nodes be read after executing tweak ()? Q13: Consider a simply linked list. We want to write a private recursive method, E size (Node <E> current), to calculate the size of the list starting with the node designated by head via the public E size () method (also shown in the snippet below). Which of the following choices corresponds to a correct implementation of the E size (Node <E> current) method? Q13 options : Q14: The following List interface declares a subset of the methods of the java.util.List interface. public interface List <E> { void add ( int index , E elem ) ; E remove (int index ) ; boolean remove (E obj ) ; int size ( ) ; boolean isEmpty ( ) ; //autres méthodes }
  • 4. For implementing this interface using an array, ArrayList. Question 14 options: .Insertions at intermediate positions in the list are always quick. .Removing an item is always quick. .Consulting the intermediate positions of the list is always fast. .none of the above Q15: Consider the following simply chained list (the values stored in the list are of type String). What values will be stored in the list read from left to right after calling the mystery (head, "C") method, shown below, from the list above? Mcqs : Q1: Suppose we have a queue q (front to back: 2, 4, 6, 8, 10) and an initially empty stack s. We remove the elements from the queue q one at a time and add them to s, until q becomes empty. Next, we remove the elements from s one by one and put them in queue q, until s becomes empty. What does q (front to back) look like now? Q2: Consider an implementation of a queue based on a circular table. Suppose we set the maximum capacity of the queue to 5, or MAX_QUEUE_SIZE = 5. In other words, the underlying array will have 5 elements, indexed 0, 1, 2, 3, 4. We define the queue as follows : CircularArrayQueue <String> queue = new CircularArrayQueue
  • 5. <String> (); Suppose the queue front variable is initially set to 0, as shown below. What will be the internal state of the array in the queue after executing the following sequence of operations? queue.enqueue("X");queue.enqueue("Z");queue.enqueue("S");qu eue.dequeue();queue.enqueue("V");queue.dequeue();queue.enqu eue("C");queue.enqueue("N");queue.dequeue(); Q3: Either the following code: Which of the following options is correct? Question 3 options: This code is correct (it can be compiled and executed) This code is not correct (it cannot be compiled and executed) Q4: What is the result of the following program? Q5: What is the result of the following program? Q6: What is the result of the following program?
  • 6. Iterator2.javaIterator2.javapublicinterfaceIterator<T>{ boolean hasNext(); T next(); } java exam Programm 2.docx Programm 2 : Q26: For this question, you are going to write a program that transforms a given two-dimensional array (Matrix) of objects (generic type E) into a linked grid-like structure. You will then implement some operations as well as an iterator on the resulting linked structure. Below, we illustrate the transformation for a two-dimensional array of integer objects (ie Integer [] []). Each node in the grid is an instance of the Node (nested) class, shown below. Each Node instance points to two other Node instances: the node immediately to its right (right) and the node immediately below (down). Grid lines end with a right null pointer; columns end with a null pointer down, as shown above. The grid has a perfectly rectangular shape; there are no missing nodes in the grid structure. Complete the implementation of the LinkedGrid class by writing the methods requested in the questions that follow. The first part of the class is below. Otherwise the complete class is in the attached file in prohramme2: LinkedGrig.java. /*Class LinkedGrid */ import java.util.NoSuchElementException; public class LinkedGrid<E> { /* Nested Node class */
  • 7. public static class Node<T> { private T data; private Node<T> right, down; Node(T data, Node<T> right, Node<T> down) { this.data = data; this.right = right; this.down = down; } public T getData() { return data;} public Node<T> getRight(){ return right; } public Node<T> getDown(){ return down;} } /*Instance variables*/ private Node<E> topLeft; //first element of the grill private int rowCount, columnCount; // number of rows and number of columns /* The rest is in the attached file in program2*/ } Question 1) Complete the int getRowCount () method which returns the number of rows of the grid in the space below /*Instance methods*/ /*Returns the number of rows */ public int getRowCount() { Votre ligne du code vient ici } Note for files provided attached in program 2: You are provided with three files attached in program2: LinkedGrid.java, the Iterator.java interface, and the Q2Test.java test code to test your programs. We have provided you with a Template implementation that includes: (1) the declaration of the Node class (shown above),
  • 8. (2) the signatures of the methods you need to implement in Q26-Q33, (3) the skeleton code (y including the Iterator interface) for the LinkedGridIterator class in Q33, (4) the full implementation of the constructor for a single row grid (LinkedGrid (E [] array)), (5) the full implementation of the toString method () for LinkedGrid, and (6) a Q1Test class that allows you to test your implementation. Q27: For the LinkedGrid class from question 26, Implement the method in the space below, int getColumnCount(): returns the number of columns in the grid /* Returns the number of columns in the grid */ public int getColumnCount () { Your line of code comes here } Q28: For the LinkedGrid class from question 26, Implement the method, boolean isEmpty(): renvoie true si la grille est vide /* Returns true if the grid is empty */ public boolean isEmpty() { Your line of code comes here } Q29: For the LinkedGrid class from question 26, Implement the method, Node<E> getTopLeft(): returns the first element of the grid /* Returns the first element of the grid */ public Node<E> getTopLeft(){ Your line of code comes here
  • 9. } Q30: For the LinkedGrid class from question 26, Implement the method, E getElementAt (int row, int column): This method returns the object stored in row i and column j. For example, calling getElementAt (1, 2) on our illustrative integer grid will return an Integer instance with the value 5. /* Returns the object stored at row i and column j */ public E getElementAt(int row, int column) { if (row < 0 || row >= rowCount || column < 0 || column >= columnCount) throw new IllegalArgumentException("The both parameters have to be within range"); Node<E> current = topLeft; Your piece of the code comes here return current.data; } Q31: For the LinkedGrid class from question 26, Implement the method, void addFirstRow(E[] array); /* create and add the first row of the grid */ private void addFirstRow(E[] array) { if (!isEmpty()) throw new IllegalStateException("Grid must be empty to add a first row");
  • 10. topLeft = new Node<E>(array[0], null, null); Node<E> current = topLeft; Your piece of the code comes here } When this method is called (by the LinkedGrid constructor), the first row of the grid is created and the topLeft instance variable in LinkedGrid is made to point to the first node of that row. The expected behavior of the method is illustrated in the figure below. Additionally, the method should set rowCount instance variables and columnCount in LinkedGrid (index: rowCount should be set to 1 and columnCount should be set to array.length). Q32: For the LinkedGrid class of question 26, complete the method void addRow(E[] array) ; Add a line at the bottom of the grid When called, this method adds a new row at the bottom of an existing grid. This behavior is illustrated in the figure below. Note that the addRow (E [] array) method can be called iteratively, with each call adding a row to the bottom of the grid. To create the entire grid in our illustration, addRow must be called twice, once with [3; 4; 5] as parameter then with [6; 7; 8] as a parameter. Note that the first row (ie [0; 1; 2]) must have been added beforehand by calling addFirstRow (array E []) expanded in Q31. Calling addRow (array E []) should increase the columnCount instance variable by one. /* Add a line at the bottom of the grid */ public void addRow(E[] array) { if (array == null) throw new NullPointerException("array cannot be null"); if (rowCount == 0) throw new IllegalStateException("Need to
  • 11. add first row first"); if (array.length != this.columnCount) throw new IllegalArgumentException("array must contain " + this.columnCount + " elements"); Node<E> prev = topLeft; while(prev.down != null) prev = prev.down; Node<E> current = new Node<E>(array[0], null, null); prev.down = current; Your piece of the code comes here } Q33/ Class LinkedGridIterator: Complete the LinkedGridIterator () parameterless constructor of the LinkedGridIterator class for initialization (of currentIterator, headRow). //constructor public LinkedGridIterator() { Your line of code comes here } LinkedGrid.javaLinkedGrid.javaimport java.util.NoSuchElemen tException; publicclassLinkedGrid<E>{ publicstaticclassNode<T>{ private T data; privateNode<T> right, down; Node(T data,Node<T> right,Node<T> down){ this.data = data; this.right = right;
  • 12. this.down = down; } public T getData(){return data;} publicNode<T> getRight(){return right;} publicNode<T> getDown(){return down;} } privateNode<E> topLeft; privateint rowCount, columnCount; publicLinkedGrid(E[] array){ if(array ==null) thrownewNullPointerException("array cannot be null"); if(array.length ==0) thrownewIllegalArgumentException("array must contain elemen ts"); addFirstRow(array); } privatevoid addFirstRow(E[] array){ if(!isEmpty()) thrownewIllegalStateException("Grid must be empty to add a fir st row"); // Add your code here thrownewUnsupportedOperationException("not implemented yet !"); } publicvoid addRow(E[] array){ if(array ==null)
  • 13. thrownewNullPointerException("array cannot be null"); if(rowCount ==0) thrownewIllegalStateException("Need to add first row first"); if(array.length !=this.columnCount) thrownewIllegalArgumentException("array must contain contain "+this.columnCount +" elements"); // Add your code here thrownewUnsupportedOperationException("not implemented yet !"); } publicLinkedGrid(E[][] array){ if(array ==null) thrownewNullPointerException("array cannot be null"); thrownewUnsupportedOperationException("not implemented yet !"); } publicint getRowCount(){ // Add your code here } publicint getColumnCount(){ // Add your code here } publicboolean isEmpty(){ // Add your code here }
  • 14. publicNode<E> getTopLeft(){ // Add your code here } public E getElementAt(int row,int column){ if(row <0|| row >= rowCount || column <0|| column >= column Count) thrownewIllegalArgumentException("The row and column para meters both have to be within range"); // Add your code here thrownewUnsupportedOperationException("not implemented yet !"); } publicString toString(){ StringBuffer buffer =newStringBuffer(); for(int i =0; i < rowCount; i++){ for(int j =0; j < columnCount; j++){ buffer.append(getElementAt(i, j)); if(j < columnCount -1) buffer.append(", "); } if(i < rowCount -1) buffer.append(System.lineSeparator()); } return buffer.toString(); } privateclassLinkedGridIteratorimplementsIterator<E>{
  • 15. privateNode<E> currentIterator, headRow; publicLinkedGridIterator(){ // Add your code here } public E next(){ thrownewUnsupportedOperationException("not implemented yet !"); } publicboolean hasNext(){ thrownewUnsupportedOperationException("not implemented yet !"); } } publicIterator<E> iterator(){ returnnewLinkedGridIterator(); } } Q2Test.javaQ2Test.javapublicclassQ2Test{ publicstaticvoid test(){ Integer[] integerFirstRow ={0,1,2}; Integer[] integerSecondRow ={3,4,5}; Integer[] integerThirdRow ={6,7,8}; LinkedGrid<Integer> integerGrid =newLinkedGrid<Integer>(int egerFirstRow); integerGrid.addRow(integerSecondRow);
  • 16. integerGrid.addRow(integerThir dRow); System.out.println("==== Integer grid with "+ integerGrid.getR owCount()+ " rows x "+ integerGrid.getColumnCount()+" columns ===="); System.out.println("[Test LinkedGrid(E[] array) / addFirstRow(. ..) and addRow(...)]"); System.out.println("getTopLeft().getData(): "+ integerGrid.getT opLeft().getData()); System.out.println("getTopLeft().getRight().getRight().getDown ().getData(): "+ integerGrid.getTopLeft().getRight().getRight(). getDown().getData()); System.out.println("getTopLeft().getDown().getDown().getData (): "+ integerGrid.getTopLeft().getDown().getDown().getData() ); System.out.println("getTopLeft().getDown().getRight().getDow n().getRight().getData(): "+ integerGrid.getTopLeft().getDown( ).getRight().getDown().getRight().getData()); System.out.println(); System.out.println("[Test getElementAt(...)] Print integer grid v ia toString() which uses getElementAt(...)"); System.out.println(integerGrid); System.out.println(); System.out.println("[Test LinkedGridIterator] Grid via an iterat or"); Iterator<Integer> iIterator = integerGrid.iterator(); StringBuffer iBuffer =newStringBuffer(); System.out.println(); } publicstaticvoid main(String[] args){ test();
  • 17. } } /**************************SORTIE QUE VOUS DEVEZ A VOIR :********************** ==== Integer grid with 3 rows x 3 columns ==== [Test LinkedGrid(E[] array) / addFirstRow(...) and addRow(...)] getTopLeft().getData(): 0 getTopLeft().getRight().getRight().getDown().getData(): 5 getTopLeft().getDown().getDown().getData(): 6 getTopLeft().getDown().getRight().getDown().getRight().getDat a(): 8 [Test getElementAt(...)] Print integer grid via toString() which uses getElementAt(...) 0, 1, 2 3, 4, 5 6, 7, 8 [Test LinkedGridIterator] Grid via an iterator **************************************************** * ***************************/ Java exam.docx Java exam: Part 2 : Programming questions : Two programs to be developed: Note that the two programs are independent; program 1 (Q21-25) and program 2 (Q26-33)
  • 18. Files for testing (Q1Test.java and Q2Test.java) are provided to you and are attached in program 1 and program 2 respectively, along with the interfaces and sketches of the corresponding classes. Program 1 : Q 21: For this question we develop a queue modeling using a simply linked list of objects (of generic type D). So there is an interface, named Queue, which is provided to you, as well as a simple, named, LinkedQueue implementation that you are going to make. The LinkedQueue class realizes the Queue interface, it must provide an implementation for all the methods of the interface: LinkedQueue () : constructeur sans paramètre boolean isEmpty() : renvoie true si la file (LinkedQueue) est vide void enqueue(D newElement): empiler la file (Insérer un élément (newElement )) D dequeue() : dépiler la file (retirer un élément et le renvoyer) /* Classe LinkedQueue */ public class LinkedQueue<D> implements Queue<D> { //nested class private static class Elem<T> { private T value; private Elem<T> next; private Elem(T value, Elem<T> next) { this.value = value; this.next = next; } } //Instance variables private Elem<D> front; private Elem<D> rear;
  • 19. //...la suite est dans le programme LinkedQueue.java fourni ci- joint dans programme 1 } Question 1: For this LinkedQueue class, implement the parameterless constructor for initialization, in the space below /* Constructor*/ public LinkedQueue () ){ Note for the files provided attached in program 1: THREE FILES ARE ATTACHED IN PROGRAM 1: Queue.java, LinkedQueue.java and Q1Test.java for testing. We have provided you with an implementation that includes: (1) the declaration of the Elem class (shown above), (2) the signatures of the methods you need to implement in Q21-Q25, (3) the skeleton code (including the Queue interface) for the LinkedQueue class, (4) the full implementation of the toString () method for LinkedQueue, (5) the skeleton code of the UniquifiableLinkedQueue class for Q25, and a Q1Test class that allows you to test your implementation . Q22 : For the LinkedQueue class from question 21, implement the boolean isEmpty () method which returns true if the queue is empty, in the space below. / * returns true if the queue is empty * / public boolean isEmpty(){ Q23 : For the LinkedQueue class from question 21, implement the void enqueue (D newElement) method to stack the queue. /* stack the queue */ public void enqueue(D newElement){ if(newElement == null) { throw new NullPointerException("no null object in my
  • 20. queue !"); } Elem<D> newElem; newElem = new Elem<D>(newElement,null); Your piece of the code comes here } Q24: For the LinkedQueue class from question 21, implement the D dequeue () method to unstack the queue. /* unstack the queue (remove an item and send it back)*/ public D dequeue() { if(isEmpty()) { throw new IllegalStateException("method called on an empty queue"); } D returnedValue; returnedValue = front.value; Your piece of the code comes here } Q25: For this question, you are going to develop a specialization (subclass) of LinkedQueue. The subclass, named UniquiableLinkedQueue, provides a single additional method, named uniquify (). The uniquify () method does the following: It returns a queue that is the same UniquifiableLinkedQueue instance that the method is called for, except that the returned queue does not contain any immediately consecutive duplicate items.
  • 21. To illustrate what "immediately consecutive duplicate elements" are, consider the following example queue: More precisely, two queue items are immediately consecutive duplicate items, when they are adjacent and have identical content. Having identical content for the (non-zero) queue elements elem1 and elem2 means that elem1.equals (elem2) is true. You can assume that all items in the queue are not null. You complete the uniquify () method in the UniquifiableLinkedQueue class below, so that a single instance of immediately consecutive duplicate items would be kept. For example, if uniquify () is called on the example file above (an instance of UniquifiableLinkedQueue <String>), the result should be as shown in the figure below. Note that uniquify () is not intended to handle non-consecutive duplicate items. In other words, the queue returned by uniquify () may have duplicate items. You can make calls to the preceding enqueue and dequeue methods. To test your implementation of uniquify (), you can use the provided Q1Test.java code. The output from executing Q1Test should be the same as that in the test code. /*Class UniquifiableLinkedQueue*/ public class UniquifiableLinkedQueue <E> extends LinkedQueue<E> { /*uniquify method*/ public Queue<E> uniquify ( ) { Queue<E> result = new LinkedQueue<E>(); Queue<E> temp = new LinkedQueue<E>(); Your piece of the code comes here
  • 22. return(result); } } LinkedQueue.javaLinkedQueue.javapublicclassLinkedQueue<D >implementsQueue<D>{ privatestaticclassElem<T>{ private T value; privateElem<T> next; privateElem(T value,Elem<T> next){ this.value = value; this.next = next; } } privateElem<D> front; privateElem<D> rear; publicLinkedQueue(){ // Add your code here } publicboolean isEmpty(){ // Add your code here } publicvoid enqueue(D newElement){ if(newElement ==null){ thrownewNullPointerException("no null object in my queue !");
  • 23. } Elem<D> newElem; newElem =newElem<D>(newElement,null); // Add your code here } public D dequeue(){ if(isEmpty()){ thrownewIllegalStateException("Dequeue method called on an e mpty queue"); } D returnedValue; returnedValue = front.value; // Add your code here } publicString toString(){ String result ="Front -> ["; if(!isEmpty()){ Elem<D> p = front; result += p.value; while(p.next !=null){ p = p.next; result +=", "+ p.value; } } result +="] <- Rear"; return result; }
  • 24. } Q1Test.javaQ1Test.javapublicclassQ1Test{ publicstaticvoid main(String[] args){ UniquifiableLinkedQueue<Integer> integerQueue =newUniquifi ableLinkedQueue<Integer>(); integerQueue.enqueue(0); integerQueue.enqueue(1); integerQueue.enqueue(1); integerQueue.enqueue(1); integerQueue.enqueue(2); integerQueue.enqueue(2); integerQueue.enqueue(3); integerQueue.enqueue(3); integerQueue.enqueue(3); integerQueue.enqueue(4); System.out.println("Original Integer Queue: "+ integerQueue); System.out.println("Integer Queue without immediately consecu tive duplicates: "+ integerQueue.uniquify()); System.out.println("Original Integer Queue (after uniquify): "+ integerQueue); System.out.println(); UniquifiableLinkedQueue<String> stringQueue =newUniquifiab leLinkedQueue<String>(); stringQueue.enqueue("a"); stringQueue.enqueue("a"); stringQueue.enqueue("b"); stringQueue.enqueue("b"); stringQueue.enqueue("b"); stringQueue.enqueue("c");
  • 25. stringQueue.enqueue("d"); stringQueue.enqueue("d"); stringQueue.enqueue("d"); stringQueue.enqueue("e"); stringQueue.enqueue("e"); System.out.println("Original String Queue: "+ stringQueue); System.out.println("String Queue without immediately consecut ive duplicates: "+ stringQueue.uniquify()); System.out.println("Original String Queue (after uniquify): "+ s tringQueue); System.out.println(); System.out.println("---- Now, testing with some non- consecutive duplicates ----- "); System.out.println(); UniquifiableLinkedQueue<String> stringQueueWithNonConsec utiveDuplicates =newUniquifiableLinkedQueue<String>(); stringQueueWithNonConsecutiveDuplicates.enqueue("a"); stringQueueWithNonConsecutiveDuplicates.enqueue("b"); stringQueueWithNonConsecutiveDuplicates.enqueue("b"); stringQueueWithNonConsecutiveDuplicates.enqueue("c"); stringQueueWithNonConsecutiveDuplicates.enqueue("a"); stringQueueWithNonConsecutiveDuplicates.enqueue("d"); stringQueueWithNonConsecutiveDuplicates.enqueue("d"); stringQueueWithNonConsecutiveDuplicates.enqueue("e"); stringQueueWithNonConsecutiveDuplicates.enqueue("e"); stringQueueWithNonConsecutiveDuplicates.enqueue("d"); stringQueueWithNonConsecutiveDuplicates.enqueue("d"); stringQueueWithNonConsecutiveDuplicates.enqueue("d"); stringQueueWithNonConsecutiveDuplicates.enqueue("d"); stringQueueWithNonConsecutiveDuplicates.enqueue("b"); System.out.println("Original String Queue: "+ stringQueueWith
  • 26. NonConsecutiveDuplicates); System.out.println("String Queue without immediately consecut ive duplicates: "+ stringQueueWithNonConsecutiveDuplicates.uniquify()); System.out.println("Original String Queue (after uniquify): "+ s tringQueueWithNonConsecutiveDuplicates); } } /**************************SORTIE QUE VOUS DEVEZ A VOIR :********************** Original Integer Queue: Front -> [0, 1, 1, 1, 2, 2, 3, 3, 3, 4] <- Rear Integer Queue without immediately consecutive duplicates: Fron t -> [0, 1, 2, 3, 4] <- Rear Original Integer Queue (after uniquify): Front - > [0, 1, 1, 1, 2, 2, 3, 3, 3, 4] <- Rear Original String Queue: Front -> [a, a, b, b, b, c, d, d, d, e, e] <- Rear String Queue without immediately consecutive duplicates: Front -> [a, b, c, d, e] <- Rear Original String Queue (after uniquify): Front - > [a, a, b, b, b, c, d, d, d, e, e] <- Rear ---- Now, testing with some non-consecutive duplicates ----- Original String Queue: Front - > [a, b, b, c, a, d, d, e, e, d, d, d, d, b] <- Rear String Queue without immediately consecutive duplicates: Front -> [a, b, c, a, d, e, d, b] <- Rear
  • 27. Original String Queue (after uniquify): Front - > [a, b, b, c, a, d, d, e, e, d, d, d, d, b] <- Rear ***************************************************** ********/ Queue2.javaQueue2.javapublicinterfaceQueue<E>{ boolean isEmpty(); void enqueue(E newElement); E dequeue(); } UniquifiableLinkedQueue.javaUniquifiableLinkedQueue.javapu blicclassUniquifiableLinkedQueue<E>extendsLinkedQueue<E> { publicQueue<E> uniquify(){ // Add your code here thrownewUnsupportedOperationException("not implemented yet !"); } }