Soft JAVA pen questions, soft java questions

Source: Internet
Author: User
Tags ldap switch case domain name server java keywords

Soft JAVA pen questions, soft java questions




1. What method of MyObject will affect the correctness of the if expression
List l = new vertex List ();
L. add (new MyObject (""));
If (l. contains (new MyObject (""))){}
A. toString ()
B. equals ()
C. hashCode ()
D. clone ()
-------------------------------- B
2. What method of MyObject will affect the correctness of the if expression
Set ts = new TreeSet ();
Ts. add (new MyObject (""));
If (ts. contains (new MyObject (""))){}
A. toString ()
B. equals ()
C. hashCode ()
D. clone ()
-------------------------------- B
3. Which method of MyObject will affect the correctness of the if expression (Multiple choices)
Map m = new HashMap;
M. add (new MyObject (""));
If (m. contains (new MyObject (""))){}
A. toString ()
B. equals ()
C. hashCode ()
D. clone ()
------------------------------- B, C
4. Which of the following are not JAVA keywords?
A. null
B. exit
C. main
D. remove
E. true
------------------- B .C, D

5. Which of the following are not JAVA keywords?
A. NULL
B. instansof
C. extends
D. sizeof
------------------ A, D
6. Which of the following statements is valid:
A. try {} finally {}
B. try {} catch (Exception x) {} catch (NullpointExpoint ){}
C. try {} catch (Exception x) {} finally {}
D. try {} catch (NullpointExpoint) {} catch (Exception x ){}
E. try {} catch (Throwable t) {} finally {}
------------------ A, C, D, E
7. The following are servlet containers
A. apache
B. Tomcat
C. Weblogic
D. websphere
---------------- B, C, D
8. int I = 9;
Int j = 9;
The following expressions are true:
A. j = I
B. j = I ++
C. j = ++ I
D. j ++ = I
E. ++ j = I
--------------- B, D
9 int I = 0 xFFFFFFFF;
Int j = 0x0;
Which of the following expressions returns 0?
A. I & j
B. I | j
C. I ^ j
D. I <2
E. I> 2
F ~ I
--------------- A, F
10. Which of the following definitions are correct?
A. int I = 0 xFFFFFFFF;
B. char c = '\ u0571 ';
C. byte B = 01;
D. int I = 'a ';
E. long l = 455566666L;
---------------- A, B, C, D, E
11. Which of the following methods can be rewritten if the equles () method of myObject is rewritten:
A. toString ()
B. clone ()
C. hashCode ()
D. wait ()
----------------- B
12. Which of the following are the parameters used by the stored procedure in the database:
A. INPUT
B. IN
C. OUT
D. INOUT
-------------- B, C, D
13. Which of the following statements about Oracle is true:
A. Relational Database
B. Object-oriented relational databases
C. Hierarchical Database
--------------
14. The following statements Generate several objects
MyClass c1, c2, c3, c4, c5
C1 = new MyClass ();
C2 = null;
C3 = new MyClass ();
C4 = "";
C5 = c1;

