7,765
社区成员
发帖
与我相关
我的任务
分享
请勿直接在考卷上答题,请在草稿纸上答题
1. 一个人工作七天的佣金是一根金条,工资日结,在只能切两刀的情况下,请问如何切?
2. 事件委托是什么(Web前端题)
3. 不用.net自带的转换函数,如何把字符串”123456”转换为数值型?
4. String s = ””;和string s = String.Empty;哪一种方式更好?为什么?
5. 使用什么算法,能在int a[8] = {3,12,24,36,55,68,75,88}里查找24,为什么选用这个算法?
6. 请问一下代码会发生什么bug?
public void Log(string msg)
{
System.IO.File.AppendAllText (Server.MapPath ("~/log.txt"), msg);
}
7. 你能想到的Saas系统数据持久化方案有哪几种?(围绕MsSqlserver,Entity Framework)
8. 一百个账户各有100元,某个账户某天如有支出则添加一条新记录,记录其余额。一百天后,请输出每天所有账户的余额信息。
表结构:username varchar (50) NOT NULL , --用户名
outdate [datetime] NOT NULL , --日期
cash [float] NOT NULL --余额
9. 如果让你设计一个公司内的开发平台(框架),请简述需要注意的事项。
10. 以下代码属于什么设计模式?
public interface Salary
{
int Caculator();
}
public class ManagerSalary : Salary
{
public int Caculator()
{
return 1000;
}
}
public class EmployeeSalary : Salary
{
public int Caculator()
{
return 800;
}
}
public class Employee
{
public Salary Salary {get;set;}
public Employee(Salary salary)
{
Salary = salary;
}
public int GetSalary()
{
return Salary.Caculator();
}
}
public static readonly string Empty = "";
namespace WindowsFormsApplication1
{
class Program
{
private const int Count = int.MaxValue;
static void Main(string[] args)
{
for (int i = 0; i < 10; i++)
{
TestStringEmpty();
TestEmpty();
}
Console.ReadKey();
}
private static void TestStringEmpty()
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string temp= string.Empty;;
for (int i = 0; i < Count; i++)
{
temp += string.Empty;
}
stopWatch.Stop();
Console.WriteLine("string.empty : " + stopWatch.ElapsedMilliseconds);
}
private static void TestEmpty()
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string temp= "";;
for (int i = 0; i < Count; i++)
{
temp += "";
}
stopWatch.Stop();
Console.WriteLine("\"\" : " + stopWatch.ElapsedMilliseconds);
}
}
}
namespace WindowsFormsApplication1
{
class Program
{
private const int Count = int.MaxValue;
static void Main(string[] args)
{
for (int i = 0; i < 10; i++)
{
TestStringEmpty();
TestEmpty();
}
Console.ReadKey();
}
private static void TestStringEmpty()
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
for (int i = 0; i < Count; i++)
{
string temp = string.Empty;
}
stopWatch.Stop();
Console.WriteLine("string.empty : " + stopWatch.ElapsedMilliseconds);
}
private static void TestEmpty()
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
for (int i = 0; i < Count; i++)
{
string temp = "";
}
stopWatch.Stop();
Console.WriteLine("\"\" : " + stopWatch.ElapsedMilliseconds);
}
}
}
差别极小,不过string.Empty还是胜出。