Chuanzhi Java Collection + I/O knowledge testing, javaio

Source: Internet
Author: User
Tags comparable object serialization

Chuanzhi Java Collection + I/O knowledge testing, javaio

 

Set+ IOPart

A total of 40 multiple choice questions, each question 2.5 points. If multiple choice questions are incorrect, they are all wrong. Full right is the perfect score.

 

A) Map

B) Collection

C) List

D) Set

 

A) array structure

B) linked list Structure

C) hash table structure

D) Red/black tree structure

 

A) Fast Query

B) Fast addition and Deletion

C) elements are not repeated.

D) Natural sorting of Elements

 

A) thread synchronization

B) The thread is not synchronized.

C) Fast addition and Deletion

D) the bottom layer is the linked list structure.

A) The iterator is used to retrieve collection elements.

B) the return value of the hasNext () method of the iterator is boolean.

C) the List set has a special iterator.

D) The next () method returns the previous element in the set.

 

A) byte input stream

B) character input stream

C) print the stream

D) serialized stream

 

A) FileWriter

B) InputStreamReader

C) FileReader

D) BufferedReader

 

 

A) newLine () method writes a line feed.

B) The newLine () method has nothing to do with the operating system platform.

C) The newLine () method is a FileWiter class method.

D) The newLine () method is the BufferedWriter class method.

 

ArrayList <String> al = new ArrayList <String> ();

Al. add (true );

ALS. add (123 );

Al. add ("abc ");

System. out. println (al );

A) compilation failed.

B) [true, 123]

C) [true, 123, abc];

D) [abc];

 

10. Which of the following interfaces can be implemented to enable the serialization function () C

A) Runnable interface

B) Comparable Interface

C) Serializable Interface

D) Comparator Interface

 

11. The abstract base class of the byte output stream is ()

A) OutputStream class

B) InputStream class

C) Writer class

D) Reader class

 

12. The running result of the following program is () D

FileOutputStream fos = new FileOutputStream ("c: \ demo.txt ");

Fos. write ("abc ");

Fos. close ();

A) Create the demo.txt file on the C drive, but the file is empty.

B) Create the demo.txt file on the C drive and write the data abc.

C) append the existing file demo.txt on the c drive to abc.

D) Compilation failed

 

 

13. The method to store the keys in the Map Set to the Set is () C

A) entrySet ()

B) get ()

C) keySet ()

D) put ()

 

14. Which of the following statements about the difference between ArrayList and Vector is true? () B

A) ArrayList is thread-safe, and Vector is thread-unsafe.

B) The ArrayList is thread-safe and the Vector is thread-safe.

C) the bottom layer of ArrayList is the array structure and the bottom layer of Vector is the linked list structure.

D) the bottom layer of ArrayList is the linked list structure and the bottom layer of Vector is the array structure.

 

15. objects stored in the TreeSet set must have ()

A) The Comparable interface must be implemented.

B) main Method

C) get and set methods

D) the Serializable interface must be implemented.

 

16. The method for converting a set into an array is () C

A) asList ()

B) toCharArray ()

C) toArray ()

D) copy ()

 

17. Which of the following statements about enhanced for loops is false? ()

A) The enhancement for loop can traverse the Map set directly.

B) enhanced for loop operations can be performed on arrays.

C) Enhance the for loop to operate Collection Sets

D) The enhancement for loop is generated after JDK1.5.

 

18. Which of the following statements about the HashMap set is true? () C

A) The underlying layer is an array structure.

B) the bottom layer is the linked list structure.

C) the null value and the null key can be stored.

D) The null Value and null key cannot be stored.

 

19. Which of the following statements about the binarySearch () method in the Collections tool class is true? () B

A) The binarySearch () method can only operate on Set sets.

B) The binarySearch () method can only operate on List sets.

C) The binarySearch () method can only operate on Map sets.

D) binarySearch () can operate on all sets.

 

20. The running result of the following code is () D

ArrayList al = new ArrayList ();

Al. add ("");

Al. add ("B ");

Al. add ("c ");

Iterator it = al. iterator ();

While (it. hasNext ()){

String s = (String) it. next ();

If (s. equals ("c ")){

Al. add ("c1 ");

}

}

System. out. println (al)

A) [a, B, c]

B) [c1]

C) [a, B, c, c1]

D) ConcurrentModificationException thrown

 

21. Which method in the Properties class can be associated with the IO stream () C

