ExamVeda
Login
Home
31
Given the following piece of code:
public class School{
        public abstract double numberOfStudent();
}

which of the following statements is true?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
32
Which of the following class definitions defines a legal abstract class?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
33
Which of the following declares an abstract method in an abstract Java class?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
34
Which of the following statements regarding abstract classes are true?
Discuss
Answer & Solution
Answer: Option E
No explanation is given for this question. Let's Discuss on Board
35
Suppose A is an abstract class, B is a concrete subclass of A, and both A and B have a default constructor. Which of the following is correct?
1. A a = new A();
2. A a = new B();
3. B b = new A();
4. B b = new B();
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
36
Which of the following is a correct interface?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
37
Determine output of the following code.
interface A { }

class C { }

class D extends C { }

class B extends D implements A { }

public class Test extends Thread{
        public static void main(String[] args){
                B b = new B();
                if (b instanceof A)
                        System.out.println("b is an instance of A");
                if (b instanceof C)
                        System.out.println("b is an instance of C");
        }
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
38
Given the following piece of code:
public interface Guard{
        void doYourJob();
}
abstract public class Dog implements Guard{ }

which of the following statements is correct?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
39
In Java, declaring a class abstract is useful
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
40
What will be the output?
interface A{
	public void method();
}
class One{
	public void method(){
		System.out.println("Class One method");
	}
}
class Two extends One implements A{
	public void method(){
		System.out.println("Class Two method");
	}
}
public class Test extends Two{
	public static void main(String[] args){
		A a = new Two();
		a.method();		
	}
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board