logo

Crowdly

Browser

Додати до Chrome

*Програмування на Jаvа

Шукаєте відповіді та рішення тестів для *Програмування на Jаvа? Перегляньте нашу велику колекцію перевірених відповідей для *Програмування на Jаvа в dl.nure.ua.

Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!

Which of the following lines can be inserted to make the code compile? (Choose all that apply.)

class A {}

class B extends A {}

class C extends B {}

class D<C> {

// INSERT CODE HERE

}

0%
100%
0%
100%
0%
0%
Переглянути це питання

What changes need to be made to make the following singleton pattern correct? (Choose all that apply.)

public class CheetahManager {

public static CheetahManager cheetahManager;

private CheetahManager() {}

public static CheetahManager getCheetahManager() {

if(cheetahManager == null) {

cheetahManager = new CheetahManager();

}

return cheetahManager;

}

}

100%
0%
0%
100%
0%
0%
Переглянути це питання

Assuming MyTask is an abstract class that implements the ForkJoinTask interface, what statements about the following code are true? (Choose all that apply.)

import java.util.concurrent.*;

public class FindMin extends MyTask {

private Integer[] elements;

private int a;

private int b;

public FindMin(Integer[] elements, int a, int b) {

this.elements = elements;

this.a = a;

this.b = b;

}

public Integer compute() {

if ((b—a) < 2)

return Math.min(elements[a], elements[b]);

else {

int m = a + ((b—a) / 2);

System.out.println(a + "," + m + "," + b);

MyTask t1 = new FindMin(elements, a, m);

int result = t1.fork().join();

return Math.min(new FindMin(elements, m, b).compute(), result);

}

}

public static void main(String[] args) throws InterruptedException,

ExecutionException {

Integer[] elements = new Integer[] { 8, -3, 2, -54 };

MyTask task = new FindMin(elements, 0, elements.length—1);

ForkJoinPool pool = new ForkJoinPool(1);

Integer sum = pool.invoke(task);

System.out.println("Min: " + sum);

}

}

0%
100%
100%
100%
0%
100%
Переглянути це питання

What is the output of the following code?

1: public class ArithmeticSample {

2: public static void main(String[] args) {

3: int x = 5 * 4 % 3;

4: System.out.println(x);

5: }}

0%
0%
100%
0%
0%
Переглянути це питання

Which of the following are valid Callable expressions? (Choose all that apply.)

100%
100%
0%
0%
0%
100%
0%
Переглянути це питання

Which of the following are true? (Choose all that apply)

public class Bunny {

 public static void main(String[] args) {

 Bunny bun = new Bunny();

} }

0%
100%
0%
0%
0%
100%
0%
Переглянути це питання

Which three scenarios would best benefit from using a singleton pattern? (Choose all three.)

100%
100%
0%
100%
0%
Переглянути це питання

What is output by the following code? (Choose all that apply)

1: public class Fish {

2: public static void main(String[] args) {

3: int numFish = 4;

4: String fishType = "tuna";

5: String anotherFish = numFish + 1;

6: System.out.println(anotherFish + " " + fishType);

7: System.out.println(numFish + " " + 1);

8: } }

0%
100%
0%
0%
0%
0%
Переглянути це питання

What changes need to be made to make the following immutable object pattern correct? (Choose all that apply.)

import java.util.List;

public class Seal {

String name;

private final List<Seal> friends;

public Seal(String name, List<Seal> friends) {

this.name = name;

this.friends = friends;

}

public String getName() { return name; }

public List<Seal> getFriends() { return friends; }

}

None; the immutable object pattern is properly implemented.

0%
100%
0%
0%
0%
100%
0%
0%
Переглянути це питання

What is the output of the following program?

1: public class WaterBottle {

2: private String brand;

3: private boolean empty;

4: public static void main(String[] args) {

5: WaterBottle wb = new WaterBottle();

6: System.out.print("Empty = " + wb.empty);

7: System.out.print(", Brand = " + wb.brand);

8: } }

0%
0%
0%
100%
0%
0%
Переглянути це питання

Хочете миттєвий доступ до всіх перевірених відповідей на dl.nure.ua?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome