
java-collections – programming-java – কুইজ মডেল টেস্ট অনুশীলন – 4
7774. What is the data type of out object
- final
- static final
- None of the above
- static
7775. Given a correctly compiled class whose source code is: package com.sun.sjcp; public class Commander { public static void main(String[] args) { // more code here } } Assume that the class file is located in /foo/com/sun/sjcp/, the current directory is /foo/, and that the classpath contains “.” (current directory). Which command line correctly runs Commander?
- java com.sun.sjcp.Commander
- java Commander
- java com/sun/sjcp/Commander
- java -cp com.sun.sjcp Commander
7776. Given: public abstract class Shape { private int x; private int y; public abstract void draw(); public void setAnchor(int x, int y) { this.x = x; this.y = y; } } Which class use the Shape class correctly?
- public class Circle implements Shape { private int radius; }
- public abstract class Circle extends Shape { private int radius; }
- None of above
- public class Circle extends Shape { private int radius; public void draw(); }
7777. Examine the following list: a. Stores key/value pairs. b. Allows null elements, keys, and values. c. Duplicate entries replace old entries. d. Entries are not sorted using a comparator or the Comparable interface. Which of these classes provides the specified features?
- HashMap
- LinkedHashMap
- LinkedList
- LinkedHashSet
7778. How can we return an object from a function?
- using object class.
- simply return object name.
- creating returntype as object and then returning object name
- none of the above
7779. Which collection class allows you to associate its elements with key values, and allows you to retrieve objects in FIFO (first-in, first-out) sequence?
- java.util.ArrayList
- java.util.LinkedHashMap
- java.util.HashMap
- java.util.TreeMap
7780. Which of these method Map class is used to
- set()
- look()
- search()
- get()
7781. Given: public class Drink implements Comparable { public String name; public int compareTo(Object o) { return 0; } } and: Drink one = new Drink(); Drink two = new Drink(); one.name= “Coffee”; two.name= “Tea”; TreeSet set = new TreeSet(); set.add(one); set.add(two); A programmer iterates over the TreeSet and prints the name of each Drink object. What is the result?
- Tea
- Coffee Tea
- Coffee
- Compilation fails.
7782. What type of data does BufferedReader, can read
- a character
- an array
- All of the above
- a complete line
7783. Given: String test = “a1b2c3”; String[] tokens = test.split(“\d”); for(String s: tokens) System.out.print(s + ” “); What is the result?
- abc
- a1b2c3
- a2b1c3
- 123
আমাদের কাছে থাকা লক্ষ লক্ষ মডেল টেস্ট থেকে প্রাকটিজের জন্য কিছু এখানে তুলে ধরা হল। প্রতিটি অধ্যায়ের উপরে ইশিখন.কম কুইজ চ্যালেঞ্জ এ আছে শত শত মডেল টেস্ট বার বার মডেল টেস্ট দিয়ে নিজেকে যাচাই কর এবং পুরো বাংলাদেশের সকল শিক্ষার্থীর সাথে আপনার মেধা তালিকা দেখুন। প্রশ্নে কোন প্রকার ভুল থাকলে সঠিক উত্তরসহ নিচে কমেন্ট করে জানাবেন, আমরা ঠিক করে দেবো।