Working 3-year Java surface question finishing

Source: Internet
Author: User
Tags http post

Basic topics
    1. status of the Java thread one. Thread state type:
      1. New state: A new Thread object was created.
      2. Ready state (Runnable): After the thread object is created, other threads call the object's start () method. The state of the thread is located in a pool of running threads that becomes operational and waits for the CPU to be used.
      3. Running state (Running): The ready state of the thread gets the CPU and executes the program code.
      4. Blocking state (Blocked): The blocking state is a temporary stop for a thread that has abandoned the CPU usage for some reason. Until the thread is in a ready state, the opportunity to go to the running state is reached. There are three types of blocking:
      (i), waiting for blocking: The running thread executes the wait () method, and the JVM puts the thread into the waiting pool.
      (ii), synchronous blocking: When a running thread acquires a synchronization lock on an object, the JVM puts the thread into the lock pool if the synchronization lock is occupied by another thread.
      (iii), other blocking: The running thread executes the sleep () or join () method, or when an I/O request is made, the JVM will place the thread in a blocked state. When the sleep () state times out, join () waits for the thread to terminate or time out, or the I/O process finishes, the thread is re-entered in a ready state.
      5. Death status (Dead): The thread finishes executing or exits the run () method because of an exception, and the thread ends the life cycle.
      Two. Thread state diagram

    2. Differences between processes and threads, how interprocess communicates, and how threads communicate with each other

    3. What is the data structure of HashMap? How it is implemented. The difference between the Hashtable,concurrenthashmap and the

Http://www.cnblogs.com/infinityu/articles/3188266.html

  1. The difference between a cookie and a session

    The difference between a cookie and a session:

    1. The cookie data is stored on the client's browser and the session data is placed on the server.

    2, the cookie is not very safe, others can analyze the cookie stored in the local and cookie deception
    Consider that security should use the session.

    3. Session will be saved on the server for a certain period of time. When access is increased, it will be more likely to occupy your server's performance
    The cookie should be used in consideration of mitigating server performance.

    4, a single cookie can not save more than 4K of data, many browsers restrict a site to save up to 20 cookies.

    5, so personal advice:
    Storing important information such as login information as session
    Additional information can be placed in a cookie if it needs to be retained

  2. What's the use of indexes? How do I build an index?

    How SQL creates indexes and how to create indexes
    The role of SQL to create indexes
    First, the advantages of using the index:
    1, unique index to ensure the uniqueness of the data 2, speed up the retrieval of data 3, speed up the connection between tables 4, reduce grouping and sorting time
    5. Improve system performance by using the optimized stealth device
    Second, the principle of using the index:
    1. CREATE index 2 on columns that need to be searched frequently, create index on primary key
    3. Create indexes on columns that are often used for connections
    4. Create an index on a column that often needs to be searched based on the scope 5, the column that often needs to be sorted
    6. Create an index on a column that is often used in a WHERE clause
    Third, the principle of not creating indexes:
    1. Queries rarely used and referenced columns are not indexed 2, columns with only a few values are not indexed
    3. Columns defined as text, image, bit are not indexed
    4. Indexes should not be built when update performance is much higher than select performance
    Four, the commonly used commands:
    1. Sp_helpindex: Index information on a report table or view
    2. DBCC SHOWCONTIG: Displays fragmentation information for data and indexes for the specified table 3, DBCC DBREINDEX: rebuilding one or more indexes in the specified database
    4. DBCC INDEXDEFRAG: Defragment a clustered index or secondary index that specifies a table or view
    Five, optimize the index:
    1. Rebuild index (DBCC DBREINDEX) 2, Index Tuning Wizard
    3. Defragment the clustered index and secondary index fragmentation for the specified table or view (DBCC INDEXEFRAG)
    How to create an index
    The CREATE INDEX statement is used for creating indexes in the table.
    Indexes enable database applications to find data faster without reading the entire table. Index
    You can create indexes in a table to query data more quickly and efficiently.

  3. How is ArrayList implemented, the difference between ArrayList and linedlist? ArrayList how to achieve capacity expansion.

  4. The Equals method implements

  5. Object oriented

  6. Thread state, what's the difference between blocked and waiting

    Watting is a thread called object.wait () that is waiting for another thread to call Object.notify () or Object.notifyall () on the object.
    Blocked refers to a thread waiting to acquire a lock.
    Summary: BLOCKED and waiting are non-active thread states. The waiting thread is already allocated CPU time, but waits for the event to occur so that the CPU is released voluntarily until certain events are completed and notify () wake is called, that is, the waitting thread does not want the CPU time itself now, but The blocked thread is desired, but the blocked thread does not get the lock, so the blocked thread is not available . Luo Zhiyong Link: https://www.zhihu.com/question/27654579/answer/97448656 Source: Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
  7. How the JVM loads bytecode files

  8. JVM GC,GC algorithm.

  9. What happens when the full GC is present, and what happens to the Yong GC.

  10. JVM Memory model

  11. Java Runtime Data area

  12. How transactions are implemented

