Practice questions

1. What is the MVC design pattern, its advantages and disadvantages


The MVC pattern divides the system into view, model and controller, in which the role of the controller separates the view and the model, decoupling the system , easy to modify and expand, but at the same time increases the difficulty of development.

  • Advantages:
    1. Low coupling degree, easy maintenance, and good division of labor.
    2. High reusability.
  • Disadvantages:
    1. It makes the project structure complicated and requires high requirements for developers.
    2. Suitable for large projects (expansion, frequent modification)

2. What is the SSM/SSH framework, its advantages and disadvantages, and how to use it in your program

The SSM (Spring+SpringMVC+MyBatis) framework set is composed of two open source frameworks, Spring and MyBatis (SpringMVC is part of Spring). Often used as a framework for web projects with simpler data sources.

Spring

Spring is like a large factory for assembling beans in the entire project. In the configuration file, you can specify specific parameters to call the constructor of the entity class to instantiate the object. It can also be called the glue in the project.

The core idea of ​​Spring is IoC (Inversion of Control), that is, it is no longer necessary for programmers to explicitly new an object, but to let the Spring framework do it for you.

SpringMVC

SpringMVC intercepts user requests in the project. Its core Servlet, DispatcherServlet, assumes the role of intermediary or front desk, and matches user requests with the Controller through HandlerMapping. The Controller is the specific operation performed by the corresponding request. SpringMVC is equivalent to struts in the SSH framework.

my shoe

mybatis is an encapsulation of jdbc, which makes the underlying operation of the database transparent. The operations of mybatis revolve around a sqlSessionFactory instance. Mybatis is associated to the Mapper file of each entity class through the configuration file. The Mapper file configures the SQL statement mapping required by each class to the database. Every time you interact with the database, get a sqlSession through sqlSessionFactory, and then execute the sql command.

The page sends a request to the controller, the controller calls the business layer to process the logic, the logic layer sends the request to the persistence layer, the persistence layer interacts with the database, and returns the result to the business layer, the business layer sends the processing logic to the controller, and the controller calls the view to display the data.

3. What technologies are used in the front end (such as CSS, HTML)

4. Why choose MySQL database (see what database you are using)

1. Mysql has excellent performance, stable service, and rare abnormal downtime.

2. Mysql is open source and has no copyright restrictions, autonomy and low cost of use.

3. Mysql has a long history, and the community and users are very active. If you encounter problems, you can ask for help.

4. The mysql software is small in size, easy to install and use, and easy to maintain, with low installation and maintenance costs.

5. The word-of-mouth effect of the mysql brand makes companies use it directly without thinking about it, and the popular architecture of lamp and lnmp .

6. mysql supports multiple operating systems, provides multiple API interfaces, and supports multiple development languages, especially the popular PHP language.

5. What is data integrity? What are the types of data integrity? What is entity integrity implemented in the table? (database issues)

Data integrity refers to the accuracy, consistency and completeness of data. In databases, data integrity refers to ensuring that data is correct and consistent, and that data is not accidentally or intentionally deleted, modified, or tampered with. Data integrity can be achieved through various technical means, such as using constraints, triggers, transactions, and so on. Data integrity is a very important aspect in a database management system because it ensures the reliability and availability of data, thus guaranteeing the quality and value of data.

Data integrity generally falls into the following categories:

1. Entity integrity: ensure that each row of data in the table has a unique identifier, such as a primary key, to ensure the uniqueness of the data.

2. Domain integrity: Ensure that data is within a specific range, such as data type, length, format, etc.

3. Referential integrity: Ensure that the foreign keys in the tables match the primary keys in the associated tables to ensure data consistency.

4. User-defined integrity: Ensure data meets specific business rules, such as checking date ranges, checking logical relationships of data, etc.

5. Database integrity: ensure the correctness of the structure and content of the database, such as checking the integrity of tables and indexes, checking the consistency of data, etc.

Entity integrity is achieved by defining primary and foreign keys in database tables. A primary key is a field that uniquely identifies each record in a table, ensuring that each record has a unique identifier. A foreign key is a field that points to the primary key in another table, which ensures the correctness of the relationship between the tables. By defining primary keys and foreign keys, you can ensure that the data in the table meets the requirements of entity integrity, that is, each record has a unique identifier, and the relationship between tables is correct. If an attempt to insert or update data violates the rules of entity integrity, the database rejects the operation and returns an error message.

