অণুজীব

 

java-oop – programming-java – কুইজ মডেল টেস্ট অনুশীলন – 12

7854. Given: abstract class AbstractIt { abstract float getFloat(); } public class AbstractTest extends AbstractIt { private float f1 = 1.0f; private float getFloat() { return f1; } } What is the result?

  1. Compilation succeeds
  2. Compilation fails because of an error at private float getFloat() { return f1; }
  3. An exception is thrown
  4. Compilation fails because of an error at abstract float getFloat();

7855. Given: public class Plant { private String name; public Plant(String name) { this.name = name; } public String getName() { return name; } } public class Tree extends Plant { public void growFruit() { } public void dropLeaves() { } } Which statement is true?

  1. The code will compile if public Plant() { Tree(); } is added to the Plant class.
  2. The code will compile if public Plant() { this(“fern”); } is added to the Plant class.
  3. The code will compile if public Tree() { Plant(); } is added to the Tree class.
  4. The code will compile without changes.

7856. Observe the following code class TestA { TestB b; TestA() { b = new TestB(this); } } class TestB { TestA a; TestB(TestA a) { this.a = a; } } class TestAll { public static void main (String args[]) { new TestAll().makeThings(); // …code continues on } void makeThings() { TestA test = new TestA(); } } Which statement is true in ‘// …code continues on’, before main completes?

  1. An exception is thrown at runtime.
  2. The object referenced by a is eligible for garbage collection.
  3. None of the above
  4. new TestAll().makeThings();’ causes a stack overflow.

7857. Which method(s) must a serializable class implement?

  1. No methods
  2. It must always implement both readObject and writeObjectIt must implement either readObject or writeObject
  3. or both
  4. depending upon the desired behaviorNone

7858. Given: public class GC { private Object o; private void doSomethingElse(Object obj) { o = obj; } public void doSomething() { Object o = new Object(); doSomethingElse(o); o = new Object(); doSomethingElse(null); o=null; } } When the doSomething method is called, after which line does the Object created in line – Object o = new Object(); become available for garbage collection?

  1. Line – o = new Object();
  2. Line – doSomethingElse(o);
  3. Line – Object o = new Object();
  4. Line – doSomethingElse(null);

7859. Which will compile and run without exception?

  1. private synchronized(this) void go() { /* code here */ }
  2. public synchronized void go() { /* code here */ }
  3. private synchronized Object o;
  4. void go() { synchronized() { /* code here */ }

7860. Given: int [] x= {1, 2, 3, 4, 5}; int y[] = x; System.out.println(y[2]); Which statement is true?

  1. Compilation will fail because of an error in first line.
  2. Last line will print the value 2.
  3. Compilation will fail because of an error in second line.
  4. Last line will print the value 3.

7861. Which property of Java allows the creation of hierarchical classifications?

  1. Robust
  2. Distributed
  3. Inheritance
  4. Interface

7862. What does a class hierarchy depict?

  1. It shows the same relationship as a family tree.
  2. It describes has a relationships.
  3. It describes kind of relationships.
  4. It shows the relationships between the classes in the form of an organization chart.

7863. What is the name of the method used to start a thread execution?

  1. resume();
  2. run();
  3. init();
  4. start();

আমাদের কাছে থাকা লক্ষ লক্ষ মডেল টেস্ট থেকে প্রাকটিজের জন্য কিছু এখানে তুলে ধরা হল। প্রতিটি অধ্যায়ের উপরে ইশিখন.কম কুইজ চ্যালেঞ্জ এ আছে শত শত মডেল টেস্ট বার বার মডেল টেস্ট দিয়ে নিজেকে যাচাই কর এবং পুরো বাংলাদেশের সকল শিক্ষার্থীর সাথে আপনার মেধা তালিকা দেখুন। প্রশ্নে কোন প্রকার ভুল থাকলে সঠিক উত্তরসহ নিচে কমেন্ট করে জানাবেন, আমরা ঠিক করে দেবো।

Leave a Reply

স্যার, কিভাবে আপনাকে সাহায্য করতে পারি?

Click one of our representatives below

Customer Support
Customer Support

Syeda Nusrat

I am online

I am offline

Technical Support
Technical Support

Ariful Islam Aquib

I am online

I am offline