Technical depth
    1. Have you seen the JDK source code, see the class implementation principle is what.

    2. HTTP protocol

    3. TCP protocol

    4. Consistent hash algorithm

    5. How the JVM loads bytecode files

http://blog.csdn.net/likika2012/article/details/45575285

When we use a command to execute a Java program (such as Test.class): Java Test
(1) Java.exe will help us find the JRE, and then find the Jvm.dll located inside the JRE, which is the real Java virtual machine, finally loading the dynamic library and activating the Java Virtual machine.
(2) After the virtual machine activates, it will do some initialization actions, such as reading the system parameters. Once the initialization action is complete, the first class loader ――bootstrap Loader ( startup class loader ) is generated.
(3) In the initial work done by Bootstrap Loader, in addition to some basic initialization actions, the most important thing is to load the Extclassloader ( Extension class loader) in Launcher.java and set its Parent to NULL, which represents its parent loader as Bootstraploader.
(4) The Bootstrap Loader then asks to load the Appclassloader ( user-defined class loader ) in Launcher.java, and sets its Parent as the Extclassloader entity that was previously generated. Both loaders exist in the form of static classes.

    1. How the ClassLoader unloads bytecode

    2. The difference between IO and NIO, NIO benefits

    3. Java thread Pool Implementation principle, KeepAliveTime parameters such as the role.

    4. HTTP connection Pooling Implementation principle

    5. Database connection pooling Implementation principles

    6. How the database is implemented

Technical framework
    1. See what open source framework of source code

    2. What are the pros and cons of using Redis,redis? How does redis achieve capacity expansion?

    3. Netty is how to use the thread pool, why use it so

    4. What are the pros and cons of using spring,spring?

    5. Spring's IOC container initialization process

    6. Spring's IOC container implementation principle, why beans can be found through byname and Bytype

    7. Spring AOP Implementation Principles

    8. How the message middleware is implemented, and what are the technical difficulties

System architecture
    1. How to build a highly available system

    2. Which design patterns can increase the scalability of the system

    3. Introduces design patterns such as template mode, command mode, policy mode, adapter mode, bridging mode, decoration mode, observer mode, state mode, visitor mode.

    4. Abstract ability, how to improve the efficiency of research and development.

    5. What is high cohesion low coupling, please give examples of how to achieve

    6. What situation with the interface, what condition with the message

    7. If AB two systems depend on each other, how to release dependencies

    8. How to write a design document, what is a directory

    9. What scenarios should be split system, what scenario should merge system

    10. What is the difference between the system and the module, and what scenarios are used

Distributed Systems
    1. Distributed transactions, two-phase commit.

    2. How to implement a distributed lock

    3. How to implement distributed session

    4. How to guarantee the consistency of messages

    5. Load Balancing

    6. Forward proxy (client proxy) and reverse proxy (server-side proxy)

    7. CDN Implementation Principle

    8. How to improve the system's QPS and throughput

Actual combat capability
    1. Have you dealt with the problem on the line? There is a memory leak, a CPU utilization level, and how the application is handled without responding.

    2. Have you encountered any technical problems in the development? How to solve the

    3. If there is a billions of whitelist, high concurrent queries are required daily during the day and need to be updated at night to design this feature.

    4. How Sina Weibo is enabling Twitter to Subscribers

    5. How Google returns the search results to the user within a second.

    6. 12306 how the booking system of the website is implemented, how to ensure that no ticket is not oversold.

    7. How to implement a second kill system, to ensure that only a few users can buy a product.

