栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > Java面试题

Mercury Systems Java面试题

Java面试题 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Mercury Systems Java面试题

CoreJava Test Provide byMercury Systems, Inc.

 

 

 

Part1: Basic Java Concepts (20 credits)

Justifywhether the following statements are TRUE or FALSE.

 

1. (False) An abstract class must have at least one abstract method (Anabstract class can contain abstract method or contain none abstract method).

2. (False) Inheritance shows “is a” relation. (Implement is “is a” relation)

3. (False) We can use try-finally block without catch clause (Try catchblock must collocation).

4. (False) StringBuilder is a thread-safe class (StringBuffer is thread-safeclass).

5. (True) ArrayList has better performance than Vector (Yes. Because Vectorclass is Synchronization, the Vector runs Serialized method ArrayList fasterthan Vector).

6. (True) IOException is an unchecked exception (Yes. IOException is anunchecked exception. If invoke try catch to handling the exception is “CheckedException”, if not invoke to handling the exception will be “UncheckedException”. For example: ClassNotFound is an unchecked exception.).

7. (True) A transient field can not be serialized (Yes. A transient field cannot be serialized. For example: User’s password or bank account will be atransient field can not be serialized send to Internet).

8. (True) A constructor is a method that can only have return type void (Yes.A constructor must return void).

9. (True) We can define public static final void main method (Yes. We candefine public static final void main method. Also we can use synchronized).

10. (False) clone() method in class Object makes a deep copy of an object (clone()method implement a Serializable interface is a deep copy of an object).

 

Part2: Core Java Coding (80 credits)

YouMUST send back the java source file .java that can be complied and run directlyunder Java 5 or 6.

 

Problem #1 (40 credits)

Given astring, design an algorithm in O(n) running time to find the character thatappears more than half of the time in the string. If the character does notexist, output null.

Input:abadacababaaaa

Output: a

Input:abcdeabbad

Output: null

 

Problem #2 (40 credits)

Input an arithmetic expression with ONLY+, -, * and /, parse the expression and calculate the result.

Input: 5.6 / 0.7 * 2 – 3.5

Output: 12.5

Input: -1.3 + 5.1 / 3 – 0.8

Output: -0.4

 

** This test should not take more thanthree hours.

** Please send the test to resource@mercurysystemsinc.com.

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/264019.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号