Gábor Drávecz
Quiz by , created more than 1 year ago

prof Prog2-2.gyak Quiz on Prog2-2.gyak, created by Gábor Drávecz on 10/04/2022.

315
0
0
Gábor Drávecz
Created by Gábor Drávecz about 2 years ago
Close

Prog2-2.gyak

Question 1 of 15

1

Melyik lehet összehasonlító(comparator)?

Select one of the following:

  • a. mindkettő

  • b. private boolean isEqual(Vehicle v1, Vehicle v2){ returnb v1.getAge() = v2.getAge()}

  • c. egyik sem

  • d. public boolean isEqual(Vehicle other) {return this.getAge() == v2.getAge()}

Explanation

Question 2 of 15

1

Melyik lehet összehasonlító(comparator)?

Select one of the following:

  • a. mindkettő

  • b. egyik sem

  • c. public boolean isEqual(Vehicle other) { return this.getAge() == v2.getAge()}

  • d. (v1, v2) -> Integer.compare(v1.getAge(), v2.getAge())

Explanation

Question 3 of 15

1

Melyik lehet összehasonlító(comparator)?

Select one of the following:

  • a. mindkettő

  • b. egyik sem

  • c. public Vehicle equals(Vehicle other) { return this.getAge() == other.getAge() ? this: other;}

  • d. public static int equals(Vehicle v1, Vehicle v2) { return Integer.compare(v1.getAge(), v2.getAge());}

Explanation

Question 4 of 15

1

Melyik lehet összehasonlító (comparator) ?

Select one of the following:

  • a. mindkettő

  • b. egyik sem

  • c. public Vehicle equals(Vehicle other) { return this.getAge() == other.getAge() ? this: other;}

  • d. private boolean isEqual(Vehicle v1, Vehicle v2) { return v1.getAge() == v2.getAge();}

Explanation

Question 5 of 15

1

Melyik lehet összehasonlító (comparator)?

Select one of the following:

  • a. public int equals(Vehicle v1, Vehicle v2) { return Integer.compare(v1.getAge(), v2.getAge());}

  • b. egyik sem

  • c. mindkettő

  • d. private boolean isEqual(Vehicle v1, Vehicle v2) { return v1.getAge() == v2.getAge();}

Explanation

Question 6 of 15

1

Mit tesz, ha egy Bar példányát, Foo és Baz független típusra is át kell alakítani?

Select one of the following:

  • a. a Bar, Foo, Baz interfészek

  • b. Bar, Foo, Baz osztálynak közös ős

  • c. class Bar implements Foo, Baz

  • d. class Bar extends Foo, Baz

Explanation

Question 7 of 15

1

Hogyan tilthatja a Foo osztály „int getValue()” metódusának felülírását?

Select one of the following:

  • a. private static int getValue()

  • b. public abstract int getValue()

  • c. public static int getValue()

  • d. public final int getValue()

Explanation

Question 8 of 15

1

Hogyan kényszerítheti a Foo osztály „int getValue()” metódusának felülírását leszármazottban?

Select one of the following:

  • a. private static int getValue()

  • b. public final int getValue()

  • c. public abstract int getValue()

  • d. public static int getValue()

Explanation

Question 9 of 15

1

Hogy jelöli az osztályt, ha ahhoz a tervezett elméleti modellben nem tartozhat példány?

Select one of the following:

  • a. static

  • b. final

  • c. extends

  • d. abstract

Explanation

Question 10 of 15

1

Class Bar<T> esetén melyik deklaráció érvényes?

Select one of the following:

  • a. Egyik sem

  • b. Mindkettő

  • c. public boolean compare(T other) {return other.getAge() == item.getAge();}

  • d. private T item

Explanation

Question 11 of 15

1

class Bar<T> esetén melyik deklaráció érvényes?

Select one of the following:

  • a. egyik sem

  • b. private T item

  • c. mindkettő

  • d. public boolean compare(T other) { return other == item;}

Explanation

Question 12 of 15

1

class Bar<T> esetén melyik deklaráció érvényes?

Select one of the following:

  • a. public boolean compare(T other) {return other.getAge() == item.getAge();}

  • b. mindkettő

  • c. private T item = new T();

  • d. egyik sem

Explanation

Question 13 of 15

1

class Bar<T> esetén melyik deklaráció érvényes?

Select one of the following:

  • a. public T getItem() { return item;}

  • b. mindkettő

  • c. private T item = new T();

  • d. egyik sem

Explanation

Question 14 of 15

1

class Bar<T> esetén melyik deklaráció érvényes?

