Completed the interview questions of a buddy.

Source: Internet
Author: User
I went to a company for an interview in the morning and gave me a question. After 20 minutes, I answered a few questions, but I didn't have enough self-motivation. I don't have many questions. I remember the following:
1 . Two string variables String A, B; program to connect two strings with ASCII Storage
For example: String A =   " ABCD " , String B =   " Defgh " ; Returned result: abcddefgh
Requirements:
A. You cannot use any class library functions.
B. Write several test cases to test it.
I don't know. ~ .. ~
2 . Talk about processes, threads, and applications.ProgramDomain differences
A process is the execution process of concurrent programs on the dataset.
A thread is a part of a process and the execution flow of one or more commands of the process. It can reduce the system overhead caused by the process and improve the concurrency of the system.
. In. net, the application domain [appdomain] is an independent execution environment of the Program, providing isolation, uninstallation, and security for the execution of managed code.
A process can have multiple AppDomains
Appdomain has no one-to-one relationship with the thread, but at a specific time, a thread must be in an appdomain.
3 . Differences between dataset and datareader
Datareader and dataset are used to retrieve and store data, but they also have some differences.
A DataSet object is a data cache in the memory. It contains a set of relationships between tables and these tables. Each table contains a set of columns. It can be considered as an offline database, supports closed connections.
Datareader provides a fast, forward-only, and read-only data stream from the database. When reading data from datareader, you need to open the connection object and maintain a connection with the database, that is, it does not support closed connections.

4 .Asp.net has several authentication methods. Which one have you used in your recent project? Why?
> Asp.net supports Forms authentication, window authentication, and passport authentication.
> Our project adopts forms Verification
>
Window authentication is based on IIS identity authentication and does not conform to the business model.
Passport authenticaiton is a Microsoft-based authentication server, which is not flexible and difficult to control.
Forms authenctication is based on cookies and is used to save user creden.
Therefore, we use forms verification.


5 . Scores table: ID name score
1 Zhang San 80  
2 Zhang San 89  
3 Zhang San 89  
4 Li Si 89  
5 Li Si 89  
6 Wang Wu 89  
Requirements:
A. Write an SQL statement. Only one record is used for each name.
-- Create Test Database
Create Database interview
Go
Use interview
Go
-- Create a table
Create Table scores (ID Int , Name nvarchar ( 50 ), Score Int )
Go
-- Insert data
Insert scores select 1 , ' Zhang San ' , 80  
Union all select 2 , ' Zhang San ' , 89  
Union all select 3 , ' Zhang San ' , 89  
Union all select 4 , ' Li Si ' , 89  
Union all select 5 , ' Li Si ' , 89  
Union all select 6 , ' Wang Wu ' , 89
Go
-- View data
Select * From scores
-- A
-- Method1
Select * From scores
Where ID In
(Select max (ID)
From scores
Group by name)
-- Method2

Select * From scores
Where ID In
(
Select top 1 ID from scores B where a. Name = B. Name order by ID DESC
)
-- Method3
Select * From scores
Where
1 > (
Select count ( 0 ) From scores B
Where B. Name = A. Name and B. ID > A. ID
)
-- Method4
Select * From scores
Where
Not exists (
Select * From scores B
Where B. Name = A. Name and B. ID > A. ID
)
B. Write a statement to delete the table record so that each name has only one record
Delete from scores
Where id not In
(
Select a. ID from scores
Where
Not exists (
Select * From scores B
Where B. Name = A. Name and B. ID > A. ID
)

)
Select * From scores
C. Design a data table at the database design level so that a user can have only one record in the table
Create Table students
(
ID Int Identity ( 1 , 1 ) Primary key,
Name nvarchar ( 100 ) Not null
Unique nonclustered)
Go
Insert students
Select a. name from scores
Where
Not exists (
Select * From scores B
Where B. Name = A. Name and B. ID > A. ID
)
Go
Select * From students

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.