Конструктор тестів
1
Which declares an abstract method in an abstract Java class?
Як оголошує абстрактний метод в абстрактному класі Java?
2
Which of the following statements are true?
Які з наступних тверджень вірні?
3
Which of the following are true about this method declaration?
Що з наведеного нижче вірно щодо цього оголошення методу?
void myMethod(String s) {
}
4
Which of the following may legally appear as the new type (between the parentheses) in a cast operation?
Що з наведеного нижче може законно відображатися як новий тип (між дужками) у приведенні operation?
5
Given the following MyWindowCloser class definition:
Дано таке визначення класу MyWindowCloser:
1. public abstract class MyWindowCloser {
2. protected abstract void closeWindow(String id);
3. }
which of the following methods could appear in a child class of MyWindowCloser ?
(Select three answers.)
який із наведених нижче методів може з’явитися в дочірньому класі MyWindowCloser?
(Виберіть три відповіді.)
6
What is the result of the following code? Що є результатом наступного коду?
1. public abstract class Catchable {
2. protected abstract void catchAnObject(Object x);
3.
4. public static void main(String [] args) {
5. java.util.Date now = new java.util.Date();
6. Catchable target = new MyStringCatcher();
7. target.catchAnObject(now);
8. }
9. }
10.
11. class MyStringCatcher extends Catchable {
12. public void catchAnObject(Object x) {
13. System.out.println(“Caught object”);
14. }
15.
16. public void catchAnObject(String s) {
17. System.out.println(“Caught string”);
18. }
7
What is the result of the following code?
1. public abstract class Book {
2. public abstract void read();
3.
4. public static void main(String [] args) {
5. Book book = new NonFictionBook();
6. book.read();
7. }
8. }
9.
10. class NonFictionBook extends Book {
11. public void read(int time) {
12. System.out.println(“Reading a NonFictionBook”);
13. }
14. }
8
What is the result of the following code?
1. public abstract class A {
2. private void doSomething() {
3. System.out.println(“A”);
4. }
5.
6. public static void main(String [] args) {
7. A a = new B();
8. a.doSomething();
9. }
10. }
11.
12. class B extends A {
13. protected void doSomething() {
14. System.out.println(“B”);
15. }
16.}
9
Which declare a compilable abstract class? (Choose all that apply.)
Як оголошують компільований абстрактний клас? (Виберіть усе, що підходить.)
10
Given:
2. abstract class Tool {
3. int SKU;
4. abstract void getSKU();
5. }
6. public class Hammer {
7. // insert code here
8. }
Which line(s), inserted independently at line 7, will compile? (Choose all that apply.)
Які рядки, вставлені незалежно в рядок 7, будуть скомпільовані? (Виберіть усе, що підходить.)
Рефлексія від 7 учнів
Сподобався:
Так: 2
Ні: 5
Зрозумілий:
Так: 2
Ні: 5
Потрібні роз'яснення:
Ні: 4
Так: 3