Soft power
    1. How to learn a new technology, such as how to learn Java, focus on learning what

    2. What new technologies are in focus

    3. How to deal with a lot of work tasks and very miscellaneous

    4. How Project Latency is handled

    5. It's not the same as my colleagues ' design ideas.

    6. How to ensure the quality of development

    7. What is career planning? Short term, what is the long term goal

    8. What is the planning of the team?

    9. To introduce myself from work to the present and grow there

  • A pen test for an internet company
  • What are the properties of spring transactions? What are the isolation levels for transactions? What scenarios need to use these kinds of transactions.

    Where spring seven things propagate properties:
    Propagation_required--Supports the current transaction and creates a new transaction if there is no current transaction. This is the most common choice.
    Propagation_supports-supports the current transaction and is executed in a non-transactional manner if no transaction is currently in use.
    Propagation_mandatory--Supports the current transaction and throws an exception if there is no current transaction.
    Propagation_requires_new--Creates a new transaction and suspends the current transaction if there is a transaction currently in place.
    Propagation_not_supported--Performs the operation in a non-transactional manner, suspending the current transaction if a transaction is currently present.
    Propagation_never--executes in a non-transactional manner and throws an exception if a transaction is currently present.
    Propagation_nested--executes within a nested transaction if a transaction is currently present. If there is currently no transaction,
    Do something similar to propagation_required.

    Five isolation levels:
    Isolation_default This is a platfromtransactionmanager default isolation level that uses the default transaction isolation level of the database.
    The other four correspond to the isolation level of JDBC;
    Isolation_read_uncommitted This is the lowest isolation level for transactions, and it allows a transaction to see uncommitted data for this transaction.
    This isolation level produces dirty reads, non-repeatable reads, and Phantom reads.

    Isolation_read_committed guarantees that a transaction modified data is committed before it can be read by another transaction. Another transaction cannot read
    The data that the transaction did not commit. This level of transaction isolation avoids dirty reads, but non-repeatable reads and phantom reads can occur.

    Isolation_repeatable_read This transaction isolation level prevents dirty reads and cannot be read repeatedly. However, Phantom reads may occur. It is in addition to guaranteeing
    One transaction cannot read the uncommitted data of another transaction, and also ensures that the following conditions are avoided (non-repeatable read).

    Isolation_serializable This is the most cost-effective, but most reliable, transaction isolation level. Transactions are processed for sequential execution. In addition to preventing dirty reading,
    It is not repeatable to read, but also avoids phantom reading.

  • The pros and cons of optimistic locking and pessimistic locking, for example?

    Pessimistic lock (pessimistic lock), as the name implies, is very pessimistic, every time to take the data when they think others will change, so every time when the data are locked, so that others want to take this data will block until it gets the lock. Traditional relational database in the use of a lot of this locking mechanism, such as row locks, table locks, read locks, write locks, etc., are in operation before the lock.

    Optimistic lock (optimistic lock), as the name implies, is very optimistic, every time to take the data when they think others will not be modified, so will not be locked, but in the update will be judged in the period when others have to update this data, you can use the version number and other mechanisms. Optimistic locking is useful for multi-read application types, which can improve throughput, such as the fact that a database provides an optimistic lock similar to the write_condition mechanism.

    The two kinds of locks have advantages and disadvantages, not to think of one better than the other, like the optimistic lock for less write, that is, the conflict really rarely occurs, this can save the lock overhead, increase the overall system throughput. However, if there is frequent conflict, the upper application will continue to retry, which is to reduce the performance, so in this case, pessimistic locking is more appropriate.

  • What is idempotent, what is base, what is cap

    http://blog.csdn.net/dellme99/article/details/15340955

    Cap:consistency, availability, partition-tolerance

    Strong consistency (consistency). the system is still in a consistent state after an operation has been performed. In a distributed system, when the update operation succeeds, all users should read to the most recent value, and such a system is considered strong consistency.

    availability (availability). Each operation is always able to return results within a certain amount of time, where it is important to note that "within a certain period of time" and "return results".

    Partition fault tolerance (Partition tolerance). partition fault tolerance can be understood as the system can still accept requests (for consistency and availability) in the presence of a network partition. The network partition is that for some reason the network is divided into a number of isolated areas, and the region is not connected to each other. Others understand partitioning fault tolerance as the system's ability to dynamically join and leave nodes, because joining and leaving a node can be considered a network partition within a cluster.

    BASE

    Weak consistency protocol

    Basic availability (basically Available): The system is capable of basic operation and has been providing services.

    Soft State (Soft-state): The system is not required to maintain a strong consistent state.

    Final consistency (eventual consistency): The system needs to meet the conformance requirements after a certain time

  • Advantages and disadvantages of annotation generics

  • There are several ways to implement multithreading in Java, what is each? There are several ways to implement synchronization, what are the differences? What is the scenario in which you use synchronization in development?

  • How to avoid duplicate submissions of form forms

  • What is an XSS attack? How to prevent?

  • What is the difference between a get and post for an HTTP request? What is the difference between a cookie and a session?

Get and post requests differ by GET request
GET /books/?sex=man&name=Professional HTTP/1.1Host: www.wrox.comUser-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6)Gecko/20050225 Firefox/1.0.1Connection: Keep-Alive

Note that the last line is a blank line

POST request
POST / HTTP/1.1Host: www.wrox.comUser-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6)Gecko/20050225 Firefox/1.0.1Content-Type: application/x-www-form-urlencodedContent-Length: 40Connection: Keep-Alivename=Professional%20Ajax&publisher=Wiley

1, get commits, the requested data will be appended to the URL (that is, the data placed in the HTTP protocol header), to split the URL and transfer data, multiple parameters with & connection; for example: login.action?name=hyddd&password= Idontknow&verify=%e4%bd%a0%E5%A5%BD. If the data is an English letter/number, sent as is, if it is a space, converted to +, if it is Chinese/other characters, the string is directly encrypted with BASE64, such as:%E4%BD%A0%E5%A5%BD, where the xx in%xx is the symbol in 16 binary notation ASCII.

