中科软深圳分公司面试题

来源:互联网 发布:快速转换视频格式软件 编辑:程序博客网 时间:2024/05/17 06:46

中科软笔试、面试

数据库方面

给出学生成绩表(score)结构说明

字段名称字段解释字段类型字段长度约束sc_number学号字符8PKsc_name姓名字符50Not nullsc_sex性别字符(男:1,女:0)2Not Nullsc_courseid课程号字符5PKsc_score分数数值3Not nullsc_ismakeup当前考试是否为补考字符(补考:1,非补考:0)2Not null

下面是课程(course)表说明

字段名称字段解释字段类型字段长度约束co_id课程号字符5PKco_name课程名字符3Not nullco_desc课程描述字符60 

1.如果学号的前两位表示年级,要查找98级女生的姓名,请写出相应的SQL语句


select  a.sc_name from score a where  substr(a.sc_number,0,2) = '98' and a.sc_sex = 0;


2.统计参加本次考试的学生人数


select distinct(a.sc_number) from score a ;


3.统计本次考试中每门课程的最高分和最低分



4.要查找所以需要补考(小于60分)的学生姓名和这门课程的名称和成绩,请写出相应的SQL语句


select       a.姓名,      b.课程名,      a.分数   from score as a,course as b   where a.课程号 = b.课程号 and a.分数 < 60


5.查询每个学生需要补考(小于60分)的课程的平均分,并以平均分排序


select       a.姓名,      avg(a.分数)  from score as a,course as b   where a.课程号 = b.课程号 and a.分数 < 60  group by a.姓名  order by avg(a.分数)


6(选做题)针对学生考试管理系统,如果要实现学生管理、课程管理、考试成绩管理的基本需求,请根据你对需求的理解,使用UML或者E-R图的方式给出一个简洁明了的数据库设计方案

编程语言方面

一.选择题

1.public class test{

  public static void main(String [] args){

     String s = new String("Hello");

     modify(s);

     System.out.println(s);

 }

  public static void modify(){

       s+="world!";

  }

}
A. The program runs anf prints "Hello"

B. an error causes compilation to fail

C. The program runs anf prints "Hello world!"

D. The program runs aborts with an exception

答案:B 因为在主方法中调用的modify();而在写此方法时没有传参,本身就是错误的。


2. public class test{

        public static String output = "";

        public static void foo(int  i){

           try{

                if(i==1){

                       throw new Exception();    

                }

                output += "1";

           }catch(Exception e){

                output += "2";

                return;

           }finally{

               output += "3";

         }

         output += "4";

        }

        public static void main(String[] args){

              foo(0);

              foo(1); 

       }

   }


答案:。



Which range of x value would print the string "second"?

A. x>0

B.x>-3

C.x<=-3

D.X<=0 & x>-3

答案:D


二.简答题

1.列举JSP中的内置对象,同一应用中页面间传值有哪些方式

解答:JSP中9大内置对象。


2.JSP如何获取HTML FORM中的数据

解答:HTML

<form action="a.jsp">
<input type="text" name="test_data"/>

<input type="submit" value="提交" />
</form>

a.jsp
<%
String testData = request.getParameter("test_data"); // 即可获得test_data的值。
%>


3.介绍在JSP中如何使用JavaBeans,如何使用一个已经定义好的类

解答:这里有篇文章:http://blog.csdn.net/whatisnotnull/article/details/7956605

jsp中使用javabean实例介绍




4.下面是Javascript语法写的一个函数,请说明该函数的作用是什么,并举例说明返回值代表的意义

function myfunction(param1,param2){
  var strValue=param1.split("-");

  var param1Temp = new Date(strValue[0]+"/"+strValue[1]+"/"+strValue[2]);

  strValue = param2.split("-");

  var param2Temp = new Date(strValue[0]+"/"+strValue[1]+"/"+strValue[2]);

  if(param1Temp.getTime() ==param2Temp.getTime() )

          return 0;

 else if(param1Temp.getTime() > param2Temp.getTime())

         return 1;

 else

        return 2;

}

5.有两个类,personSchema、personDB。personSchema描述数据库中person表的一条记录,类personDB是对类personSchema进行插入、删除及更新的操作类。

public class personSchema{

//属性及对应的get、set方法

}

public class personDB{

     public Boolean insert(personSchema tpersonSchema){

     // 插入

     }

    public Boolean update(personSchema tpersonSchema){

     // 修改

     }

     public Boolean delete(personSchema tpersonSchema){

     // 删除

     }

    public personSchemagetById(String id){

     // 根据编码来查询该人员

     }

}

(1)请写一段代码实现:插入员工编号(id)为ht000001并且名称为”张三“的人员

(2)请写一段代码实现,把刚插入的数据修改为”李四“

6.编写一个完整的程序实现如下功能:从键盘输入数字n,程序自动计算n!,并输出。(注:1 n!=1*2*3*4……*n,注2:请使用递归实现)(可以使用任何开发语言,最好使用Java)

解答:

  public static void main(String[] arg) {    System.out.println("请输入要求阶乘的一个整数:");    Scanner scanner = new Scanner(System.in);    int n = scanner.nextInt();    //System.out.println(n+"的阶乘结果是:"+ factorial(n));//递归求阶乘    System.out.println(n+"的阶乘结果是:"+ loop(n));//循环求阶乘  } /** * 使用递归方法计算n的阶乘 * @param n * @return */  static long factorial(int n) {    if (n <= 1) {        System.out.println(n + "! = " + 1);        return 1;    } else {        long num = n * factorial(n - 1);        System.out.println(n + "! = " + num);        return num;    }  } /**使用循环方式  * */ static long loop (int n){ long num = 1;    for (int i = 1; i <= n; i++) {    //num *= i;    num = num * i; }    return num; }



原创粉丝点击