Teradata 笔试
1. function test() {
alert(parseInt(07));
alert(parseInt("07"));
alert(parseInt(09));
alert(parseInt("09"));
alert(parseInt(010));
alert(parseInt(0xA));
}
结果是弹出 7,7,9,0,8,10
①. parseInt(numstring, [radix])
• numstring 必选项。要转换为数字的字符串。
• radix 可选项。在 2 和 36 之间的表示 numstring 所保存数字的进制的值。如果没有提供,则前缀为 ’0x’ 的字符串被当作十六进制,前缀为 ’0′ 的字符串被当作八进制。所有其它字符串都被当作是十进制的。
• 返回由字符串转换得到的整数。
②.0开头的虽然是代表八进制数,但09,这个数是八进制不能表示。前缀为“0”同时包含数字“8”或“9”的数被解释为十进制数。
2.Spring 的自动装配机制
Spring的autowire机制,有AbstractAutowireCapableBeanFactory提供抽象共性,byName,byType,byConstrutor,ByDetect(3.0开始弃用)。
①byType 由AbstractAutowireCapableBeanFactory的autowireByType具体实现,抛出UnsatisfiedDependencyException,内部机制未看明白
3.Spring的事件机制
实现applicationContextWare接口及applicationEventPublisherWare接口,都是可以的,applicationContextWare可以获取applicationContext,该接口继承在applicationEventPublisher接口,调用同样的publishEvent方法,在该方法中会默认实例化一个SimpleApplicationEventMulticaster,通过多线程的方式调用所有的applicationListener的onApplicationEvent方法
4.Struts的validate机制
action节点配置中有validate属性,默认值为true
在命令链中由如下代码控制
if (!actionConfig.getValidate()) {
return false;
}
5.Struts的出错返回机制
在执行完validateActionForm的validate方法后,将调用链中SelectInput类
由以下代码判断,validate是否验证通过
if ((valid != null) && valid.booleanValue()) {
return (false);
}
不通过的时候,forwardConfig将变为path为input的form,在命令链之后的ExecuteAction,虽然执行,但还是通过
if ((valid == null) || !valid.booleanValue()) {
return (false);
}
阻断真正Action的excute方法的回调。
6.Hibernate的session机制及对象的相等判断
getCurrentSession()获取当前线程的session对象,当事务结束的时候,session将从线程中剥离出去。在此调用的时候,会获取一个新的session对象。
7.Treeset的特点
Treeset是一种以默认升序为内部结构基于treemap实现的set集合。
是通过迭代,寻找元素。内部TreeMap,put方法
do {
parent = t;
cmp = cpr.compare(key, t.key);
if (cmp < 0)
t = t.left;
else if (cmp > 0)
t = t.right;
else
return t.setValue(value);
} while (t != null);
8.jsp的调用过程
jsp最终被编译未一个集成HttpServlet的类,tomcat
public abstract class HttpJspBase extends HttpServlet implements HttpJspPage {
protected HttpJspBase() { }
public final void init(ServletConfig config)
throws ServletException {super.init(config); jspInit(); _jspInit();}
public String getServletInfo() { return Localizer.getMessage("jsp.engine.info"); }
public final void destroy() { jspDestroy(); _jspDestroy(); }
public final void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{ _jspService(request, response); }
public void jspInit() { }
public void _jspInit() { }
public void jspDestroy() { }
protected void _jspDestroy() {
}
public abstract void _jspService(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException;
}
9.transfer object 模式的特点
①. 使Entity EJB的重用成为可能。由于不含DTO处理逻辑,Entity EJB功能单一化,只作为数据源。不通客户端通过各自的DTO Factory可以从同一个Entity EJB得到各自所需的个性化数据(自定义DTO)。
②. 提高可维护性和性能。
③. 可以根据在DTO Factory层生成很复杂的DTO结构,诸如继承、关联关系等,而对客户端提供一个透明、细化的数据接口。
10.session的invalidate方法
session.setAttribute("a","a");
session.invalidate();
session.getAttribute();//将抛出异常
IllegalStateException
* Signals that a method has been invoked at an illegal or
* inappropriate time. In other words, the Java environment or
* Java application is not in an appropriate state for the requested
* operation.
11.线程机制
public class TestWait {
public static void main(String[] args) {
TestWait x1 = new TestWait();
synchronized (x1) {
TestWait x2 = new TestWait();
x1 = x2;
try {
x1.wait();
} catch (InterruptedException ex) {
ex.printStackTrace();
} catch (Exception ex) {
System.out.println(ex);
} finally {
System.out.println("444444");
}
}
System.out.println("111111");
char a = '3';
x1.x(a);
}
public TestWait() {}
void x(int a) {System.out.println("1213212"); }
void x(String a) {System.out.println("434343"); }
}
结果
java.lang.IllegalMonitorStateException: current thread not owner
444444
111111
1213212
12.重载及类型转化
13.字符串的传递
14.降低JNDI读取性能 的模式 serviceLocator
15.m-way tree 的结构
16.数据库题
1. function test() {
alert(parseInt(07));
alert(parseInt("07"));
alert(parseInt(09));
alert(parseInt("09"));
alert(parseInt(010));
alert(parseInt(0xA));
}
结果是弹出 7,7,9,0,8,10
①. parseInt(numstring, [radix])
• numstring 必选项。要转换为数字的字符串。
• radix 可选项。在 2 和 36 之间的表示 numstring 所保存数字的进制的值。如果没有提供,则前缀为 ’0x’ 的字符串被当作十六进制,前缀为 ’0′ 的字符串被当作八进制。所有其它字符串都被当作是十进制的。
• 返回由字符串转换得到的整数。
②.0开头的虽然是代表八进制数,但09,这个数是八进制不能表示。前缀为“0”同时包含数字“8”或“9”的数被解释为十进制数。
2.Spring 的自动装配机制
Spring的autowire机制,有AbstractAutowireCapableBeanFactory提供抽象共性,byName,byType,byConstrutor,ByDetect(3.0开始弃用)。
①byType 由AbstractAutowireCapableBeanFactory的autowireByType具体实现,抛出UnsatisfiedDependencyException,内部机制未看明白
3.Spring的事件机制
实现applicationContextWare接口及applicationEventPublisherWare接口,都是可以的,applicationContextWare可以获取applicationContext,该接口继承在applicationEventPublisher接口,调用同样的publishEvent方法,在该方法中会默认实例化一个SimpleApplicationEventMulticaster,通过多线程的方式调用所有的applicationListener的onApplicationEvent方法
4.Struts的validate机制
action节点配置中有validate属性,默认值为true
在命令链中由如下代码控制
if (!actionConfig.getValidate()) {
return false;
}
5.Struts的出错返回机制
在执行完validateActionForm的validate方法后,将调用链中SelectInput类
由以下代码判断,validate是否验证通过
if ((valid != null) && valid.booleanValue()) {
return (false);
}
不通过的时候,forwardConfig将变为path为input的form,在命令链之后的ExecuteAction,虽然执行,但还是通过
if ((valid == null) || !valid.booleanValue()) {
return (false);
}
阻断真正Action的excute方法的回调。
6.Hibernate的session机制及对象的相等判断
getCurrentSession()获取当前线程的session对象,当事务结束的时候,session将从线程中剥离出去。在此调用的时候,会获取一个新的session对象。
7.Treeset的特点
Treeset是一种以默认升序为内部结构基于treemap实现的set集合。
是通过迭代,寻找元素。内部TreeMap,put方法
do {
parent = t;
cmp = cpr.compare(key, t.key);
if (cmp < 0)
t = t.left;
else if (cmp > 0)
t = t.right;
else
return t.setValue(value);
} while (t != null);
8.jsp的调用过程
jsp最终被编译未一个集成HttpServlet的类,tomcat
public abstract class HttpJspBase extends HttpServlet implements HttpJspPage {
protected HttpJspBase() { }
public final void init(ServletConfig config)
throws ServletException {super.init(config); jspInit(); _jspInit();}
public String getServletInfo() { return Localizer.getMessage("jsp.engine.info"); }
public final void destroy() { jspDestroy(); _jspDestroy(); }
public final void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{ _jspService(request, response); }
public void jspInit() { }
public void _jspInit() { }
public void jspDestroy() { }
protected void _jspDestroy() {
}
public abstract void _jspService(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException;
}
9.transfer object 模式的特点
①. 使Entity EJB的重用成为可能。由于不含DTO处理逻辑,Entity EJB功能单一化,只作为数据源。不通客户端通过各自的DTO Factory可以从同一个Entity EJB得到各自所需的个性化数据(自定义DTO)。
②. 提高可维护性和性能。
③. 可以根据在DTO Factory层生成很复杂的DTO结构,诸如继承、关联关系等,而对客户端提供一个透明、细化的数据接口。
10.session的invalidate方法
session.setAttribute("a","a");
session.invalidate();
session.getAttribute();//将抛出异常
IllegalStateException
* Signals that a method has been invoked at an illegal or
* inappropriate time. In other words, the Java environment or
* Java application is not in an appropriate state for the requested
* operation.
11.线程机制
public class TestWait {
public static void main(String[] args) {
TestWait x1 = new TestWait();
synchronized (x1) {
TestWait x2 = new TestWait();
x1 = x2;
try {
x1.wait();
} catch (InterruptedException ex) {
ex.printStackTrace();
} catch (Exception ex) {
System.out.println(ex);
} finally {
System.out.println("444444");
}
}
System.out.println("111111");
char a = '3';
x1.x(a);
}
public TestWait() {}
void x(int a) {System.out.println("1213212"); }
void x(String a) {System.out.println("434343"); }
}
结果
java.lang.IllegalMonitorStateException: current thread not owner
444444
111111
1213212
12.重载及类型转化
13.字符串的传递
14.降低JNDI读取性能 的模式 serviceLocator
15.m-way tree 的结构
16.数据库题