1. The class in Java that represents the compiled result of a regular expression string is: (C) A. Matcher B. Char C. Pattern D. None of the above

  2. What does '[^abc]' mean in regex? (B) A. Matches a or b or c B. Does not include a or b or c C. Matches ^ or a or b or c D. None of the above

  3. What is the regular expression for matching any string? (A) A. '\w' B. '[a-zA-Z]' C. '\S' D. '\s'

  4. How many groups are there in the regular expression '(\d{4})-(\d{2}-(\d\d))'? (A) A. 3 B. 4 C. 5 D. 1

  5. Which statement is correct about Collection and Collections? (D) A. Collections is used to save multiple collection elements B. Collection saves key-value compound elements C. Collections is the parent interface of collections; Collection is the tool class for operating collections D. Collection is the parent interface of collections; Collections is the tool class for operating collections

  6. Which statement is correct about HashSet and TreeSet? (B) A. HashSet saves elements in order, and TreeSet is unordered B. HashSet is unordered, and TreeSet is ordered C. Both HashSet and TreeSet are unordered D. Both HashSet and TreeSet are ordered

  7. Which statement is correct about Comparable sorting interface and Comparator comparator? (A) A. Comparable is the natural sorting interface that indicates that elements have mutual size; Comparator is the forced sorting interface. B. Comparable is the forced sorting interface; Comparator is the natural sorting interface. C. Both Comparable and Comparator need to implement the compareTo() method. D. There is no difference.

  8. Which statement is correct about the role of automatic boxing and unboxing? (B) A. Automatic unboxing wraps primitive data types into objects; automatic boxing converts wrapper classes to primitive data types. B. Automatic boxing wraps primitive data types into objects; automatic unboxing converts wrapper classes to primitive data types. C. 3 D. 0

  9. What is a more accurate statement about looping through List collections? (D) A. Traditional for loop B. For...each loop C. Iterator iterator D. All of the above

  10. What is the data structure used by HashMap to save elements? (B) A. Array B. Hash table C. Binary tree D. None of the above

Java Regular Expressions, Collections, and Data Structures: Multiple Choice Quiz

原文地址: https://www.cveoy.top/t/topic/octf 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录