6. Describe what a class is, and what is encapsulated in the class?

In Java, a class is an abstract data type, which is a collection of data and methods used to describe objects with the same attributes and behaviors. Classes are the foundation of object-oriented programming, and they can be seen as templates or blueprints for objects, used to create instances of objects. Classes encapsulate data and methods. Data are attributes of a class, also known as member variables, that describe the state of an object. A method is the behavior of a class, also known as a member method, used to describe the operation of an object. The data and methods in the class can be restricted by access control characters to achieve the characteristics of encapsulation. Through encapsulation, classes can hide internal implementation details and only expose necessary interfaces, improving code maintainability and security.

7. Does the search function support fuzzy query? How did it happen?

The search function can support fuzzy query, and the implementation methods generally include the following: 1. Wildcard query: use wildcard characters (such as * or ?) to match any character in the query keyword. For example, when querying for "apple", you can use "app*" or "a?ple" to match. 2. Fuzzy query: Use fuzzy query symbols (such as ~ or %) to match similar characters in the query keyword. For example, when querying for "apple", you can use "appl~" or "appl%" to match. 3. Pinyin query: Fuzzy query can be realized by using pinyin query. For example, when querying "Zhang San", you can use "zhangsan" or "zhansan" to match. 4. Word segmentation query: use word segmentation technology to segment query keywords, and then match the results after word segmentation. For example, when querying "Apple mobile phone", it can be segmented into "Apple" and "Mobile phone", and then matched respectively.

8. What are the steps of database design?

1. Requirements analysis: clarify the needs of users and the functions of the database, and determine the goals and scope of the database. 2. Conceptual design: According to the requirements analysis results, design the conceptual model of the database, including entities, attributes, relationships, etc. 3. Logical design: transform the conceptual model into a logical model, including relational patterns, paradigms, constraints, etc. 4. Physical design: Design the physical structure of the database according to the logical model, including tables, indexes, views, etc. 5. Implementation and maintenance: Complete the implementation and maintenance of the database according to the design, including data import, backup, recovery, etc.

9. What are primary keys and foreign keys?

A primary key is a column or set of columns whose values ​​uniquely identify each row of data in a table. The role of the primary key is to ensure the uniqueness of each row of data in the table, and it can also be used as a foreign key in other tables. A foreign key is a column in one table whose value corresponds to a primary key in another table. The function of the foreign key is to establish the relationship between tables, so that data can be associated with queries and operations. For example, suppose there are two tables, one is the student table and the other is the class table. There is a student ID column in the student table as the primary key, and a student ID column in the course table as the foreign key, which is related to the student table

10. What is the use case?

In computer science, a use case is a description of how a system interacts with external users, systems, or other entities. Use cases are usually used in the software development process to help developers understand the functional requirements and user requirements of the system, so as to better design and implement the system. A use case usually includes a scenario description that describes how a user interacts with the system to accomplish a specific task. Use cases can also include other elements such as pre-conditions, post-conditions, exceptions, etc.

11. What test method is used? Advantages and disadvantages

Advantages: 1. Potential errors and defects in the code can be detected to improve software quality. 2. Can be tested for each branch and path of the code, with high coverage. 3. The performance problems in the code can be found in advance and the code performance can be optimized. 4. It can help developers better understand the code and improve code quality. Disadvantages: 1. It requires testers to have certain programming skills and code understanding. 2. Testers need to access and understand the code, which may reveal the confidentiality of the code. 3. For large-scale software systems, testers need to spend a lot of time and effort on testing. 4. Only the existing logic in the code can be tested, and potential logic problems in the code cannot be found.

12. The purpose of the test

The main purpose of software testing is to ensure that software is of high quality and reliability before being delivered to users. Through testing, defects and errors in the software can be found and repaired, ensuring that the software's functions, performance, security, ease of use, etc. meet the needs and expectations of users. In addition, software testing can also help improve the efficiency and quality of the software development process, and reduce the cost and risk of later maintenance and repair.

13. How is this function realized? (e.g. paging functionality)

14. What is the ER diagram? What is the entity represented by?

