某软件公司的英文Java笔试题(网络笔试)

4 篇文章 0 订阅

Name:

Contact Phone No/Email address:

Date:

Programming Skill Evaluation Test

The test can be answered in Chinese or English.  (测试可使用中文或英文作答)

1.

Consider classes below.

 

package com.icil.appl;

 

public class Person {

    private String name = "";

    int age = 0;

 

    public Person(String _name, int _age) {

        this.name = _name;

        this.age = _age;

    }

}

 

package com.icil.appl;

 

public class Teacher extends Person {

    public String subject = "";

    private String name = "";

 

    public Teacher(String _name, int _age) {

        super(_name, _age);

    }

 

    public void getDescription() {

        System.out.println("My name is " +

            name + ". I’m " +  age +

            " years old. I’m a Teacher. I teach " +

            subject + ".");

    }

 

    public static void main(String[] args) {

        Teacher teacher = new Teacher("Mary", 23);

        teacher.subject = "English";

        teacher.age -= 3;

 

        teacher.getDescription();

    }

}

 

What is the result when teacher.getDescription() is called?

Ans.

 

  

 

 

 

2.

Please write class Magazine according to the diagram.

Book

- name : String

+ getName() : String

 

 

Magazine

# no : int

- ISBN : String

+ getNo() : int

+ getISBN() : String

 

 

<<interface>>

MetaInfo

+ getMetaInfo() : String

 

 

 

Ans.

 

 

 

 

 

 

3.

Consider the following code fragment.

 

public void printLabel(Label[] labels) {

    int counter = 0;

    try {

        for (int i=0; i<=labels.length; i++) {

           System.out.println(“Label ” + label.getName());

           counter++;

        }

        counter++;

    } catch (ArrayIndexOutofBoundsException e) {

        System.out.println(e.getMessage());

    }

}

 

3.1 Suppose there are 2 elements in labels array.  What is the value of counter after executing this method? Please specify reasons.

 

3.2 Can this class be compiled if the try block is removed? Please specify reasons.

 

Ans.

 

 

 

 

 

4.

What is the purpose of adding ‘synchronized’ to a method signature?

E.g. pubic synchronized boolean leased () {… }

     

Ans.

 

  

 

 

5.

Below is a XML

<b:listGrid id='ogrid' width="auto" height="100%" readonly="true" rowClasses="rowClass1, rowClass2">

   <b:dataSource e:behavior="b:localData" dataType="application/xml">

      <b:dataContainer>

         <xi:include href="examples/data/gridData.xml" />

      </b:dataContainer>

   </b:dataSource>

   <b:listGridCol select="title" label="Title" title="title" datatype="string" width="200px" />

   <b:listGridCol select="genre" label="Genre" title="genre" datatype="string" width="100px" />

   <b:listGridCol select="rating" label="Rating" title="rating" datatype="number" width="70px" align="right" />

</b:listGrid>

 

Can you write an Xpath to get the node with label=”Genre”?

Ans:

 

 

 

 

 

 

6.

Consider the following classes.

 

public class Person {

    protected String name;

 

    public Person(String _name) {

         this.name = _name;

    }

 

    public void printProfile(int age) {

         System.out.println(this.name +

             “ is “ + age + “ years old.”);

    }

}

 

public class Student extends Person {

    public Student(String _name) {

        super(_name);

    }

 

    public void printProfile(int age) {

        System.out.println(“Student “ +

        this.name + “ is “ + age + “years old.”};

    }

}

If there a object defined in this way,

    Person person = new Student(“ICIL”);

What is the result when calling person.printProfile(10)?  Please specify reasons.

Ans.

 

 

  

 

 

7.

Can you write a CSS to set all HTML tr element with background color = red?

Ans.

 

 

  

 

 

8.

Can you write a regular expression for a string with numbers only

Ans.

 

 

 

 

 

 

 

 

 

9.

Given the following table in MySQL.  The table consists of 10,000 records

Employee Table

Field

Type

emp_id

char(6)

emp_firstname

varchar(20)

emp_lastname

varchar(20)

Emp_gender

char(1)

emp_address

varchar(255)

emp_joindate

datetime

emp_birthday

datetime

emp_remarks

varchar(255)

 

Consider the SQL statement below and comment the size of result set in JDBC.  What is the effect of result set when the number of record in Employee table growth?

 

SELECT * from Employee.

SELECT emp_id, emp_firstname, emp_lastname from Employee.

SELECT emp_id, emp_firstname, emp_lastname from Employee limit 1000, 25.

Ans.

 

 

 

  

 

 

10

What is outer join in SQL?  Why it needs to be used?  Please give an example.

 

Ans.

 

 

 

 

 

11

What is deadlock in RDBMS context?  How to avoid it?

 

Ans.

 

 

 

 

12.

  Please give an example for:

 

SELECT from 2 tables

SELECT with GROUP BY

Update

Update one table based on a second table

If you have following batch of SQL:

Insert into table A values (123, 'Student A', 'Teacher B', 'Class C')

Insert into table B values (123, 'English', 'Grade A')

Insert into table B values (123, 'Math', 'Grade B')

 

If the third statement failed, how can you ensure the first and second statement will not be applied to the database too

If a table has columns

Student_ID

Student_NAME

Teacher

Class

 

What is the SQL to find the number of students taught by each teacher?

vii. When you first create the table, you do not have a unique key index on Student_ID, afterwards you realize the mistake, and want to add the unique key index on the column, but the database server complains that the data for that column is not unique.  What SQL can be used to find out which Student_ID (s) cause the problem?

 

Ans.

 

 

 

 

 

 

 

13.

Personal Statement (MUST answer in English)

What is your major interest?  What do you want to achieve in your career?

Ans.

 

 

 

 

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值