A: 1
B 2
C 3
D four
E five
-------------- C
15. Which of the following generate new String objects?
A. String s = new String ();
B. String s = new String ("");
C. String s = "";
D. String s = "A". intern ();
E. String s = (String) String. class. newInstance ();
-------------- A, B, C, D, E
16. Which of the following are implicit JSP objects?
A. out
B. request
C. respones
D. session
E. appliacation
----------------- ABCDE
17. If two associated tables exist, the primary key of one table is usually
A. Foreign key
B. Primary Key
C. index key
-----------------
18. Which of the following statements about the oracle database is true)
A. the table with indexes has the ROWID field.
B. Data files can be shared by multiple databases.
C. Data Files can grow on their own
-----------------
19. Which of the following are named legally?
A. $ p
B. TwoDay
C. * point
D. _ char
E. 2DF
---------------- A, B, D
20. Select the Bean used by the EJB
A SessionBean
B EntityBean
C MessageDriverBean
D JavaBean
---------------- A, B .C (three beans are defined in JB, namely Session bean, Entity bean, and message-driven bean .)
21. The EJB deployment file is (single choice)
A. ejb-jar.xml
B. ejb. xml
C. weblogic-ejb-jar.xml
D. weblogix-ejb.xml
E. web. xml
----------------
22. Which of the following files is used to deploy the web project)
A. war
B. jar
C. ear
D. Directly copy the project to the service
------------------------------- A, D
23. Inheritance of Classes
A. the class can only be inherited by A single user.
B. A class can only inherit one interface or one class
C. classes can be inherited by multiple
D. The single inheritance of classes ensures the simplicity and clarity of the program
------------------------------- A, D
24. In a multi-threaded environment
A. the test code does not need to be synchronized.
B. The test code must be synchronized.
C. The test code does not need to be synchronized when testing this method.
D. The test code must be synchronized when testing this method.
------------------------------ C
9. Which of the following are multiple DML statements?
A. commit
B. update
C. Select
D. drop
----------------------------- B, C
10. Which of the following are UML dynamic diagrams?
A. Class Diagram
B. Sequence Diagram
C. Interface Diagram
D. Deployment Diagram
E. object graph
F collaboration Diagram
G status chart
-------------------------- B, F. G
11. The following are UML static diagrams.
A. Class Diagram
B. Sequence Diagram
C. Interface Diagram
D. Deployment Diagram
E. object graph
F collaboration Diagram
G status chart
---------------------------- A, C. E, D,
24. In which method is the parameter required by servlet generally initialized?

A init
B doGet
C doPost
D Service
-----------------------------
25 design criteria for dividing modules?
A. High Cohesion and low coupling
B. Low cohesion and high Coupling
C. High Cohesion and high Coupling
D. Low cohesion and low coupling
-----------------------------
26 which List is the most suitable for FIFO queues?
Shortlist

27 which Map is sorted?
TreeMap

28 which Set is sorted?
TreeSet

29. Method for searching List content
List l = new ArrayList ();
L. add ("");
L. add ("B ");
L. add ("C ");
How to find "B "?
A l. contains ("B ")
B l. indexOf ()
C l. sizeOf ()
-------------------------------
30 char [] a = "Hello World". toCharArray ();
Select all the correct items?
A class cc = a. getClass ();
B int len = a. length;
C char [] c = a [999];
D char [] c = a [0];
E a. equals (new Object ());
-------------------------------- A, B, D, E
31 which of the following are valid java operators?
A >>>
B? |
C? |
D? ? ? =
E? %
-------------------------------
32 which of the following can be accessed using JNDI? (Multiple choice) --- JNDI (Java Naming and Directory Interface) java Naming and Directory Interface
A. JNDITree in J2EE
B. File System
C. LDAP directory service
D. DNS Domain Name Server
DNS, XNam, Novell Directory Service, LDAP (Lightweight Directory Access Protocol light Directory Access Protocol ),
The Registry, RMI, DSML v1 & v2, and NIS of the CORBA object service, file system, Windows XP/2000/NT/Me/9x.
------------------------------ A. B, C, D
33 Spring1.x IOC implementation?
A. Interface Injection
B. constructor Injection
C. Static Method Injection
D. configuration file injection
------------------------------ A, D
34 which of the following statements can release all table locks held by users? (Multiple options)
A. commit
B. exit
C. Alter table ..
D. update table ..
--------------------------------------------
35. Which of the following statements about final is false?

A. the classes defined by final cannot be inherited.
B. methods defined by final cannot be overloaded.
C. final can be used in the image extraction class method.
D. None of the above are correct.
------------------------------------ B, D
36. serializable keywords)

