ABCDEFGHIJKLMNOPQRSTUVWXYZAA
1
IDQuestionCodeType
2
1Which one of these is a proper definition of a class Car that cannot be sub-classed?
single
3
2What will the program print when compiled and run?// Consider the following interface definition:
interface Bozo{
int type = 0;
public void jump();
}


// Now consider the following class:

public class Type1Bozo implements Bozo{
public Type1Bozo(){
type = 1;
}

public void jump(){
System.out.println("jumping..."+type);
}

public static void main(String[] args){
Bozo b = new Type1Bozo();
b.jump();
}
}
single
4
3Given the following classes, what will be the output of compiling and running the class Truck?class Automobile{
public void drive() { System.out.println("Automobile: drive"); }
}

public class Truck extends Automobile{
public void drive() { System.out.println("Truck: drive"); }
public static void main (String args [ ]){
Automobile a = new Automobile();
Truck t = new Truck();
a.drive(); //1
t.drive(); //2
a = t; //3
a.drive(); //4
}
}
single
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100