明源题目

来源:互联网 发布:a1科密考勤系统数据库 编辑:程序博客网 时间:2024/04/26 22:20

1 有两张表

A 学生表

 

ID          Name          age

1           李1             12

2           李2             33

3           李3             32

4           李4             34

5           李5             36

6           李6             37

7           李7             38

8           李8             39

9           李9             40

 

B分数表

ID             subject      score

4                  语文          88

4                  数学          67

5                  语文          88

5                  数学          67

6                  语文          88

6                  数学          64

7                  语文          65

8                  数学          67

9                  语文          72

10                数学          73

 

(1)

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 b.* from a left join b on a.id=b.id;

select b.* from a  right join b on a.id=b.id;

 

以上语句返回的行数分别是多少?

 答案:9   9    12  10  12   10 

 

(2)统计每门功课前两名学生的ID,name ,subject ,score ?

 

(3)

实现如下格式

ID     Name      语文       数学

1       李1

4       李4         88         67

9       李9         72

 

这是一个行转列

select  id 编号,[name] 姓名,
sum(case when subject='语文' then score  end)语文,
sum(case when subject='数学' then score  end)数学
from b group by id ,[name]

 

 

(4)新建一个视图查询  ID,name,age,subject ,score ,如果一个学生对应有多个记录 则全部显示出来?

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)新建一个存储过程 , 实现输入学生ID(存储过程的输入参数) , 显示学生姓名以及平均分, 格式如下:    李4:45

 if exists(select * from sysobjects where name="get_Scorename")

drop proc get_Scorename

go

create proc get_Scorename(@id int)

as

declare @name varchar(10)

declare @avgscore float

begin

select @name=a.name+':',@avgscore=avg(score) from a left join b on a.id=b.id wherea.id=@id group by a.name

print (@name+cast(@avgscore as varchar(10))

end

exec get_Scorename 4;

2

(1)请列举有哪几种页面重定向的方法 ,并解释(至少两种以上)

    Response.redirect();server.Transfer(),server.Execute(),postbackurl

(2)ASP.NET页面传值的集中方法,并分析其利弊(至少两种以上)

(3)说说URL传值应注意的问题(至少两点以上)

      Session传值,保存单个会话的有效信息到服务器端,可以跨页面传值

     Cookie传值,客户端传值

     Response.Redirect()不能传敏感的信息

  ViewState传值,只能在页面内传值。

(4) 用代码实现: 新建一个XML文档 将字符串 "<item>NBA</item>" 读到文档里

(5)解释一下装箱  和 拆箱  ,并附上代码说明 

    装箱是将值类型隐士转换成引用类型,如:

      int i=123;

    object j=i;

   拆箱是将引用类型显示转换成值类型

     int i=123;

   object j=i;

   int t=int.Parse(i);

 

3

情景A

房地产楼盘有很多种项目,每个项目有不同类型的房子,像普通商品房 是按照面积*均价 来计算价格,而别墅是按照数量来计算价格

情景B

公司老总和销售总监希望希望立刻得知楼盘的销售情况

 

(1)请使用UML 来描述A 中各对象的关系

(2)请给A中的各对象建表 ,表名和字段 自己定

(3)请结合B的场景,用一种设计模式来实现(编码实现)

 

4 关于HTML 和JAVASCRIPT的题目

 填空题

 (1) (a+2)-1=81     a="8"   a+2="82" 拼接字符串  82-1=81

 (2)ParseInt("7")+3=10

 (3)

  var a="8"  ;

  var b=5;

  var c=a+b;

  var d=a-b;

  c=85  (拼接字符串)

  d=3  (数字相减)

 

解答题

(4)

C# 中 ArrayList arr=new ArrayList();

arr.add("湖人");

请扩展JS中Array的功能 让其也能实现类似于C#中ArrayList的功能

如: Array arr=new Array();

arr.Add("凯子");

Array.prototype.Add=function Add(object){

this.push(object);

}

var arr=new Array();

arr.Add("你好");

 

(5)请列举你所用过或自己编写的Javascript库, 就其中所涉及的思想或者写的比较好的地方  谈谈你的看法

 我只知道Jquery,不过没用过。

 

5 HTML 页面上有一个DIV ID 为 showInfo,, 有一个Button   <input type="button"  value="显示" name="btnOK">

现要求实现点击按钮 在DIV里 显示一个超链接 <a href=www.mysoft.com.cn  >明源软件</a>,自己写一个JS函数实现

                  <script type="javascript">

                        function showlink(){

                                  var link=document.createElement("a");

                                 link.href="www.mysoft.com.cn";

                                link.innerText="明源软件";

                                 document.body.appendchild("link);                     

}

             </script>

                  <input type="button" value="显示"  name="btnOK" onclick="showlink()">

6 逻辑题

计划用水量为 wplan,用户实际用水量为wsj,如果实际用水量小于wplan,按照price1收费,实际用水量超过wplan,并且小于1.2wplan

超过部分按照price2收费,实际用水量大于1.2wplan,超过部分按照price3收费,请用一个函数iff(exp1,exp2,exp3) 来计算用户的水费,要求 如果exp1为true ,返回exp2,否则返回exp3,函数可以嵌套

             function ifff(exp1,exp2,exp3){

                           if(wsj<wplan){

                                exp2=price1;

                                exp1=true;}

                         if(wsj>wplan&&wsj<1.2*wpplan){

                               exp2=price1+(wsj-wplan)*price2;

                              exp1=true;}

                        if(wsj>1.2*wplan){

                              exp2=price1+(wsj-wplan)*price3;

                              exp1=false;}

                     if(exp1){

return exp2;

}else{

return exp3;

}

 

}

}