A) getProperty ()

B) setProperty ()

C) load ()

D) stringPropertyNames ()

 

22. Which of the following stream objects can be successfully copied to any type of files? () B

A) FileReader and FileWriter

B) FileInputStream and FileOutputStream

C) BufferedReader and BufferedWriter

D) InputSteamReader and OutputStreamWriter

 

23. Which of the following streams is the bridge between byte and character ()

A) InputStreamReader

B) OutputStreamWriter

C) LineNumberReader

D) ObjectInputStream

 

24. Which of the following statements about Object serialization is false? () B

A) The serialized object must implement the Serializable interface.

B) The serialized object must have a custom serial number.

C) The writeObject () method in ObjectOutputStream can write the object

D) The readObject () method in ObjectInputStream can read objects.

 

25. Which of the following statements about the Map. Entry interface is false? () C

A) has the getkey () method

B) has the getValue () method

C) has the keySet () method

D) has the setValue () method

 

26. Set is characterized by () B

A) element order

B) The elements are unordered and do not store duplicate elements.

C) store duplicate elements

D) The Set is thread-safe.

 

27. The operation that cannot be performed after converting an array into A set is ()

A) add elements in the set.

B) iterative set

C) modify the elements in the set.

D) obtain the number of elements in the set.

 

28. The result of the code below is () B

ArrayList <String> al = new ArrayList <> ();

Al. add ("s ");

Al. add ("ddd ");

Al. add ("true ");

System. out. println (al)

A) compilation failed.

B) [s, ddd, true]

C) [true]

D) running error

 

29. Which of the following statements about the character input stream FileReader is false? (C)

A) can read text files.

B) is a subclass of Reader.

C) method for reading a row

D) the number of bytes of the file to be read cannot be obtained.

 

30. Which files () A can be copied successfully using the ghost stream?

A) Text File

B) image files

C) Video Files

D) All of the above can be copied.

 

The following questions are selected for multiple items

31. Which of the following statements about the listFiles () method in the File class is true? () AC

A) obtain all the files and folder objects in the path encapsulated by the File object.

B) only obtain files in the path encapsulated by the File object

C) This method returns an array of the File type.

D) This method returns an array of the String type.

 

32. Which of the following statements about the exists () method in the File class is false? () CD

A) Determine whether the encapsulated path or File in the File object exists

B) This method returns a boolean value.

C) Determine whether the path encapsulated by the File object is a relative path.

D) Determine whether the path encapsulated by the File object is an absolute path.

 

33. The role of the isDirectory () method in the File class is () BD

A) Determine whether the File object is encapsulated as a File.

B) Determine whether the File object is encapsulated as a directory.

C) Determine whether the File object is encapsulated in the root directory

D) the return value type is boolean.

 

34. Which of the following statements about the HashMap set are true? () AB

A) The HashMap set is a double-row set.

B) Duplicate keys cannot be stored in the HashMap set.

C) duplicate values cannot be stored in the HashMap set.

D) The HashMap set thread is secure.

 

35. Which of the following methods can be used to create a directory () CD?

A) createNewFile ()

B) createTempFile ()

C) mkdir ()

D) mkdirs ()

 

36. Which of the following statements about PrintWriter is true? () ACD

A) the stream only operates on the Data target, not the data source.

B) The Stream only operates on the data source, not the data target.

C) If Automatic refresh is enabled, the stream can be automatically refreshed when the println () method is called.

D) the stream is a subclass of Writer.

 

37. Which of the following statements about generics are true? () ABC

A) Generic is a new feature of JDK1.5.

B) Generic is a security mechanism.

C) use generics to avoid forced type conversion

D) Forced type conversion is required for generic usage.

 

38. Which of the following statements about Properties is true? () ABC

A) is a subclass of Hashtable.

B) is a double row set.

C) can be used in combination with IO

D) is a subclass of HashMap.

 

39. Which of the following statements about Recursive Algorithms of methods is true? () ABD

A) recursion means that the method calls itself.

B) The number of recursion times cannot be too large; otherwise, stack memory overflow may occur.

C) if recursive algorithms are used, the method must return values.

D) The constructor cannot use recursive algorithms.

 

40. Which of the following () ABC methods can be used to traverse a List set?

A) Iterator implementation

B) enhanced for loop implementation

C) combine get () and size () Methods

D) get () and length () Methods

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.