An ER diagram refers to an entity-relationship diagram, which is a graphical tool used to describe entities in a system and the relationships between them. In the ER diagram, entities are represented by rectangles, relationships are represented by diamonds, and attributes are represented by ovals. The attributes of an entity describe the characteristics of the entity, and the relationship describes the connection between entities. Through the ER diagram, the relationship between various entities in the system can be clearly expressed, which is helpful for system design and development.

15. Flow chart elements? Sequence diagram elements?

Flowchart elements include:

1. Start/End: Indicates the beginning or end of a process.

2. Operation/Activity: Indicates a specific operation or activity in the process.

3. Judgment/Decision: Indicates a judgment or decision in a process.

4. Connection line: Indicates the connection relationship between elements in the process.

5. Data/Document: Indicates the data or document in the process.

Sequence diagram elements include:

1. Object: Indicates the object participating in the interaction, which can be a system, module, class, method, etc.

2. Life cycle line: indicates the life cycle of the object, that is, the existence time of the object on the time axis.

3. Message: Indicates the interactive messages between objects, including synchronous messages, asynchronous messages, return messages, etc.

4. Control flow: Indicates the control flow between objects, including conditional branches, loops, etc.

5. Combined fragment: represents a group of related messages and control flow, which can be used to simplify the representation of sequence diagram.

16. What is the role of use case diagram and the relationship between use cases?

A use case diagram is a graphical tool used to describe the functional requirements of the system. It is mainly used to help analyze and design the functional requirements of the system and the way to interact with users. The role of use case diagrams include:

1. Describe the functional requirements of the system: Use case diagrams can clearly describe the functional requirements of the system, helping the development team and users to better understand the functions of the system.

2. Display the use cases of the system: Use case diagrams can display the use cases of the system, helping the development team and users to better understand the use cases of the system.

3. Show the relationship between use cases: Use case diagrams can show the relationship between use cases, helping the development team and users to better understand the relationship between use cases.

4. Show the role of the system: Use case diagrams can show the role of the system, helping the development team and users to better understand the role of the system.

Relationships between use cases include:

1. Include relationship (Include): A use case contains another use case, which means that the execution of one use case depends on the execution of another use case.

2. Extend relationship (Extend): A use case can extend another use case, which means that a use case can be extended on the basis of another use case.

3. Generalization: A use case can be generalized to another use case, indicating that one use case is a special case of another use case.

4. Association: A use case can be associated with one or more other use cases, indicating that there is an association relationship between use cases.

17. How to pass value on the page?

1. URL value passing: You can pass the value through the query string of the URL (that is, the parameter after the question mark in the URL), for example: http://www.example.com/index.html?id=123&name=Tom. In the receiving page, the passed value can be obtained by obtaining the query string in the URL. 2. Form value passing: Values ​​can be passed through form submission, for example: use the POST method to submit a form, and the form contains an input box named "username", and the value filled in the input box can be obtained through the background program. 3. Cookie value passing: you can pass the value by setting the cookie, for example: set a cookie named "username" in page A, and then get the value of the cookie in page B. 4. Session value passing: You can pass values ​​through Session, for example: store a value named "username" in Session in page A, and then get the value in this Session in page B. 5. AJAX value transfer: AJAX technology can be used to transfer values, for example: use JavaScript code to send a request through AJAX, and send the value to be transferred to the background program as a request parameter.

18. What difficulties were encountered during the development process and how were they resolved?

20. What functions have been realized?

21. Why choose B/S framework?

B/S framework (Browser/Server) is an application architecture based on browser and server. Compared with C/S framework (Client/Server), B/S framework has the following advantages:

1. Cross-platform: B/S architecture applications can run on any operating system that supports browsers, while C/S architecture applications need to write different client programs for each operating system.

2. Maintainability: B/S architecture applications only need to be maintained and upgraded on the server side, and the client does not need to perform any operations, while C/S architecture applications need to be maintained and upgraded on each client.

3. Security: B/S architecture applications can be safely controlled on the server side, and the client cannot modify the code and data of the application, while C/S architecture applications may be tampered by the client.

4. Ease of use: B/S architecture applications only need a browser to access without installing a client program, while C/S architecture applications need to install a client program before they can be used.

To sum up, the B/S framework has the advantages of cross-platform, maintainability, security, and ease of use, so it is widely used in Web application development.

Guess you like

Origin blog.csdn.net/weixin_53031149/article/details/130817738