7,776
社区成员
发帖
与我相关
我的任务
分享
请勿直接在考卷上答题,请在草稿纸上答题
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();
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace MP3File
{
public partial class frmMain : Form
{
private void btn_Open_Click(object sender, EventArgs e)
{
if (this.oFDlog_Info.ShowDialog() == DialogResult.OK)
{
this.lV_Info.Items.Clear();
string[] FileNames = this.oFDlog_Info.FileNames;
foreach (string FileName in FileNames)
{
FileInfo FileInfo = new FileInfo(FileName);
float FileSize = (float)FileInfo.Length / (1024 * 1024);
this.axMP_Info.FileName = FileName;
string Author = this.axMP_Info.GetMediaInfoString(MediaPlayer.MPMediaInfoType.mpClipAuthor);
string ShortFileName = FileName.Substring(FileName.LastIndexOf("\\") + 1);
ShortFileName = ShortFileName.Substring(0, ShortFileName.Length - 4);
string[] SubItem ={ ShortFileName, Author, FileSize.ToString().Substring(0, 4) + "M", FileName };
ListViewItem Item = new ListViewItem(SubItem);
this.lV_Info.Items.Add(Item);
this.lV_Info.Items[0].Selected = true;
}
}
}
}
private void btn_Play_Click(object sender, EventArgs e)
{
if (this.lV_Info.Items.Count > 0)
{
if (this.lV_Info.SelectedItems.Count > 0)
{
int iPos = this.lV_Info.SelectedItems[0].Index;
string FileName = this.lV_Info.Items[iPos].SubItems[3].Text.ToString();
this.axMP_Info.FileName = FileName;
this.axMP_Info.Play();
}
}
else
{
MessageBox.Show("请选择歌曲!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void btn_Pase_Click(object sender, EventArgs e)
{
if (this.axMP_Info.FileName.Length > 0)
this.axMP_Info.Pause();
else
{
MessageBox.Show("请选择歌曲!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void btn_Pre_Click(object sender, EventArgs e)
{
if (this.lV_Info.Items.Count > 0)
{
if (this.lV_Info.SelectedItems.Count > 0)
{
int iPos = this.lV_Info.SelectedItems[0].Index;
if (iPos > 0)
{
this.lV_Info.Items[iPos - 1].Selected = true;
string FileName = this.lV_Info.Items[iPos - 1].SubItems[3].Text.ToString();
this.axMP_Info.FileName = FileName;
this.axMP_Info.Play(); }
else
{
MessageBox.Show("已经是第一首歌曲!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
else
{
MessageBox.Show("请选择歌曲!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void btn_Next_Click(object sender, EventArgs e)
{
if (this.lV_Info.Items.Count > 0)
{
if (this.lV_Info.SelectedItems.Count > 0)
{
int iPos = this.lV_Info.SelectedItems[0].Index;
if (iPos < this.lV_Info.Items.Count - 1)
{
this.lV_Info.Items[iPos + 1].Selected = true;
string FileName = this.lV_Info.Items[iPos + 1].SubItems[3].Text.ToString();
this.axMP_Info.FileName = FileName;
this.axMP_Info.Play();
}
else
{
MessageBox.Show("已经是最后一首歌曲!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
else
{
MessageBox.Show("请选择歌曲!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void btn_Stop_Click(object sender, EventArgs e)
{
if (this.axMP_Info.FileName.Length > 0)
this.axMP_Info.Stop();
else {
MessageBox.Show("请选择歌曲!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
。
招聘时说的是不加班。结果不加班的基本都被辞退了。

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还是胜出。