37. What are the execution results of the following SQL statements?
SELECT sal sarisy FROM customer order by sarisy
SELECT sal "sarisy" FROM customer order by sarisy ASC
A. The results are exactly the same.
B. Check the record in the first sentence, and the second sentence has a syntax error.
C. Records are found in both sentences, but the results are different.
------------------------------------
38. Purpose of software testing
A. reduce software bugs
B. Control Software Quality
C. Complete the software development process
-------------------- B
39. view issues, basic concepts related to Views
A. Deleting A view deletes the base table record.
B. Deleting a view does not delete the base table record.
C update only updates the view without updating the base table
----------------------- B
40. Select the possible results based on the following code:
Class Demo {
Int a [] = new int [10];
Public static void main (String [] args ){
Demo demo = new Demo ();
Demo. display ();
}
Void display (){
System. out. println (a [9]);
}
}
A. The output is 0;
B. Output 1;
C. Output null;
D. runtime error. The array subscript is out of bounds.
--------------------------------------
41. Select the possible results based on the following code:
Class Demo {
Boolean [] a = new Boolean [10];
Public static void main (String [] args ){
Demo demo = new Demo ();
Demo. display ();
}
Void display (){
System. out. println (a [9]);
}
}
A. Output true;
B. The output is false;
C. Output null;
D. runtime error. The array subscript is out of bounds.
----------------------------------------- C
42. Select the possible results based on the following code:
(1) class Demo extends Thread implements Runnable {
(2) public void run (){
System. out. println ("k ");
}
Public static void main (String [] args ){
Thread t = new Thread (new Demo ());
(3) t. start ();
}
}
A. Code (1) error.
B. Code (2) Error
C. Code (3) Error
D. normal output "k"
----------------------------------------
43. The following one does not belong to the collection framework:
A. Collections
B. Arrays
C. ArrayList
D. HashMap
------------------------------------------- A. B
44. Select possible results based on the following code:
Class Demo {
Public static void main (String [] args ){
Demo d = new Demo ();
String str = "BEA ";
D. change (str );
System. out. println (str );
}
Void change (String s ){
S. replace ('A', 'E ');
S. toLowerCase ();
}
}
A. BEA
B. BEE
C. bee
D. bea
--------------------------------------------
45. Select possible results based on the following code:
Class Demo {
Public static void main (String [] args ){
Long l = 4l; <not 41, but 4l>
L = l> 2;
System. out. println (l );
}
}
A. An error is reported during running.
B. An error is reported during compilation.
C.0
D.1
--------------------------------------------- D
46. Which of the following statements about Block A is true?

Public void method (){
List list = new ArrayList ();
Synchronized (list ){
System. currentTimeMillis (); //
}
}

A. the method needs to be synchronized;
B. The method does not need to be synchronized;
C ....
D. None of the above statements;
----------------------------------------------
47. To implement RUL cache, use the following:
A. Hashmap
B. Hashtable
C. WeakHashMap;
D. LinkedHashmap.
---------------------------------------------
48. Stream used for serialization
A. FileInputStream
B. ObjectInpuStream
C. ByteArrayInputStream
D ....
--------------------------------------------- B,
49. Search for List content
List l = new vertex List ();
L. add ("");
L. add ("B ");
L. add ("C ");
How to find ""?
A. Collections. binarySearch (list, "");
B l. contains ("")
C l. indexOf ()
D ..
---------------------------------------------- B
50. The http protocol, post, get method, and message are correct:

A. http: // ip; host ......
B. http://..a = ?,.....
C. Similar to
D. Similar to B
--------------------------------------------- D
51. Below is a commonly used J2EE mode;
A. factory method mode
B. Decobrator mode (decoration Mode)
C. dao
D ....
------------------------------------------- A, C
52. ejb and javabean descriptions
1> javaBean is a (compliant) java class, a software component
2> Functions of software components: you only need to write it once and it can be executed everywhere. Highly reusable
3> external features of javaBean-implement the Serializable interface, provide non-parameter construction, provide get and set methods to access its attributes
4> java classes with Special Reference Methods on jsp
I. <jsp: useBean> ---- <% page import = ""> (common class) -- class
Ii. <jsp: setProperty name = "" property = ""> ------ Properties


