java-oop – programming-java – কুইজ মডেল টেস্ট অনুশীলন – 11
7844. Given: public class Test { private static int[] x; public static void main(String[] args) { System.out.println(x[0]); } } What is the result?
- NullPointException at runtime
- 0
- null
- Compile Error
7845. You want a class to have access to members of another class in the same package. Which is the most restrictive access that accomplishes this objective?
- default access
- protected
- public
- private
7846. Which type of inheritance is not supported by java
- multilevel
- multiple
- single
- hierarchical
7847. Observe the following code interface Animal { void soundOff(); } class Elephant implements Animal { public void soundOff() { System.out.print1n(Trumpet); } } class Lion implements Animal { public void soundOff() { System.out.print1n(Roar); } } class Alpha1 { static Animal get(String choice) { if (choice.equalsIgnoreCase(meat eater) ) { return new Lion(); } else { return new Elephant(); }. } } Which compiles?
- Elephant e = new Alpha1();
- new Animal().soundOff();
- Lion l = Alpha1.get(meat eater);
- new Alpha1().get(veggie).soundOff();
7848. Given: int[] myArray = new int[] {1, 2, 3, 4, 5}; What allows you to create a list from this array?
- List myList = new ArrayList(myArray);
- List myList = Collections.fromArray(myArray);
- List myList = myArray.asList();
- List myList = Arrays.asList(myArray);
7849. Which of the following statements about virtual base classes is correct?
- It is used to provide multiple inheritance.
- It is used to allow multiple copies of base class in a derived class.
- It allows private members of the base class to be inherited in the derived class.
- It is used to avoid multiple copies of base class in derived class.
7850. Which will allow the class Thing to be instantiated using new Thing( )?
- public class Thing { public Thing(void) {} }
- None of the above
- public class Thing { }
- public class Thing { public Thing(String s) {} }
7851. When method is overridden , then by subclass object which class ‘s method is called
- subclass
- both
- super class
- none
7852. Given: public class NamedCounter { private final String name; private int count; public NamedCounter(String name) { this.name = name; } public String getName() { return name; } public void increment() { count++; } public int getCount() { return count; } public void reset() { count = 0; } } Which three changes should be made to adapt this class to be used safely by multiple threads?
- Do not declare getCount() using the synchronized keyword
- declare getName() using the synchronized keyword
- declare reset() using the synchronized keyword
- None of above
7853. Given: interface inter { int floot = 42; } public class test implements inter { public static void main(String args[]) { System.out.println(++floot); } } What happens when you attempt to compile and run this code?
- 43
- 0
- Compile Error
- 42
আমাদের কাছে থাকা লক্ষ লক্ষ মডেল টেস্ট থেকে প্রাকটিজের জন্য কিছু এখানে তুলে ধরা হল। প্রতিটি অধ্যায়ের উপরে ইশিখন.কম কুইজ চ্যালেঞ্জ এ আছে শত শত মডেল টেস্ট বার বার মডেল টেস্ট দিয়ে নিজেকে যাচাই কর এবং পুরো বাংলাদেশের সকল শিক্ষার্থীর সাথে আপনার মেধা তালিকা দেখুন। প্রশ্নে কোন প্রকার ভুল থাকলে সঠিক উত্তরসহ নিচে কমেন্ট করে জানাবেন, আমরা ঠিক করে দেবো।
0 responses on "java-oop - programming-java - কুইজ মডেল টেস্ট অনুশীলন - 11"