Sun River
Topics about Java SE, Servlet/JSP, JDBC, MultiThread, UML, Design Pattern, CSS, JavaScript, Maven, JBoss, Tomcat, ...
posts - 78,comments - 0,trackbacks - 0
    只有注册用户登录后才能阅读该文。阅读全文
posted @ 2009-03-10 11:42 Sun River| 编辑 收藏

 What are JavaScript types? - Number, String, Boolean, Function, Object, Null, Undefined.

  1. How do you convert numbers between different bases in JavaScript? - Use the parseInt() function, that takes a string as the first parameter, and the base as a second parameter. So to convert hexadecimal 3F to decimal, use parseInt ("3F", 16);
  2. What does isNaN function do? - Return true if the argument is not a number.
  3. What is negative infinity? - It’s a number in JavaScript, derived by dividing negative number by zero.

  4. What boolean operators does JavaScript support? - &&, || and !
  5. What does "1"+2+4 evaluate to? - Since 1 is a string, everything is a string, so the result is 124.
  6. How about 2+5+"8"? - Since 2 and 5 are integers, this is number arithmetic, since 8 is a string, it’s concatenation, so 78 is the result.
  7. What looping structures are there in JavaScript? - for, while, do-while loops, but no foreach.
  8. How do you create a new object in JavaScript? - var obj = new Object(); or var obj = {};
  9. How do you assign object properties? - obj["age"] = 17 or obj.age = 17.
  10. What’s a way to append a value to an array? - arr[arr.length] = value;
  11. What is this keyword? - It refers to the current object.
posted @ 2009-03-10 11:37 Sun River| 编辑 收藏
     摘要:   阅读全文
posted @ 2009-03-10 11:36 Sun River| 编辑 收藏

(1)假设在helloapp应用中有一个hello.jsp,它的文件路径如下:
%CATALINA_HOME%/webapps/helloapp/hello/hello.jsp    
那么在浏览器端访问hello.jsp的URL是什么? (单选)
选项:
(A) http://localhost:8080/hello.jsp
(B) http://localhost:8080/helloapp/hello.jsp
(C) http://localhost:8080/helloapp/hello/hello.jsp

(2)假设在helloapp应用中有一个HelloServlet类,它位于org.javathinker包下,那么这个类的class文件应该放

在什么目录下? (单选)
选项:
(A) helloapp/HelloServlet.class
(B) helloapp/WEB-INF/HelloServlet.class
(C) helloapp/WEB-INF/classes/HelloServlet.class
(D) helloapp/WEB-INF/classes/org/javathinker/HelloServlet.class

(3)假设在helloapp应用中有一个HelloServlet类,它在web.xml文件中的配置如下:
<servlet>
  <servlet-name> HelloServlet </servlet-name>
  <servlet-class>org.javathinker.HelloServlet</servlet-class>
</servlet>

<servlet-mapping>
  <servlet-name> HelloServlet </servlet-name>
  <url-pattern>/hello</url-pattern>
</servlet-mapping>
那么在浏览器端访问HelloServlet的URL是什么? (单选)
选项:
(A) http://localhost:8080/HelloServlet
(B) http://localhost:8080/helloapp/HelloServlet
(C) http://localhost:8080/helloapp/org/javathinker/hello
(D) http://localhost:8080/helloapp/hello


(4)客户请求访问HTML页面与访问Servlet有什么异同?(多选)
选项:
(A)相同:都使用HTTP协议
(B)区别:前者Web服务器直接返回HTML页面,后者Web服务器调用Servlet的方法,由Servlet动态生成HTML页面
(C)相同:前者Web服务器直接返回HTML页面,后者Web服务器直接返回Servlet的源代码。
(D)区别:后者需要在web.xml中配置URL路径。
(E)区别:前者使用HTTP协议,后者使用RMI协议。


(5)HttpServletRequest对象是由谁创建的?(单选)
选项:
(A)由Servlet容器负责创建,对于每个HTTP请求, Servlet容器都会创建一个HttpServletRequest对象
(B)由JavaWeb应用的Servlet或JSP组件负责创建,当Servlet或JSP组件响应HTTP请求时,先创建

HttpServletRequest对象


(6)从HTTP请求中,获得请求参数,应该调用哪个方法? (单选)
选项:
(A)调用HttpServletRequest对象的getAttribute()方法
(B)调用ServletContext对象的getAttribute()方法
(C)调用HttpServletRequest对象的getParameter()方法

(7)ServletContext对象是由谁创建的?(单选)
选项:
(A)由Servlet容器负责创建,对于每个HTTP请求, Servlet容器都会创建一个ServletContext对象
(B)由JavaWeb应用本身负责为自己创建一个ServletContext对象
(C)由Servlet容器负责创建,对于每个JavaWeb应用,在启动时,Servlet容器都会创建一个ServletContext对象


(8)jspForward1.jsp要把请求转发给jspForward2.jsp,应该在jspForward1.jsp中如何实现? (单选)
选项:
(A) <a href=“jspForward2.jsp”>jspForward2.jsp </a>
(B) <jsp:forward page=“jspForward2.jsp”>

(9)当浏览器第二次访问以下JSP网页时的输出结果是什么?(单选)

<!% int a=0;     %>
<%
     int b=0;
     a++;
     b++;
%>

a:<%= a %> <br>
b:<%= b %>
  
选项:
(A)  a=0  b=0
(B) a=1  b=1
(c) a=2  b=1