EJB is short for Enterprise JavaBean and runs as a JavaBean in the EJB container. The design goal and core application are to deploy the distributed application system.
With the cross-platform advantages of Java, distributed applications deployed using EJB technology are not limited to platforms.
1> EJB implementation principle: Put the code originally implemented on the server end to the server end and communicate with each other through RMI.
2> RMI implementation principle: Remote Method Invocation)
3> server cluster: connects servers of different functional modules through RMI communication to achieve a complete function.

53. Differences between the description of the three Ejb beans and the Session Bean and the message-driven bean.
SessionBean-the core of EJB, mainly responsible for processing business logic. It is divided into stateful Bean and stateless Bean based on whether to save the Request status.
EntityBean ---- manages an object of the persistence class, @ Entity, which may use some related Java objects and can be uniquely identified by the primary key.
MessageDrivenBean-component used to process message requests
MDB is equivalent to a stateless SessionBean without local and remote interfaces.
55. Description of LocaleEjb in EJb ..
The Local interface, called the Home interface, is essentially a Java RMI interface.
You can only use the Local interface locally. It lists all methods for locating, creating, and deleting an Ejb instance.
Method for defining the local interface:
1) define in the Ejb file:
@ Local (value = {Interface1, interface2 ,..})
2) define in the Ejb file:
@ Local (Interface1, Interface2 ,..)
3) define in the Interface file
@ Local


59. Differences between parameters obtained by Post and Get
1> get requests are used to obtain resources from the server ---- post is used to submit data to the server
2> get adds the data in the form to the URL pointed to by Action in the form of name = value, and the two are used? Connect, and use "&" to connect Variables
Post: place the data in the form in the HTTP request header or message body and pass it to the URL pointed to by the action.
3> get data must be limited by the URL Length (1024 bytes), while post can transmit a large amount of data.
4> post insurance for sensitive data
 
61. What is the xml format of Post and Get submit parameters?


64 .. the thread starts to run the command: start ()

65. Can a programmer specify a memory recycle program?
Yes, System. gc ();

66. Two Double objects, using = and equals to determine the results

67. Six transaction configurations of EJB
Required: methods or components marked with this attribute are always running in transactions. If the client is already in the transaction, it runs in the original transaction; if there is no transaction, it starts a new transaction and runs in it.

Requires_New: methods or components are always run in newly opened transactions. If the client is already in the transaction, the original transaction will be suspended first, and then a new transaction will be started and run in it. After the new transaction ends, the original transaction will continue to be executed from the starting point; if no transaction exists, a new transaction is started and runs in it.

Supports: Unlike the Required attribute, a new transaction is not started in an environment without transactions. If a transaction exists, it is added to the transaction for running, which is the same as Reuqired.

Not_Supported: if the transaction already exists, the original transaction will be suspended, and then the method or component that marks the attribute will be called. After the call ends, the original transaction will continue; when no transaction environment is called, new transactions are not enabled, which is the same as Supports.

Mandatory: the client that calls the method or component that marks this attribute. It must already be in the transaction. If it is not in the transaction, an exception is thrown. If it is already in the transaction, it is added to the original transaction for running. Unlike Required, this attribute does not automatically start new transactions;

Never: A method or component labeled with the Never attribute. It cannot be run in transactions. If the client that calls this method or component is already in the transaction, an exception is thrown.


68. The correct form of the main () method
Public static void main (String [] args ){

}

69. The correct description of the default constractor of the class: for example, when is the JVM assign?
---------- When a class is created, a default constractor is created by default.
---------- This constructor is invalid if custom settings exist.

70. How many public classes can a java source file have?
------------------ You can have multiple Class files, but public has only one

71. How does FileInputStream and FileOutputStream not throw IOException?

72. Sequence of switch case default execution
------------------- Switch first, then compare the switch value with the case. If no matching case exists, run the default statement;
73. What methods and States does the subclass inherit from the parent class?
-------------------- The subclass inherits non-private classes from the parent class, as well as classes and Methods Modified by the final keyword.
74. Which java terms can final modify?
-------------------- Final can modify classes, variables (parameters), and methods.
75. What is the execution sequence of try-catch-finally?
In this Order

 

Note: It is for learning reference only.

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.