Nine large software companies. NET face questions! Must see (with Answer) (reprint)

Source: Internet
Author: User

1:a=10,b=15, without a third-party variable, the value of a, B is exchanged 2: Known quantity group int[] max={6,5,2,9,7,4,0}; Use the quick sort algorithm to arrange it in descending order, and return to array 3: Please briefly describe the characteristics and significance of object-oriented polymorphism! 4:session like to lose value and account for memory, Cookis unsafe, what method instead of the two original method 5: The data of the concurrency of what method to handle better. 6: The Oracle database is known to have GD and ZS two databases, GD database v_s table has data write, from the v_s table to extract the latest data to the ZS Database D_e table. May I ask what method to solve this problem? If we encounter the problem of no exchange of visits, then what solution? 7: Known Oracle database, B, now under a user rights, access to a database SQL statement is select a.* from B A, please correct this sentence SQL 8: When the database for a large amount of data insertion, the database error, the cause of errors may be, Talk about your solution in your experience. 9: Algorithm analysis ah 20060625 cad001ah 20060625 cad001ah 20060625 14 44 03 CAD001 Description: The second column represents the date, the third column represents the temperature, the fourth column represents the water level, the fifth column represents the traffic, and the 6th column represents the water level station code, each column represents a field it is obvious that the first data and the second data are duplicated, but the data table has a primary key and foreign key constraints, is not allowed to have Please construct the algorithm to delete the duplicate data del 1. AnswerA=a+b;b=a-b;a=a-b; There are also perverts require the shortest code. There are two results: 1) a^=b^ (B^=A^B); 13 bytes 2) a=b+ (b=a) *0; 11 bytes 2. Answer(If you do not qualify the algorithm, you can actually use the Array.Sort () method directly)  public class Testquicksort {     private int[] array = null;      private void QuickSort (int lowest, int highest) {        if (array = = NULL | | Lowest < 0 | | lowest >= HIGHEST&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NB sp;     | | Highest >= array.length) {            return;        }        int low = lowest;         int high = highest;        int key = low++;         for (; low <= high;) {            if (Key < high) {                 if (Array[key] > Array[high]) {                    Array[high] = Array[key] + (Array[key] = Array[high]) * 0;                     key = high;                }                 high--;           }              if (key > Low) {                 if (Array[key] < Array[low]) {                     array[ Low] = Array[key] + (Array[key] = Array[low]) * 0;                    key = low;                }                 low++;           }        }        quickSort (lowest, key-1);         QuickSort (key + 1, highest);   }    /**      * @param args     */    public static void Main (string[] args) {& nbsp;       testquicksort test = new Testquicksort ();         int[] Array = {6,5,2,9,7,4,0};        Test.array = array;         test.quicksort (0, array.length-1);        int length = test.array.length;        for (int i = 0; i < length ; i++) {            System.out.println (Test.array[i]);        }   }}  Don't use bubble sort method very slow, choose sort better, But test instructions is the basic idea of fast sorting algorithm: The basic idea of fast sorting is based on the divide-and-conquer strategy. For the input sub-sequence AP: AR, if the scale is small enough to sort directly, otherwise three-step processing: Decomposition (Divide): will enter the sequence of APS. AR is divided into two non-empty sequence APs. AQ and aq+1..ar, so that the AP: The value of any element in AQ is not less than the value of any element in aq+1..ar. Recursive Solution (Conquer): The fast sorting algorithm is called by recursion to the AP respectively. AQ and aq+1..ar are sorted. Merge: Because the sort of two sub-sequences that are decomposed is in-place, so on the AP: AQ and aq+1..ar are both queued and do not need to perform any compute APS. AR has been sequenced. This solution process is in line with the basic steps of the Division method. Therefore, the fast sorting method is one of the classical application examples of divide-and-conquer method.   Algorithm Quick_sort implementation:  pascal implementation: Procedure Quick_sort (P,r:tposition;var l:tlist); {Quick Sort} var q:tposition; begin if l[p ... R] Small enough then Sort (p,r,l) {if l[p: R] is small enough to direct the l[p. R] Sort} else begin q:=partition (p,r,l); {will l[p. R] Decomposition to l[p. Q] and L[Q+1..R] two parts} quick_sort (p,q,l); {Recursive sort l[p: Q]} quick_sort (q+1,r,l); {recursive sort L[Q+1..R]} end; end;   3. AnswerObject-oriented programming uses derived inheritance and virtual function mechanisms. An object pointer to a base class can point to its derived class. and access member variables and functions inherited from the base class. The virtual function is specifically designed for this feature, which is the same name in the derived class of each base class. But function bodies are not necessarily the same, and derived classes often modify this virtual function to implement their own functionality. This allows access to a variety of different derived classes with a single pointer, and implements the specific functionality (code) of its derived classes .... 4. AnswerWith Viewstatestateserver 5. AnswerYou can control the number of connections to the connection pool. Load Balancing is OK 6. AnswerA medium-sized or large company is often composed of geographically dispersed departments that typically require data sharing. For these shared data, it can be stored on a site, and the required users are accessed from the site. The advantage of this scheme is that data consistency is easy to guarantee, but its disadvantage is also very prominent, that is, the site load, Network load, remote user data response is slow. Data replication technology can effectively solve this problem by replicating these shared data to multiple databases in different locations, enabling local access to data, reducing network load, and improving the performance of data access, and by periodically synchronizing the data in the database (usually every night). This ensures that all users are using the same, up-to-date data. This technology is suitable for applications where the number of users is large, geographically distributed, and requires real-time access to the same data. the concept and characteristics of data replication 1, the concept of data replication, and the replication of categorical data, is to copy data from the database to one or more different physical sites, thus maintaining consistency between the source database and the specified data in the target database.   According to the real-time of data replication, data replication can be divided into synchronous data replication and asynchronous data replication. Synchronous data replication refers to the replication of local production data in a completely synchronized manner, with each local IO transaction waiting for the completion of the remote replication to be released. Asynchronous data replication refers to the way in which local production data is synchronized to offsite, and every local IO transaction is released normally without waiting for remote replication to complete. Synchronous replication is strong in real time, and remote data is fully synchronized with local data. However, this method is greatly affected by the bandwidth, and the data transmission distance is relatively short. Asynchronous replication does not affect local transactions, and the transmission distance is long, but its data is slightly delayed than local data. In an asynchronous replication environment, the key to all applications is to ensure data consistency.   According to the type of replication site, data replication can be divided into multi-master Site replication, materialized view replication and hybrid replication. Multi-Master Site replication is also referred to as peer Site replication, where each site is a master site that requires information exchange with other sites and is equal between sites. Materialized view replication contains a master site, one or more materialized view sites,  the contents of a materialized view can be all copies or partial copies of the target main object at a point in time, where the target master object can be either a table on the master site or a primary materialized view on the materialized view site. Hybrid replication consists of multiple master sites and multiple materialized view sites, which are a combination of master Site replication and materialized view replication, and are suitable for complex business situations. Features of  2, data replication   data replication improves data security by establishing backups across multiple sites, as well as improving data availability, because if one site is having problems, the user can choose another site to continue, and the application can continue to operate. Thus, data replication provides a fault-tolerant protection mechanism.   However, the most basic function of data replication is to improve the performance of the database. It reduces network transport load and improves efficiency by replicating data from remote databases locally, enabling applications to access data nearby. And in the data replication system, you can provide load balancing between multiple sites, allowing these users to use this server, and several other users can   use other servers to avoid overloading some sites.   Materialized views also provide replication by subset, so that sites can replicate only the data they need, as well as reduce the amount of network traffic.   Data replication implementation method   in the concrete implementation, first of all to do a good design and planning. This requires a detailed analysis of the specific business situation, design a set of solutions to meet the needs of the business. In the design process, it is often necessary to identifyDatabase sites, the types of sites, the data objects that need to be replicated, and the synchronization methods, conflict resolution, and so on.   After the design is complete, it is possible to implement data replication, which mainly includes the following steps: (1) Create a replication site (2) Create a group object (3) Configure the conflict resolution   below we give an example of what each step needs to accomplish. In this example we use multi-master Site replication, with two master sites and two shared data tables. Two main control sites are: processing site (Cl.world) and interpretation site (Js.wo rld), two data tables are area (survey) and line. STEP1 Creating a Replication site (1) first log in to the primary site database as System identity cl.worldconnect system/[email protected](2) Create a user-replication administrator and authorize the replication administrator for the replication site creation and management, each replication site must create a replication administrator: Create user repadmin identified by repadmin; BEGIN Dbms_repcat_admin. Grant_admin_any_schema (username = ' repadmin '); END; (3) Assigning the propagator to this site is responsible for propagating the latest locally updated data to other sites: BEGIN Dbms_defer_sys. Register_propagator (username = ' repadmin '); END; (4) Designate the recipient recipient for this site to receive data transmitted by the propagator at the other site: BEGIN dbms_repcat_admin. Register_user_repgroup (username = ' repadmin ', privilege_type = ' receiver ', list_of_gnames = NULL); END; (5) Determine the purge time in order for the routed transaction queue to be too large, the successfully loaded transaction needs to be purged from the thing queue, which is set to clear once per hour. CONNECT repadmin/[email protected]BEGIN Dbms_defer_sys. Schedule_purge (next_date = Sysdate,interval = ' sysdate + 1/24 ', delay_seconds = 0); End; After establishing a good site Cl.world, the same way to create a site JS. World (6) Creating a dispatch link between each master site creating a dispatch link between each master site requires that a database link be established between the master sites before the schedule time is defined for each database link. First, create a link to the database that interprets the site at the processing site, where you need to establish a public database link for use by other private database links. CONNECT system/[email protected]CREATE public DATABASE LINK js.world USING ' Js.world '; CONNECT repadmin/[email protected]Create DATABASE link Js.world connect to repadminidentified by repadmin; Also, create a connection to the site at the interpretation site connect system/[email protected]CREATE public DATABASE LINK cl.world USING ' Cl.world '; CONNECT repadmin/[email protected]CREATE DATABASE link Cl.world CONNECT to repadminidentified by repadmin; the dispatch link determines how often transactions at this site are sent to other sites, and the following code is 10 minutes at a time: CONNECT repadmin/[email protected]Begindbms_defer_sys. Schedule_push (destination = ' Js.world ', interval = ' sysdate + (1/144) ', next_date = Sysdate,parallelism = 1,execution_seconds = 1500,delay_seconds = 1200); END; Do the same work on the interpretation site STEP2 Create a master group in a replication environment, Oracle uses groups to manage replication objects. It facilitates the management of a large number of data objects by placing related replication objects in a group. Here we assume that the user-mode Integr ation exists in both the processing site and the interpretation site, and that the table area (survey) and line lines have also been created. (1) Creating a Master Group Object CONNECT repadmin/[email protected]Begindbms_repcat. Create_master_repgroup (gname = ' inte_repg '); END; (2) Add the data object to the main control group and join the survey table to the group INTE_REPG begin Dbms_repcat. Create_master_repobject (gname = ' INTE_REPG ', type = ' TABLE ', oname = ' survey ', sname = ' integration ', use_ Existing_object = True,copy_rows = FALSE); END; In the same way, add the line gauge to the group INTE_REPG (3) in the master group adding other sites participating in replication, where synchronization between databases is specified begindbms_repcat. Add_master_database (gname = ' Inte_repg ', MASTER = ' Js.world ', use_existing_objects = True,copy_rows = False,propagation_mode = ' asynchronous '); END; (4) If a conflict can occur, you need to configure the conflict resolution. The conflict resolution is described later. (5) Generate replication support begindbms_repcat for each object. Generate_replication_support (sname = ' integration ', oname = ' survey ', type = ' TABLE ', min_communication = > TRUE); END; line is also the same (6) Start copying Begindbms_repcat again. Resume_master_activity (gname = ' inte_repg '); END; Set the interpretation site in the same way. After the setting is successful, the data copy process is declared and the data in the library can be copied. conflicting solutions in data replicationIn a replication environment, although in the database and application design process, to avoid the occurrence of inter-site conflicts, but the probability of completely avoiding the conflict is relatively small, then once the conflict occurs, you need a conflict resolution mechanism according to the specific business rules, so that the data in each site is consistent. First you need to analyze which objects are prone to conflict. In general, there is little change in static data, and there is a small likelihood of conflict, and some data changes are very large and the likelihood of conflict arises. Once you have identified the objects that are prone to conflict, you need to determine how to resolve conflicts, such as establishing priorities between sites, when data is inconsistent, whichever is on a site, or at the latest changes in a site. Oracle provides a multi-medium conflict solution that includes scenarios for update conflicts, scenarios for unique conflicts, and scenarios for deleting conflicts. In addition to these scenarios, users can customize the conflict resolution method. Each scenario has its own application, so we need to choose the right conflict solution based on the specific business. Concluding remarks This paper introduces the data replication technology in the Distributed system Oracle in detail, in the application, there are many more complicated problems to be solved, such as how to deal with the loop-dependent table or self-related table in the main control group, and how to use the template mechanism to create the materialized view site How to manage and maintain the data replication environment. These problems need to be explored and researched in practical application gradually. 7. AnswerSelect A.* from B.b a 8. AnswerFor Oracle databases, problems that may occur include the following: 1. Insufficient rollback interval--workaround, increase table Space 2. Insufficient data table space----increase data table space 3. Table space is low----increase tablespace (Oracle data table has a space limit) 4. There is not enough temporary table space---because the computed index uses a temporary tablespace, increases the tablespace or does not use the index temporarily, and the data is imported and then re-indexed 5. Other reasons, such as foreign key matching, primary key conflict, single index conflict, and so on, are mainly caused by garbage data. 9. AnswerDELETE from Table_namewhere rowid!= (SELECT MAX (ROWID) from TABLE_NAME dwhere table_name. COL1=D.COL1 and TABLE_NAME. COL2=D.COL2);

Nine large software companies. NET face questions! Must see (with Answer) (reprint)

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.