2013Morgan Stanley IKM assessment - pengwang
2013-03-17 23:15:00 Author: www.cnblogs.com(查看原文) 阅读量:84 收藏

今天做了一下Morgan Stanley 的IKM assessment,我选择的是java方向,26分钟,没有规定有少道题,都是多选题,5个选项,最多可以选三个。

感觉这个系统好特别,比如说有好几个选项都是对的,但是判断不同选项正确与否的难易程度不一样,正确选择到那些比较有含金量的选项,最后的得分会高些。

回忆一下其中的一些题。

1.Java 异常处理

public class Test {
	public static void main(String args[]) {
		int x = 5;
		int y = 0;
		int z = 3;
		try {
			try {
				System.out.println(x);
				System.out.println(x / y);
				System.out.println(z);
			} catch (ArithmeticException ae) {
				System.out.println("Inner Arithmetic Exception");
				throw ae;
			} catch (RuntimeException re) {
				System.out.println("Inner Runtime Exception");
				throw re;
			} finally {
				System.out.println("Finally");
			}
		} catch (Exception e) {
			System.out.println("Outer Exception");
		}
	}
}

运行结果:

5
Inner Arithmetic Exception
Finally
Outer Exception

第二句打印中,产生除零异常,这时捕获异常的catch块,首先捕获到算术异常,打印出Inner Arithmetic Exception。捕获到异常后,还可以再次抛出异常之,如代码中所示。

在同一个try中,异常被捕获后不会再往下传递,所以内部的第二个异常捕获块没有捕获到Runtime Exception。

在异常捕获之后,finally语句是一定会执行的,一般情况下在finnaly中做一些善后处理工作。这里打印出Finally。

在外层还有catch块捕获异常,这里所捕获的就是刚才又throw出来的异常,所以会打印出Outer Exception。

如果没有代码中的throw语句,外层try{}catch(){}将不会捕获到异常。

2. Math的各种用法

public class Test {
	public static void main(String args[]) {
		double d = -27.2345;
		System.out.println(Math.round(d));
		System.out.println(Math.abs(d));
		System.out.println(Math.floor(d));
		System.out.println(Math.ceil(d));
	}
}

运行结果:

-27
27.2345
-28.0
-27.0

这题考查的是对Math各种用法的使用。

(1)long java.lang.Math.round(double a)  对a四舍五入

Returns the closest long to the argument, with ties rounding up.

Special cases:

  • If the argument is NaN, the result is 0.
  • If the argument is negative infinity or any value less than or equal to the value of Long.MIN_VALUE, the result is equal to the value of Long.MIN_VALUE.
  • If the argument is positive infinity or any value greater than or equal to the value of Long.MAX_VALUE, the result is equal to the value of Long.MAX_VALUE.

(2)double java.lang.Math.abs(double a)  求a的绝对值

Returns the absolute value of a double value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned. Special cases:

  • If the argument is positive zero or negative zero, the result is positive zero.
  • If the argument is infinite, the result is positive infinity.
  • If the argument is NaN, the result is NaN.

(3)double java.lang.Math.floor(double a)  求不大于a小的最大值

Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer. Special cases:

  • If the argument value is already equal to a mathematical integer, then the result is the same as the argument.
  • If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.

(4)double java.lang.Math.ceil(double a)  求不小于a的最小值

Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer. Special cases:

  • If the argument value is already equal to a mathematical integer, then the result is the same as the argument.
  • If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.
  • If the argument value is less than zero but greater than -1.0, then the result is negative zero.

floor是“地板”,向下取数;ceil是“天花板”,向上取数。

3. OSI体系结构中的网络通信模型,physical layer的功能属性

隐约记得选项有:比特同步;将package拆分成frame;与Session相关balalala。。。其他的记不清楚了。

由于时间本身就不长,加上全英文的题,读题加上理解都得半天,最后好像就做了15题左右,感觉肯定要悲剧了。

果然像大摩这样的地方来者不善啊,被小小的打击了一下。考的内容总体来说比较基础,也很细致,还有一些设计模式的题,由于没有接触过太多,基本都skip掉了。这应该是根据大摩项目特点有关系,金融IT项目要求健壮性和维护性高,需要准确的细节和良好的设计作为支撑。


文章来源: http://www.cnblogs.com/pengwang/archive/2013/03/17/2965079.html
如有侵权请联系:admin#unsafe.sh