CSCI 201L Final - Written Fall 2014 12% of Course Grade
CSCI 201L Final - Written Fall 2014 12% of Course Grade
Fall 2014
12% of course grade
1. Interfaces and Inheritance – Does the following code compile? If so, what is the
output? If not, why not? Explain your answer. (1.5%)
interface I2 {
public void meth1();
}
interface I1 extends I2 {
public void meth1();
}
class C1 implements I1 {
public void meth1() {
System.out.println("2");
}
}
class C2 extends C1 implements I2 {
public void meth1() {
System.out.println("1");
}
}
public class Question1 {
public static void main(String[] args) {
I1 i1 = new C1();
i1.meth1();
I2 i2 = new C2();
i2.meth1();
C1 c1 = new C2();
c1.meth1();
}
}
At home, you have DHCP enabled on your network. You forgot to change your static
IP address from work one day on your laptop when you got home, and you didn’t
have network access. You checked your other computer (which does have network
access), and you saw the IP address on your other computer on your home network
was 192.168.1.3 with no subnets. Explain why your laptop does not have network
access on your home network. (1.5%)
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
Here is a sample answer: The language of the client and server should be taken into
consideration. If both can be written in Java, RMI should be used. If they may be in
different languages, CORBA or Web Services should be used.