Select one of the following:

  • e. public boolean compare(T other) {return other == item;}

  • f. mindkettő

  • g. private T item = new T();

  • h. egyik sem

Explanation

Question 15 of 15

1

class Bar<T, U> esetén melyik deklaráció érvényes?

Select one of the following:

  • i. private T item;

  • j. mindkettő

  • k. public T getItem(){ return item;}

  • l. egyik sem

Explanation

Question 16 of 15

1

Mi igaz a következőkre: „public class Test extends Bar implements Foo”

Select one of the following:

  • a. Bar és Foo interface

  • b. Bar és Foo osztály

  • c. Bar interface, Foo osztály

  • d. Bar osztály, Foo interface

Explanation

Question 17 of 15

1

Miként deklarálná egy generikus tároló metódusát, amely index szerint ad vissza egy elemet ?

Select one of the following:

  • a. public T getItem(int index)

  • b. public <T> getItem(int index)

  • c. public Storage<T> getItem(int index)

  • d. public int getItem(int index)

Explanation

Question 18 of 15

1

Melyik lehet összehasonlító (comparator) ?

Select one of the following:

  • a. (v1, v2) -> v1.getLicense().compareToIgnoreCase(v2.getLicense())

  • b. egyik sem

  • c. mindkettő

  • d. public static int equals(Vehicle v1, Vehicle v2){ return Integer.compare(v1.getAge(), V2.getAge();}

Explanation

Question 19 of 15

1

Melyik lehet összehasonlító (comparator)?

Select one of the following:

  • a. mindkettő

  • b. public static int equals(Vehicle v1, Vehicle v2) { return Integer.compare(v1.getAge(), v2.getAge());}

  • c. egyik sem

  • d. public int equals(Vehicle v1, Vehicle v2){ return Integer.compare(v1.getAge(), v2.getAge());}

Explanation

Question 20 of 15

1

A GameObject osztályban szükséges az IPlayer és az IWarrior interface-ek implementációja. Hogyan deklárálná az osztályt?

Select one of the following:

  • a. interface IPlayer, IWarrior extends class GameObject

  • b. public class GameObject extends IPlayer, IWarrior

  • c. public class GameObject implements IPlayer, IWarrior

  • d. public class GameObject extends IPlayer implements IWarrior

Explanation

Question 21 of 15

1

Mi igaz a következőre: „public interface Bar extends Foo”

Select one of the following:

  • a. Bar interface, Foo osztály

  • b. Bar és Foo osztály

  • c. Bar és Foo interface

  • d. Bar osztály, Foo interface

Explanation

Question 22 of 15

1

Mikor használhatja Bar osztály Foo szolgálátatását úgy, hogy nem függ tőle?

Select one of the following:

  • a. Class Foo<T extends Bar>;

  • b. Class Bar<T extends Baz>; és class Foo<T extends Baz>;

  • c. Class Bar<T extends Foo>;

  • d. Class Bar<T extends Baz> és class Foo implements Baz

Explanation

Question 23 of 15

1

Mikor függ Bar osztály Foo osztálytól?

Select one of the following:

  • a. class Foo<T extends Bar>

  • b. class Bar<T extends Baz> és class Foo<T extends Baz>;

  • c. class Bar<T extends Baz> és class Foo implements Baz

  • d. class Bar<T extends Foo>;

Explanation

Question 24 of 15

1

Hogyan kényszerítheti a Bar osztály „void setNumber(int number)” metódusának implementációját leszármazottban?

Select one of the following:

  • a. public final void setNumber(int number)

  • b. public static void setNumber(int number)

  • c. private static void setNumber(int number)

  • d. public abstract void setNumber(int number)

Explanation

Question 25 of 15

1

Hogyan akadályozná meg a Bar osztály példányosítását ?

Select one of the following:

  • a. public class Bar extends Object

  • b. public static class Bar

  • c. public abstract class Bar

  • d. public final class Bar

Explanation

Question 26 of 15

1

Miként deklarálna egy generikus tároló osztályt, hogy az csak a Vehicle-t és annak leszármazottait fogadja?

Select one of the following:

  • a. public class Storage<T> extends Vehicle

  • b. public class Storage extends Vehicle

  • c. public class Storage<T extends Vehicle>

  • d. public class Storage<T>

Explanation

Question 27 of 15

1

Mi igaz a Bar interface „int foo()” metódusára?

Select one of the following:

  • a. default láthatóságú és abstract

  • b. metódus törzs üres

  • c. public és abstract

  • d. public és final

Explanation