(10)下面哪个说法是正确的? (单选)
选项:
(A) 对于每个要求访问maillogin.jsp的HTTP请求,Servlet容器都会创建一个HttpSession对象
(B)每个HttpSession对象都有惟一的ID。
(C)JavaWeb应用程序必须负责为HttpSession分配惟一的ID

(11)如果不希望JSP网页支持Session,应该如何办? (单选)
选项:
(A) 调用HttpSession的invalidate()方法
(B) <%@ page session= “false\">


(12)在标签处理类中,如何访问session范围内的共享数据? (多选)
选项:
(A)在TagSupport类中定义了session成员变量,直接调用它的getAttribute()方法即可。
(B)在标签处理类TagSupport类中定义了pageContext成员变量,先通过它的getSession()方法获得当前的

HttpSession对象,再调用HttpSession对象的getAttribute()方法。
(C)pageContext.getAttribute(“attributename”,PageContext.SESSION_SCOPE)


(13)在下面的选项中,哪些是TagSupport类的doStartTag()方法的有效返回值? (多选)
选项:
(A) Tag.SKIP_BODY
(B) Tag.SKIY_PAGE
(C) Tag.EVAL_BODY_INCLUDE
(D) Tag.EVAL_PAGE


(14)以下代码能否编译通过,假如能编译通过,运行时得到什么打印结果?(单选)
request.setAttribute(\"count\",new Integer(0));
Integer count = request.getAttribute(\"count\");
选项:
A)不能编译通过  B)能编译通过,并正常运行  
C) 编译通过,但运行时抛出ClassCastException

答案:
(1)C (2)D  (3)D  (4)A,B,D  (5)A  (6)C  (7)C  (8)B  (9)C   (10)B
(11)B  (12)B,C  (13)A,C  (14)A

判断题:(其它试题请下载)

1 . Java 程序里 , 创建新的类对象用关键字 new ,回收无用的类对象使用关键字 free 。

2 .对象可以赋值,只要使用赋值号(等号)即可,相当于生成了一个各属性与赋值对象相同的新对象。

3 .有的类定义时可以不定义构造函数,所以构造函数不是必需的。

4 .类及其属性、方法可以同时有一个以上的修饰符来修饰。

5 . Java 的屏幕坐标是以像素为单位,容器的左下角被确定为坐标的起点

6 .抽象方法必须在抽象类中,所以抽象类中的方法都必须是抽象方法。

7 . Final 类中的属性和方法都必须被 final 修饰符修饰。

8 .最终类不能派生子类,最终方法不能被覆盖。

9 .子类要调用父类的方法,必须使用 super 关键字。

10 .一个 Java 类可以有多个父类。

11 .如果 p 是父类 Parent 的对象,而 c 是子类 Child 的对象,则语句 c = p 是正确的。

12 .一个类如果实现了某个接口,那么它必须重载该接口中的所有方法。

13 .当一个方法在运行过程中产生一个异常,则这个方法会终止,但是整个程序不一定终止运行。

14 .接口是特殊的类,所以接口也可以继承,子接口将继承父接口的所有常量和抽象方法。

15 .用“ + ”可以实现字符串的拼接,用 - 可以从一个字符串中去除一个字符子串。

16 .使用方法 length( ) 可以获得字符串或数组的长度。

17 .设 String 对象 s=”Hello ” ,运行语句 System.out.println(s.concat(“World!”)); 后 String 对象 s 的内容为 ”Hello world!” ,所以语句输出为

Hello world!

18 .创建 Vector 对象时构造函数给定的是其中可以包容的元素个数,使用中应注意不能超越这个数值。

19 .所有的鼠标事件都由 MouseListener 监听接口的监听者来处理。

20 .一个容器中可以混合使用多种布局策略。

21 . Java 中,并非每个事件类都只对应一个事件。

22 .一个线程对象的具体操作是由 run() 方法的内容确定的,但是 Thread 类的 run() 方法是空的 , 其中没有内容 ; 所以用户程序要么派生一个 Thread 的子类并在子类里重新定义 run() 方法 , 要么使一个类实现 Runnable 接口并书写其中 run() 方法的方法体。

23 . Java 的源代码中定义几个类,编译结果就生成几个以 .class 为后缀的字节码文件。

24 . Java Applet 是由独立的解释器程序来运行的。

25 . Java Applet 只能在图形界面下工作。

26 . Java 的字符类型采用的是 ASCII 编码。

27 . Java 的各种数据类型占用固定长度,与具体的软硬件平台环境无关

28 . Applet 是一种特殊的 Panel ,它是 Java Applet 程序的最外层容器。

29 .子类的域和方法的数目一定大于等于父类的域和方法的数目。

30 . System 类不能实例化,即不能创建 System 类的对象。

31 .用户自定义的图形界面元素也可以响应用户的动作,具有交互功能

32 . Java 中数组的元素可以是简单数据类型的量,也可以是某一类的对象。

33 . Vector 类中的对象不能是简单数据类型。

34 . Java 中的 String 类的对象既可以是字符串常量,也可以是字符串变量。

35 .容器是用来组织其他界面成分和元素的单元,它不能嵌套其他容器。

posted @ 2007-02-22 11:59 Sun River| 编辑 收藏
     摘要: Part I. XSLT Programming   1)   What is the exac...  阅读全文
posted @ 2006-11-27 08:00 Sun River| 编辑 收藏
     摘要:   阅读全文
posted @ 2006-10-28 15:15 Sun River| 编辑 收藏
     摘要:   阅读全文
posted @ 2006-09-18 11:51 Sun River| 编辑 收藏
仅列出标题  下一页