Intelligent Java Collection +io part knowledge test

Source: Internet
Author: User
Tags comparable set set

Collection +io Part

A total of 40 choice questions, 2.5 points per question. Multiple-choice mistakes are all wrong, the full score.

    1. The top-level interface of a single-column collection is () b

A) Map

b) Collection

c) List

D) Set

    1. The underlying data structure of the ArrayList class is () a

A) array structure

b) Linked list structure

c) Hash table structure

d) Red and black tree structure

    1. The LinkedList class is characterized by () B

A) query fast

b) Adding and deleting quickly

c) element is not duplicated

d) Natural ordering of elements

    1. The vector class is characterized by () a

A) thread synchronization

b) thread is out of sync

c) Adding and deleting quickly

D) The bottom is the linked list structure

    1. About iterators saying wrong is () D

A) iterator is the way to remove the collection element

b) The return value of the Hasnext () method of the iterator is a Boolean type

c) List collection has a unique iterator

D) The next () method returns the previous element in the collection

    1. FileReader class description Correct is () B

A) byte input stream

b) Character input stream

c) Print Flow

d) Serialization of streams

    1. The class with the ReadLine () method is () D

A) FileWriter

b) InputStreamReader

c) FileReader

D) BufferedReader

    1. About the newline () method describes the error is () C

A) The NewLine () method writes a line break

b) The NewLine () method is independent of the operating system platform

c) The NewLine () method is a method of the Filewiter class

D) the NewLine () method is a method of the BufferedWriter class

    1. The result of the following code operation is () a

Arraylist<string> al = new Arraylist<string> ();

Al.add (TRUE);

Al.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, enable the serialization feature () C

A) Runnable interface

b) Comparable interface

c) Serializable interface

d) Comparator interface

11. The abstract base class for byte output streams is () a

A) OutputStream class

b) InputStream class

C) Writer class

d) Reader class

12. The following program operation results are () D

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

Fos.write ("abc");

Fos.close ();

A) Create the file Demo.txt in the C drive, but the file is empty

b) Create the file Demo.txt in the C drive and write the data ABC

c) Append the existing file Demo.txt in C to ABC

d) Compilation failed

13. Save the Keys in the map collection to the set collection by means of () C

A) EntrySet ()

b) Get ()

c) KeySet ()

d) put ()

The difference between ArrayList and vectors is correct () B

A) ArrayList is thread-safe, vector is thread insecure

b) ArrayList is thread insecure, vector is thread-safe

c) ArrayList is the structure of the array, the bottom of the vector is the chain list structure

D) The bottom of the ArrayList is the linked list structure, the vector bottom is the array structure

15. Objects stored in the TreeSet collection must have () a

A) Comparable interface must be implemented

b) Main method

c) Get and set methods

d) Serializable interface must be implemented

16. The method of transferring the collection to a group is () C

A) aslist ()

b) ToCharArray ()

c) ToArray ()

d) Copy ()

17. For the enhanced for Loop argument error is () a

A) enhanced for loop can traverse the map collection directly

b) enhanced for loop to manipulate arrays

c) Enhanced for loop can manipulate collection collection

d) Enhanced for loop appears after JDK1.5 version

18. For the HashMap set it is correct to say () C

A) The bottom layer is the array structure

b) The bottom is the linked list structure

c) can store null values and NULL keys

D) You cannot store null values and NULL keys

The BinarySearch () method in the Collections tool class describes the correct () B

A) The BinarySearch () method can only manipulate set sets

b) The BinarySearch () method can only manipulate the list collection

c) the BinarySearch () method can only manipulate the map collection

d) BinarySearch () can manipulate all the collections

20. The following code runs as a result () D

ArrayList al = new ArrayList ();

Al.add ("a");

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) Throw Concurrentmodificationexception exception

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 two stream objects can achieve a successful copy of any type of file () B

A) FileReader and FileWriter

b) FileInputStream and FileOutputStream

c) BufferedReader and BufferedWriter

d) Inputsteamreader and OutputStreamWriter

23. Which stream below is the byte-to-character bridge () A

A) InputStreamReader

b) OutputStreamWriter

c) LineNumberReader

D) ObjectInputStream

24. The serialization of the object is wrong () B

A) The object that implements the serialization must implement the Serializable interface

b) The object that implements the serialization must have a custom serial number

c) the WriteObject () method in ObjectOutputStream can write the object out

D) The ReadObject () method in ObjectInputStream can read the object

25. About the Map.entry interface The error is () C

A) with Getkey () method

b) with GetValue () method

c) with keyset () method

d) with SetValue () method

The feature of Set sets is () B

A) Orderly elements

b) elements are unordered and do not store duplicate elements

c) Storing duplicate elements

d) The set set is thread-safe

27. When you turn an array into a collection, the operation that cannot be performed is () a

A) Increase the elements in the collection

b) Iteration Set

c) Modify the elements in the collection

D) Get the number of elements in the collection

28. The result of the following code operation 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) Operation error

29. About the character input stream FileReader description error is (C)

A) can read text files

b) is a subclass of reader

c) A way to read a line

D) Unable to get the number of bytes to read the file

30. Which files can be successfully copied using A character stream () A

A) text file

b) Picture file

c) video files

d) above can be reproduced

The following topics are multiple choices

The Listfiles () method in the file class is said to be correct () AC

A) Get all the file and folder objects under the path encapsulated by the file object

b) Get only the file under the path encapsulated by the file object

c) The method returns an array of file types

d) The method returns an array of type string

32. The exists () method in the file class is wrong to say () CD

A) determine whether the path or file exists in the files object

b) This method returns a Boolean type value

c) Determine if the path encapsulated by the file object is a relative path

D) Determine if the path encapsulated by the file object is an absolute path

The Isdirectory () method in the file class acts as a () BD

A) Determine whether the file object is encapsulated

b) Determine if the file object encapsulates a directory

c) Determine if the file object is encapsulated in the root directory

d) The return value type is Boolean

34. About the HashMap collection saying right is () AB

A) The HashMap collection is a double-column set

b) HashMap collection does not allow duplicate keys to be stored

c) HashMap collection does not allow duplicate values to be stored

d) HashMap collection thread is secure

35. Which of the following two methods can create a directory () CD

A) CreateNewFile ()

b) Createtempfile ()

c) mkdir ()

d) mkdirs ()

36. About Print flow PrintWriter the right thing to say is () ACD

A) The stream operates only for data purposes and does not manipulate the data source

b) The stream only operates the data source and does not manipulate the data purpose

c) If automatic refresh is enabled, the stream can automatically refresh when it calls the println () method

D) The stream is a subclass of writer

37. The statement about generics is correct () ABC

A) generics are a new feature of JDK1.5

b) Generics are a security mechanism

c) Using generics avoids coercion of type conversions

d) Mandatory type conversions are required with generics

38. The right thing to say about Properties is () ABC

A) is a subclass of Hashtable

b) is a double-column collection

c) can be used in conjunction with IO

D) is a subclass of HashMap

39. About the recursive algorithm of the method, it is correct to say () ABD

A) recursion is the method of calling itself

b) The number of recursion can not be too large, otherwise it will cause stack memory overflow

c) using a recursive algorithm, the method must have a return value

d) Construction method can not use recursive algorithm

There are several types of traversal methods for the list collection () ABC

A) Iterator iterator implementation

b) enhanced for loop implementation

c) The get () and size () methods combine to implement

D) The Get () and length () methods combine to implement

Intelligent Java Collection +io part knowledge test

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.