
java-collections – programming-java – কুইজ মডেল টেস্ট অনুশীলন – 3
7764. Suppose that you would like to create an instance of a new Map that has an iteration order that is the same as the iteration order of an existing instance of a Map. Which concrete implementation of the Map interface should be used for the new instance?
- The answer depends on the implementation of the existing instance.
- LinkedHashMap
- HashMap
- TreeMap
7765. Given: package test; class Target { public String name = “hello”; } What can directly access and change the value of the variable name?
- any class that extends Target
- any class
- only the Target class
- any class in the test package
7766. Which of the following statements about the hashcode() method are incorrect? Select all incorrect statements.
- The hashcode() method is required to return a positive int value.
- The value returned by hashcode() is used in some collection classes to help locate objects.
- All of the above
- Two new empty String objects will produce identical hashcodes.
7767. Which of the following package stores all the
- java.packages
- awt
- util
- lang
7768. Given: String csv = “Sue,5,true,3”; Scanner scanner = new Scanner( csv ); scanner.useDelimiter(“,”); int age = scanner.nextInt(); What is the result?
- Compilation fails.
- An exception is thrown at runtime.After last line
- the value of age is 5.After last line
- the value of age is 3.”;}}
7769. Which of the following statements is false about constructor?
- Constructor can be declared final.
- Constructor can take arguments.
- Constructor can be declared private
- executed in a program.
7770. Which statement is true for the class java.util.ArrayList?
- The elements in the collection are accessed using a unique key.
- The elements in the collection are ordered.
- The collection is guaranteed to be immutable.
- The elements in the collection are guaranteed to be unique.
7771. A programmer must create a generic class MinMax and the type parameter of MinMax must implement Comparable. Which implementation of MinMax will compile?
- class MinMax<E extends Comparable<E>> { E min = null; E max = null; public MinMax() {} public void put(E value) { /* store min or max */ }
- class MinMax<E implements Comparable<E>> { <E> E min = null; <E> E max = null; public MinMax() {} public <E> void put(E value) { /* store min or max */ }
- class MinMax<E implements Comparable<E>> { E min = null; E max = null; public MinMax() {} public void put(E value) { /* store min or max */ }
- class MinMax<E extends Comparable<E>> { <E> E min = null; <E> E max = null; public MinMax() {} public <E> void put(E value) { /* store min or max */ }
7772. Given: static void test() { try { String x = null; System.out.print(x.toString() + ” “); } finally { System.out.print(“finally “); } } public static void main(String[] args) { try { test(); } catch (Exception ex) { System.out.print(“exception “); } } What is the result?
- null
- null finally
- finally exception
- finally
7773. Which of the following is not a method of the Object class?
- notify()
- wait(long msecs)
- sleep(long msecs)
- notifyAll()
আমাদের কাছে থাকা লক্ষ লক্ষ মডেল টেস্ট থেকে প্রাকটিজের জন্য কিছু এখানে তুলে ধরা হল। প্রতিটি অধ্যায়ের উপরে ইশিখন.কম কুইজ চ্যালেঞ্জ এ আছে শত শত মডেল টেস্ট বার বার মডেল টেস্ট দিয়ে নিজেকে যাচাই কর এবং পুরো বাংলাদেশের সকল শিক্ষার্থীর সাথে আপনার মেধা তালিকা দেখুন। প্রশ্নে কোন প্রকার ভুল থাকলে সঠিক উত্তরসহ নিচে কমেন্ট করে জানাবেন, আমরা ঠিক করে দেবো।