Post submission: Place the submitted data in the package of the HTTP packet. In the example above, the red font indicates the actual transfer data

As a result, the data submitted by get is displayed in the Address bar, while the post is submitted, the address bar does not change

2, the size of the transmitted data: first of all: the HTTP protocol does not restrict the size of the transmitted data, the HTTP protocol specification does not limit the length of the URL.

The main limitations in the actual development are:

GET: Specific browsers and servers have restrictions on URL length, such as IE's limit on URL length is 2083 bytes (2k+35). For other browsers, such as Netscape, Firefox, etc., there is theoretically no length limit, and its limitations depend on the support of the operating system.

Therefore, for a get commit, the transmitted data is limited by the URL length.

POST: The theoretical data is not limited because it is not transmitted via a URL. However, the actual Web server will be required to limit the size of the post submission data, Apache, IIS6 have their own configuration.

3. Security

The security of post is higher than the security of get. For example: Through get submit data, user name and password will appear in plaintext on the URL, because (1) the login page may be cached by the browser, (2) Other people to view the browser's history, then others can get your account number and password, in addition, Using get to submit data may also cause Cross-site request forgery attack

4. The HTTP GET,POST,SOAP protocol is all running on HTTP

(1) Get: The request parameter is appended to the URL as a sequence of key/value pairs (query string)
The length of the query string is limited by the Web browser and Web server (ie supports up to 2048 characters) and is not suitable for transporting large datasets at the same time, it is unsafe

(2) Post: The request parameter is transmitted in a different part of the HTTP header (named entity body), which is used to transfer the form information, so the Content-type must be set to: application/x-www-form- Urlencoded. The post is designed to support user fields on Web Forms, and its parameters are also transmitted as key/value.
However: it does not support complex data types, because post does not define the semantics and rules for transferring data structures.

(3) Soap: is a dedicated version of HTTP POST, followed by a special XML message format
Content-type is set to: Text/xml Any data can be XML.

The HTTP protocol defines a number of ways to interact with the server, the most basic of which are 4, get,post,put,delete, respectively. A URL address is used to describe a resource on a network, and the Get, POST, PUT, delete in HTTP corresponds to the search for this resource, change, increase, delete 4 operations. Our most common is get and post. Get is typically used to get/query resource information, and post is typically used to update resource information.

Let's look at the difference between get and post

      1. Get submitted data is placed after the URL, to split the URL and transfer data, the parameters are connected with &, such as editposts.aspx?name=test1&id=123456. The Post method is to put the submitted data in the body of the HTTP packet.

      2. The data size for get commits is limited (because the browser has a limit on the length of the URL), and there is no limit to the data submitted by the Post method.

      3. The Get method needs to use Request.QueryString to get the value of the variable, and the Post method takes the value of the variable by Request.Form.

      4. The Get method submits the data, which brings security problems, such as a login page, when the data is submitted via get, the user name and password will appear on the URL, and if the page can be cached or someone else can access the machine, the user's account and password can be obtained from the history record.

    • What do you mean session adhesion? What scenes require session adhesion? Why?

    • List as many of the common Linux commands you have used and briefly describe their capabilities.

    • Programming Questions: First person 10, the second is 2 years older than the first, recursion in turn, please use recursion to figure out how big the 82nd person? (Please use the optimization algorithm to implement)

    • What are the performance tuning methods used in the project, please illustrate

http://www.csdn.net/article/2012-06-21/2806814
    • Algorithm title: Massive log data, extract the most visited IP in a week, design optimization algorithm, and deduce the complexity of the algorithm

The first is this day, and is to visit Baidu's log in the IP out to write to a large file. Note that the IP is 32-bit and has a maximum of 2^32 IP. The same can be used to map the method, such as module 1000, the entire large file mapping to 1000 small files, and then find out the frequency of each of the most frequent IP (can be used hash_map frequency statistics, and then find the largest number of frequencies) and the corresponding frequency. Then in the 1000 largest IP, find out the most frequent IP, that is, the request.
Or as described below (the Eagle of the Snow field):
Algorithm idea: Divide and conquer +hash
The 1.IP address has a maximum of 2^32=4g, so it can not be fully loaded into memory processing;
2. You can consider the idea of "divide and conquer", according to the IP address of the hash (IP)%1024 value, the vast number of IP logs stored in 1024 small files. Thus, each small file contains a maximum of 4MB IP addresses;
3. For each small file, you can build a hash map with the IP key, the number of occurrences, and the most current occurrence of the IP address;
4. You can get the most occurrences of IP in 1024 small files, and then get the most occurrences of IP based on the general sorting algorithm;

Working 3-year Java surface question finishing

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.