Java Advanced Freshman Certificate Exam Exam Questions-Yunnan Agricultural Vocational and Technical College-Internet Technology College-Meihe Yisi School-Enterprise Cooperation Major

 Question 1. What is wrong about the XML document structure description

  1. A basic XML document usually consists of two parts: preamble and document elements
  2. The preamble in the XML document can include XML declarations, processing instructions, and comments
  3. The elements in the XML document are arranged in a tree structure
  4. The declaration of the XML document must be written

 

 The second question, the thread can sleep for a period of time through the () method, and then resume operation

  1. run
  2. stop
  3. yield
  4. sleep

 

 Question 3, the description of the synchronization method is wrong

  1. The synchronization method is not as effective as the synchronization code block
  2. The synchronization monitor of the synchronization method is this current object itself
  3. If a thread calls the synchronization method, it will lock the current object itself.
  4. The synchronization method and synchronization code block are decorated with the same keywords

 

 Question 4. For the main points of the singleton pattern in the design pattern, what is wrong is the description

  1. A singleton can provide this unique instance to all objects through a public, non-static method
  2. Singleton class can only have one instance
  3. The singleton class must create its own unique instance
  4. Singleton class must provide this instance to all objects

 

 Question 5, the following is not a thread state

  1. run
  2. Ready
  3. stop
  4. death

 

 Question 6, which of the following methods of the ThreadLocal class can return the thread local variable value corresponding to the previous thread

  1. get()
  2. remove()
  3. set()
  4. add()

 

 Question 7. The () method is defined in the File type to determine whether a file exists

  1. createNewFile
  2. renameTo
  3. delete
  4. exists

 

 Question 8. When editing XML, what about the attribute declaration is wrong?

  1. Multiple attributes can be used in the tag
  2. The attribute can appear in the start tag or the end tag
  3. Property names are case sensitive
  4. The attribute value must be enclosed in quotation marks

 

 Question 9 is the correct description of OutputStream

  1. Byte output stream
  2. Byte input stream
  3. Character input stream
  4. Character output stream

 

 Question 10: A TCP-based time service application is provided on the server www.openlab.com.cn, and the application uses port 13. The statement to create a connection to this server is:

  1. Socket s = new Socket(“www.openlab.com.cn”, 13);
  2.  Socket s = new Socket(“www.openlab.com.cn:13”);
  3. Socket s = accept(“www.openlab.com.cn”, 13);
  4. Socket s = accept(“www.openlab.com.cn:13”);

 

 Question 11, use Dom4j to add attributes to the nodes of the XML document, the correct one is

  1. Node.addAttributes();
  2. Node.addAttribute("Attribute name","Attribute value");
  3. Node.addAttributes("Attribute name","Attribute value");
  4. Node.addAttributes();

 

 Question 12, the keyword of the synchronization code block is

  1. sychronid
  2. sychronzied
  3. synchronized
  4. synchronization

 

 Question 13. Is the () method defined in the File type to create a first-level directory?

  1. createNewFile
  2. exists
  3. mkdirs
  4. mkdir

 

 Question 14. What is wrong about the description of the synchronization code block?

  1. Using synchronous code blocks can ensure that only one thread can operate on sensitive data at the same time
  2. In order to ensure the security (accuracy) of the data, a synchronous code block can be introduced
  3. The synchronization code block complies with the logic of "lock, modify, release, lock"
  4. Using synchronous code will definitely cause deadlock

 

 Question 15. Use Dom4j to parse the XML document, where the method to get the root node is

  1. rootElement ()
  2. getRootNode ()
  3. getRootElement ()
  4. rootNode ()

 

 Question 16. Which of the following operations can make the thread from the running state into another blocking state

  1. sleep
  2. wait
  3. yield
  4. start

 

 Question 17: In the process of reading and writing text files using Java IO streams, the following () exceptions need to be handled

  1. ClassNotFoundException
  2. IOException
  3. SQLException
  4. RemoteException

 

 Question 18. If an I/O error occurs when closing the socket, it will throw

  1. IOException
  2. UnknownHostException
  3. SocketException
  4. MalformedURLException

 

 Question 19, use Dom4j to add content to the nodes of the XML document, the correct one is

  1. Node.setText("Content");
  2. Node.addText("Content");
  3. Node.addContext("content");
  4. Node.setContext("content");

 

 Question 20, in the IO operation of Java, the () method can be used to refresh the stream buffer

  1. void release()
  2. void close()
  3. void remove()
  4. void flush()

 

 Question 21, the following statement is wrong

  1. The thread is the program
  2. A thread is a single execution flow of a program
  3. Thread refers to multiple execution streams of a program
  4. Multithreading is used to achieve concurrency

 

 Question 22. Regarding the running of threads, what is wrong is

  1. Threads run independently
  2. Thread execution is preemptive
  3. Once a thread runs, it cannot be stopped until its own running code is executed.
  4. For some applications, opening multiple threads can improve execution efficiency

 

 Question 23: Two processes compete for the same resource

  1. Must deadlock
  2. Not necessarily deadlock
  3. No deadlock
  4. None of the above is correct

 

 Question 24, what is the abbreviation of XML

  1. Unified Modeling Language
  2. Hypertext Markup Language
  3. Extensible Markup Language
  4. Experimental Markup Language

 

 Question 25, the description of the Runnable interface is wrong is

  1. Define the implementation class of the Runnable interface without rewriting the run() method
  2. Using the Runnable interface, resource sharing between multiple threads can be well realized
  3. The Runnable object is only the target object of the Thread class object operation, and the actual thread object is still an instance of the Thread class
  4. Runnable method is suitable for multiple threads of the same program code to process the same resource

 

 Question 26, one of the following statements is wrong

  1. A thread is an instance of the Thread class
  2. The thread starts execution from the run() method of the Runnable instance passed to the purebred
  3. The data of the thread operation comes from the Runnable instance
  4. The newly created thread can immediately enter the running state by calling the start() method

 

 Question 27, the following statement is correct

  1. A process has two main threads by default
  2. The method of implementing multithreading cannot be completed by inheriting the Thread class
  3. The order of execution between multiple threads is determined
  4. A process can contain multiple threads

 

 Question 28, the parameter unit of the sleep (long millis) method in the thread is

  1. Microsecond
  2. millisecond
  3. second
  4. minute

 

 Question 29, the thread description is wrong

  1. All thread objects must be instances of the Thread class or its subclasses
  2. The run() method is the main execution method of the thread
  3. The setName() method can set the name of the thread
  4. To determine whether the current thread is active, you can use the live() method

 

 Question 30, about the XML description error is

  1. XML is Extensible Markup Language
  2. XML is mainly used to provide data representation format
  3. XML is not scalable
  4. XML is mainly used for data exchange between different applications

 

 Question 31. In network programming, the objects of the following classes containing Internet addresses are

  1. Applet
  2. Datagramsocket
  3. InetAddress
  4. AppletContext

 

 Question 32, Java network programming, when the client's server address is not found, it will throw

  1. IOExcpetion
  2. UnknownHostException
  3. SocketException
  4. MalformedURLException

 

 Question 33, TCP/IP is a

  1. standard
  2. protocol
  3. Language
  4. algorithm

 

 Question 34, the way to start a thread is

  1. sleep
  2. run
  3. start
  4. stop

 

 Question 35, for the singleton pattern in the design pattern, in order to realize the "singleton", it must be done

  1. Create a parameterized constructor for the class
  2. Privatization construction method
  3. Change the access level of the constructor to protected
  4. Create parameterless and parameterized construction methods for this class

 

 Question 36 : What is wrong about the Xpath description

  1. Xpath is the XML path language
  2. Xpath can quickly locate and obtain the required nodes
  3. You can use the selectNodes("expression") method to find the corresponding node
  4. When using Xpath, there is no need to import the corresponding jar package

 

 Question 37. In Java network programming, what describes the error is

  1. Used to receive Socket requests from the client
  2. Is a blocking method
  3. Set the open port number must be less than 1024
  4. Set the open port to be as large as possible to avoid common software port numbers

 

 Question 38. In network programming, the way to get the input stream of the Socket object is

  1. OutputStream
  2. getInputStream
  3. InputStream
  4. getOutputStream

 

 Question 39, the description of the elements of the XML document is wrong

  1. There can be multiple top-level elements in an XML document
  2. Elements in XML documents can be nested
  3. XML document elements are composed of start tags, attributes, element content and end tags
  4. XML elements can be named by themselves, but they must follow certain rules

 

 Question 40, about the ThreadLocal class description is wrong

  1. It is a thread safe class provided by Java
  2. Using the ThreadLocal class can easily isolate the competing resources of multithreaded programs
  3. The value of ThreadLocal cannot be any type
  4. ThreadLocal instance represents a thread-local variable

 

 Question 41, does not meet the requirements of a well-formed XML document is

  1. The document can have more than one root element
  2. There is a compliance statement
  3. Each element has correct start and end tags
  4. Elements are correctly nested, no crossover phenomenon occurs

 

 Question 42. The following usage scenarios that meet the singleton mode are

  1. When multiple instances of this class are needed
  2. Creating an object consumes too many resources, and the function of the object is the same every time it is used, there is no need to create it repeatedly
  3. Need to define a large number of static constants and static methods (such as tool classes) environment, you can use the singleton mode
  4. In the entire project, a shared access point or shared data is required to ensure that different users access the same data at different times

 

 Question 43: When is the thread dead?

  1. The run() method is executed and the thread ends normally
  2. The restart() method of the thread is called
  3. The thread throws an uncaught Exception or Error
  4. The stop() method of the thread is called

 

 Question 44. What stream is generally used for reading and writing raw data?

  1. InputStream
  2. DataInputStream
  3. OutputStream
  4. BufferedInputStream

 

 Question 45, the description of synchronization and deadlock is correct

  1. The more sync, the better
  2. Synchronization refers to a form of operation in which a thread waits for another thread to execute before continuing.
  3. As long as there is synchronization, there must be deadlock
  4. The so-called deadlock means that two threads are waiting for each other to complete first, causing the program to stall.

 

 Question 46, the following description of the simple factory pattern is wrong

  1. If you want to fully encapsulate and isolate the specific implementation, so that the external can only operate the package body through the interface, then you can choose the simple factory mode
  2. If you want to centrally manage and control the responsibilities of externally created objects, you can use the simple factory model
  3. Simple factory has 4 roles
  4. The purpose of the simple factory is to hide the process of creating objects, so that the caller can directly get the objects that can be used

 

 Question 47. Which of the following statements about the File class is correct?

  1. A File object represents a file or folder in the operating system
  2. You can use the File object to create and delete a file
  3.  You can use the File object to create and delete a folder 
  4. When a File object is garbage collected, the corresponding file or folder on the system. 

 

 Question 48. In Java network programming, which of the following classes can support TCP/IP connections?

  1. InetAddress
  2. Packet
  3. Socket
  4. ServerSocket

 

 Question 49, in network programming, the description of one-way and two-way communication is wrong

  1. One-way communication means that only one end sends data, and the other end only needs to receive data
  2. Two-way communication means that both the server and the client can send and receive data
  3. One-way communication means that the client can only send data, and the server can only receive data
  4. Two-way communication means that the client can only receive data, and the server can only send data

 

 Question 50, the following are the characteristics of the process

  1. Independence
  2. Dynamic
  3. Concurrency
  4. Completeness

 

 

Guess you like

Origin blog.csdn.net/weixin_44893902/article/details/109194437