Mingyuan interview. The written examination questions are as follows:
I. SQL test questions
1 has two tables
Based on the given SQL statement, what are the number of rows returned? For visual display, I gave the SQL statement execution results.
A student table B Score Table
New question
Select a. * from a inner join B on a. id = B. id;
Select a. * from a, B where a. id = B. id
Select a. * from a left join B on a. id = B. id;
Select a. * from a right join B on a. id = B. id;
Select a. * from a right join B on a. id = B. id and a. id <7;
Select a. * from a right join B on a. id = B. id where a. id <7
Old questions
Select B. * from a left join B on a. id = B. id;
Select B. * from a left join B on a. id = B. id;
Select B. * from a right join B on a. id = B. id;
What are the number of rows returned by the preceding statement?
Answer: see the figure below.
(1) Delete the score with age 18-30
Delete from B where B. id in
(Select id from
Where age between 18 and 35)
(2) Calculate the ID, name, subject, and score of the first two students in each course? (Classic, it took me a long time)
Select b1.subject, b1.score, a. * from B b1 left join a on a. id = b1.id
Where b1.id in (
Select id from B where score in
(Select distinct top 2 score from B where subject = b1.subject order by score desc ))
Order by b1.subject, b1.score desc
(3) implement the following format:
This is a row-to-column Conversion
Select B. ID,
Sum (case when B. Subject = 'China' then score end) language,
Sum (case when B. Subject = 'mate' then score end) Mathematics
From B group by B. id
Note: The underlined content is the content to be filled in.
(4) create a View query ID, name, age, subject, and score. If a student has multiple records, are all displayed?
If exists (select * from sysobjects where name = 'get _ score ')
Drop view get_score;
Create view get_score
As
Select a. id, a. name, B. subject, B. score from a left join B on a. id = B. id;
(5) Create a New stored procedure and enter the student ID (input parameters of the stored procedure). The student name and average score are displayed, in the following format: Li
Create procedure get_avgScore (@ id int)
As
Declare @ name varchar (50)
Declare @ avg float
Begin
Select @ name = a. name + ':', @ avg = avg (score) from a left join B on a. id = B. id
Where a. id = @ id group by (a. name + ':')
Print (@ name + cast (@ avg as varchar (4 )))
End;
Exec get_avgScore 4
Ii. asp.net test questions
(1) list the methods for page redirection and explain (at least two)
(2) ASP. NET page value-passing centralized method, and analyze its advantages and disadvantages (at least two types)
(3) Notes on URL value passing (at least two points)
1. URLPass Value
This is a classic value transfer method, such as XXX. aspx? Id = 1 & name = c; however, the passed value is displayed in the address bar of the browser, and the object cannot be passed. Therefore, this method is generally used when the passed value is small and the security requirements are not high.
2. Session passed Value
This method stores each piece of data in server variables and can transmit a large amount of data, which is highly secure. Therefore, it is often used for user identity verification. However, if the Session variable stores too much data, it will consume too much server resources. programmers should exercise caution when using it. Sessions can be shared among multiple pages of the application by name/value pairs until the browser user closes his or her browser or the server Session times out (configurable, the default value is 20 minutes.
Session has the following features:
Session data is stored on the server;
The Session can store any type of data;
The default life cycle of a Session is 20 minutes. You can manually set a longer or shorter time.
3. Cookie pass value
Cookie is a special data storage method, because it stores data in the browser's computer and exists in the disk as a text file. This method is very interesting. Many login systems use cookies to automatically log on to users. That is, the login information of a user login will be written into the Cookie file of the user's computer. The website will automatically read the Cookie for authentication at the next login. Although it is convenient to transmit data through cookies, the storage time can be set freely, but the security is not high, programmers should not rely too much on cookies, but should use a combination of methods to store sensitive data.
Cookie-based data storage has the following features:
The data in the Cookie is stored on the client;
Cookies can only store string-type data. If you need to save other types of data in cookies, you need to convert the data to string-type data and save it;
The Cookie also has its default life cycle. You can also manually set it to expire after 50 years at most.
4. Server. Transfer
This method has many steps. You can use this method to access values on another page by exposing object attributes. This method is object-oriented. The code of this method is not complex. First, you can define a public permission attribute to return the value to be passed. Then, on the second page, use the Context. Handler attribute to obtain the reference of the instance object on the previous page. You can access the custom attribute to obtain the required value.
5. Application
Strictly speaking, the HTTP application object generates a status variable on the server to store the required information. The availability of the HttpApplication object variable covers the entire WEB application. Therefore, this object generally stores information to be published, such as the number of online users. This method is not used for sensitive data involving individual users. The HttpApplication object has two common methods: Lock and UnLock, which can be used to process data written by multiple users in the Application variable. The Lock method locks all Application variables to prevent other users from modifying the variable values of the Application object. The UnLock method unlocks the variables of the HttpApplication object. The method for passing values through the HttpApplication object is similar to that of the Session, but the Session is for each individual user. When the user closes the browser, the Session fails. The variables stored in HttpApplication object are for all users accessing the program. Even if a user closes the browser, the value of the variables will not be lost.
6. Cross-page Transfer
Cross-page Transfer is similar to the Transfer method that calls the HttpServerUtility object, but it is more efficient. Because the Transfer method that calls the HttpServerUtility object is a server-based method, and cross-page Transfer is a browser-based method. This method is mainly used to set the "PostBackUrl" attribute of the control, so that the control (such as Button) is switched to the specified page after the operation, in addition, this specified page can directly obtain all the control objects and their attribute values on the previous page.
7.If you have special requirements, you can also use other methods, such as using a database to store temporary data.
(4) implement with code: Create an XML document and read the string "<item> NBA </item>" to the document.
Public void addxml ()
{
XmlDocument doc = new XmlDocument ();
Doc. LoadXml ("<item> NBA </item> ");
Doc. Save ("doc. xml ");
}
(5) Explain the packing and unpacking, and attach the code description.
Public void show ()
{
Int val = 100;
Object obj = val;
Response. Write ("object Value:" + obj + "<br/> ");
// This is a packing process, which converts the value type to the reference type.
Int vals = 100;
Object objs = val;
Int num = (int) objs;
Response. Write ("num:" + num );
// This Is A unpacking process. It is a process of converting the value type to the reference type and then converting the reference type to the value type.
}
(6) 1. Write the result
Public abstract class
{
Public ()
{
Console. WriteLine ('A ');
}
Public virtual void Fun ()
{
Console. WriteLine ("A. Fun ()");
}
}
Public class B:
{
Public B ()
{
Console. WriteLine ('B ');
}
Public newvoid Fun ()
{
Console. WriteLine ("B. Fun ()");
}
Public static void Main ()
{
A a = new B ();
A. Fun ();
}
}
Result: A, B, A. Fun ();
3. Scenario
There are many types of real estate projects. Each project has different types of houses. For example, ordinary commercial houses are priced based on area * average price, while villas are priced based on quantity.
Scenario B
The company's boss and sales director hope to immediately learn about the sales of the Real Estate
(1) use UML to describe the relationship between objects in.
(2) create tables for each object in A. Set the table name and field.
(3) Use a design mode (encoding Implementation) in combination with scenario B)
4 handwriting code to implement the following table style
A: The Code is as follows:
<Table style = "background-color: # ffffff" border = "1px">
<Tr>
<Td rowspan = "2" width = "120px" height = "25px"> 1 </td>
<Td width = "120px" class = "style1"> 2 </td>
<Td width = "120px" class = "style1"> 3 </td>
</Tr>
<Tr>
<Td colspan = "2" rowspan = "2"> 5 </td>
</Tr>
<Tr>
<Td width = "120px" height = "25px"> 4 </td>
</Tr>
</Table>
5. Javascript Testing Questions
(1) (a + 2)-1 = NAN
(2) ParseInt ("7") + 3 = 10
(3)
Var a = "8 ";
Var B = 5;
Var c = a + B;
Var d = a-B;
C = 85 (concatenated string)
D = 3 (subtraction of numbers)
(4)
Please extend the Array Function in JS so that it can implement functions similar to the ArrayList function in C #.
For example, Array arr = new Array (); arr. Add ("arrvalue ");
(5) list the Javascript libraries you have used or compiled by yourself, and talk about the ideas involved or the well-written ones.
6. there is a div id showInfo on the HTML page ,, there is a Button <input type = "button" value = "show" name = "btnOK"> now requires that you click a Button to display a hyperlink in the DIV <a href = www.mysoft.com.cn> mingyuan Software </a>, write a JS function by yourself.
A: The Code is as follows:
Function Showlink ()
{
Document. getElementById ("showlink"). innerHTML = "<a href = www.mysoft.com.cn> mingyuan technology </a> ";
}
<Div id = "showlink">
<Input id = "btnok" type = "button" value = "show" name = "btnOk" onclick = "Showlink ();"/>
6 logical questions
The planned water consumption is wplan, and the actual water consumption is wsj. If the actual water consumption is less than wplan, fees are charged according to price1. The actual water consumption exceeds wplan and less than 1.2 wplan
The excess part is charged based on price2, and the actual water consumption exceeds 1.2 wplan. the excess part is charged based on price3. Please use a function iff (exp1, exp2, exp3) to calculate the user's water fee, if exp1 is true, exp2 is returned. Otherwise, exp3 is returned. The function can be nested.