Java first quiz...

Java first quiz...

Select the correct answer from the option .. please read question carefully before answer ..

published on November 10, 201438 responses 0 5.0★ / 5

An unchecked exception occurs in a method dosomething()
Should other code be added in the dosomething() method for it to compile and execute?

The Exception must be caught
The Exception must be declared to be thrown.
The Exception must be caught or declared to be thrown.
No other code needs to be added.

Given the code fragment:
interface SampleClosable {
public void close () throws java.io.IOException;
}
Which three implementations are valid?

public class Test implements SampleCloseable {
public void close() throws java.io.IOException {
/ / do something
}
}
public class Test implements SampleCloseable {
public void close() throws Exception {
/ / do something
}
}
public class Test implements SampleCloseable {
public void close() throws java.io.FileNotFoundException {
/ / do something
}
}
public class Test extends SampleCloseable {
public void close() throws java.IO.IOException {
/ / do something
}
}

public class SampleClass {
public static void main(String[] args) {
AnotherSampleClass asc = new AnotherSampleClass();
SampleClass sc = new SampleClass();
// TODO code application logic here
}
}
class AnotherSampleClass extends SampleClass {
}
Which statement, when inserted into line "// TODO code application logic here ", is valid change?

Select the two correct answers
asc = sc;
sc = asc;
asc = (object) sc;
asc = sc.clone ()

Given the code fragment:
System.out.println("Result: " + 2 + 3 + 5);
System.out.println("Result: " + 2 + 3 * 5);
What is the result?

Result: 10
Result: 25
Result: 235
Result: 215
Result: 215
Result: 215
Result: 10
Result: 30

Which code fragment is illegal?

class Base1 {
abstract class Abs1 { }}
abstract class Abs1 {
void doit () { }
}
class Basel {
abstract class Abs1 extends Basel {
abstract int var1 = 89;