深圳c#面试第三天 题目以及答案
2016-03-20 15:29
435 查看
1. 以下是一个表的数据
year month account
请写出sql语句 查询出的表如下
year m1 m2 m3 m4
1991 1.1 1.2 1.3 1.4
1992 2.1 2.2 0 0
答案: 表的名称:yearMonthAccount
1.先插入1992年3,4月份的account 的数据 :insert into yearMonthAccount values (1992,3,0),(1992,4,0);
2 自连接四个表,按照四个表的月份进行筛选,sql语句如下:
select a.year 'YEAR',a.account 'M1',b.account 'M2',c.account 'M3' ,d.account 'M4' from yearMonthAccount a, yearMonthAccount b,yearMonthAccount c , yearMonthAccount d where
a.year=b.year and
b.year=c.year and
c.year=d.year and
a.month=1 and
b.month=2 and
c.month=3 and
d.month=4 结果截图:
2.求以下的表达式,写出你想到的一种或者几种实现方法:1+1+2+3+5+8+13+.............
c# 实现的方法有:
3.请编程遍历WebFrom页面上所有 TextBox控件并给它赋值为string.empty?
year month account
1991 | 1 | 1.1 |
1991 | 2 | 1.2 |
1991 | 3 | 1.3 |
1991 | 4 | 1.4 |
1992 | 1 | 2.1 |
1992 | 2 | 2.2 |
year m1 m2 m3 m4
1991 1.1 1.2 1.3 1.4
1992 2.1 2.2 0 0
答案: 表的名称:yearMonthAccount
1.先插入1992年3,4月份的account 的数据 :insert into yearMonthAccount values (1992,3,0),(1992,4,0);
2 自连接四个表,按照四个表的月份进行筛选,sql语句如下:
select a.year 'YEAR',a.account 'M1',b.account 'M2',c.account 'M3' ,d.account 'M4' from yearMonthAccount a, yearMonthAccount b,yearMonthAccount c , yearMonthAccount d where
a.year=b.year and
b.year=c.year and
c.year=d.year and
a.month=1 and
b.month=2 and
c.month=3 and
d.month=4 结果截图:
2.求以下的表达式,写出你想到的一种或者几种实现方法:1+1+2+3+5+8+13+.............
c# 实现的方法有:
<span style="font-size:18px;"> public int fbo () { int all = 0; //总数 int top=1;//记录上一个数 int next=1;//记录下一个数 for (; ; ) { if (next == 1) { all = top + next; //总数加起来 next = next + top;//下一个数 } else { int head = next; </span><span style="font-size: 18px; font-family: Arial, Helvetica, sans-serif;">// 加之前记录上一个数</span><span style="font-size:18px;"> all = all + next; //相加得总数 next = top + next; //求出一个数; top = head; } } return all; }</span>
3.请编程遍历WebFrom页面上所有 TextBox控件并给它赋值为string.empty?
foreach (System.Windows.Forms.Control control in this.Controls) { if (control is System.Windows.Forms.TextBox) { System.Windows.Forms.TextBox tb = (System.Windows.Forms.TextBox)control ; tb.Text = String.Empty ; } }
4.请写出一个算法 产生一个int数组,长度为100,并向其中随机插入1--100,并且不能重复
for int[] getRandom() { int[] intArr=new int[100]; ArrayList myList=new ArrayList(); Random rnd=new Random(); while(myList.Count<100) { int num=rnd.Next(1,101); if(!myList.Contains(num)) myList.Add(num); } for(int i=0;i<100;i++) intArr[i]=(int)my }
相关文章推荐
- c#调用COM组件
- C#实现把指定数据写入串口
- C#动态创建button的方法
- C#中抽象方法与虚拟方法的区别
- c#中虚函数的相关使用方法
- C#实现给图片加水印的方法
- C#使用加边法计算行列式的值
- C#实现多线程的同步方法实例分析
- C#中尾递归的使用、优化及编译器优化
- C#中的delegate委托类型基本学习教程
- C#实现子窗体与父窗体通信方法实例总结
- C#通用邮件发送类分享
- 举例讲解C#中自动实现的属性
- C#中this的用法集锦
- C#数据结构之顺序表(SeqList)实例详解
- C#.NET获取拨号连接的宽带连接方法
- C#异步绑定数据实现方法
- C#实现AddRange为数组添加多个元素的方法
- C#中Equality和Identity浅析
- C#比较二个数组并找出相同或不同元素的方法