【散分200】12:00以前结贴:求30个面试题答案(都是选择题)。朋友发的,由于自己英文不太地道,特来坛子里求助各位朋友。人多力量大,先谢谢了!

Defonds
Java领域优质创作者
博客专家认证
2009-04-23 09:44:09
【散分200】12:00以前结贴:求30个面试题答案(都是选择题)。朋友发的,由于自己英文不太地道,特来坛子里求助各位朋友。人多力量大,先谢谢了!


ps:12:00以前结贴,顶贴就有分,给出答案者重点回报:)

(Java Script, Java,Java EE, Database Design, SQLQuery, MVC)
Circle one or more options which are correct.
1. Why would someone want to use JavaScript on a Web page? (5 scores)
A. To react to events that occur with Web page use
B. To read and write HTML
C. To validate data in a Web form
D. To pass data to a Java applet program
E. To run a clock or timer in a Web page
ACE C

2. Evaluate the following String method uses by writing the value of s after the evaluation (5 scores)
(write one value on the line to the right of each evaluation)
var str="Mix and Match"
A. s = str.indexOf("x")
B. s = str.indexOf("g")
C. s = str.indexOf("M")
D. s = str.lastIndexOf("a")
E. s = str.indexOf("and")

3. How can someone properly open a second Web browser window with a JavaScript statement?(5 scores)
A. document.openWin("http://www.thedomain.com/")
B. openWindow("http://www.thedomain.com/")
C. window.open(“http://www.thedomain.com/”)
D. document.open("http://www.thedomain.com/")
E. document.location("http://www.thedomain.com/")

4. Given the following valid HTML form, how would you assign the value typed into the owner
control to a variable ssn in a JavaScript statement?(5 scores)
<FORM Name=SSN Action=processme.html>
<INPUT Name=owner>
</FORM>
A. ssn = window.SSN.owner.value;
B. ssn = document.SSN.owner.value;
C. ssn = document.SSN.input.value;
D. ssn = document.form.input.value;
E. ssn = window.owner.value;

5. After a JavaScript function runs the following two lines of code, what value does the variable x contain?(5 scores)
arr = new Array(5);
x = Math.random() / arr.length;
A. a floating point number between 0.0 and 0.2
B. a floating point number between 0.0 and 0.25
C. a floating point number between 0.0 and 1.0
D. a floating point number between 0.0 and 5.0
E. x would not be assigned due to one or more errors in the code

6. What is the value of variable x after the following block of JavaScript code is run? (5 scores)
x=0;
y=2;
while(y>0.5 || y<0.0) {
x = x+1;
y = y/x - y;
}
A. 0
B. 1
C. more than 1
D. undetermined since the code divides by zero
E. less than 1

7. What will happen when you attempt to compile and run this code? (5 scores)
abstract class Base{
abstract public void myfunc();
public void another(){
System.out.println("Another method");
}
}

public class Abs extends Base{
public static void main(String argv[]){
Abs a = new Abs();
a.amethod();
}
public void myfunc(){
System.out.println("My Func");
}
public void amethod(){
myfunc();
}
}
A The code will compile and run, printing out the words "My Func"
B The compiler will complain that the Base class has non abstract methods
C The code will compile but complain at run time that the Base class has non abstract methods
D The compiler will complain that the method myfunc in the base class has no body, nobody at all to looove it

8. Which most closely matches a description of a Java Map? (5 scores)
A. A vector of arrays for a 2D geographic representation
B. A class for containing unique array elements
C. A class for containing unique vector elements
D. An interface that ensures that implementing classes cannot contain duplicate keys

9. What will happen when you attempt to compile and run the following code? (5 scores)
public class StrEq{
public static void main(String argv[]){
StrEq s = new StrEq();
}
private StrEq(){
String s = "Marcus";
String s2 = new String("Marcus");
if(s == s2){
System.out.println("we have a match");
}else{
System.out.println("Not equal");
}
}
}
A. Compile time error caused by private constructor
B. Output of "we have a match"
C. Output of "Not equal"
D. Compile time error by attempting to compare strings using ==

10. What will happen when you attempt to compile and run the following code? (5 scores)
import java.io.*;
class Base{
public void amethod()throws FileNotFoundException{}
}
public class ExcepDemo extends Base{
public static void main(String argv[]){
ExcepDemo e = new ExcepDemo();
}
public void amethod(){}
protected ExcepDemo(){
try{
DataInputStream din = new DataInputStream(System.in);
System.out.println("Pausing");
din.readByte();
System.out.println("Continuing");
this.amethod();
}catch(IOException ioe) {
}
}
}
A. Compile time error caused by protected constructor
B. Compile time error caused by amethod not declaring Exception
C. Runtime error caused by amethod not declaring Exception
D. Compile and run with output of "Pausing" and "Continuing" after a key is hit

11. What will happen when you attempt to compile and run this program? (5 scores)
public class Outer{
public String name = "Outer";
public static void main(String argv[]){
Inner i = new Inner();
i.showName();
}//End of main
private class Inner{
String name =new String("Inner");
void showName(){
System.out.println(name);
}
}//End of Inner class
}
A. Compile and run with output of "Outer"
B. Compile and run with output of "Inner"
C. Compile time error because Inner is declared as private
D. Compile time error because of the line creating the instance of Inner

12. What will be output by the following line? (5 scores)
System.out.println(Math.floor(-2.1));
A. -2
B. 2.0
C. -3
D. -3.0

13. What will happen when you attempt to compile and run the following code? (5 scores)
int Output=10;
boolean b1 = false;
if((b1==true) && ((Output+=10)==20)){
System.out.println("We are equal "+Output);
}else {
System.out.println("Not equal! "+Output);
}
A. Compile error, attempting to peform binary comparison on logical data type
B. Compilation and output of "We are equal 10"
C. Compilation and output of "Not equal! 20"
D. Compilation and output of "Not equal! 10"

14. Given the following variables
char c = 'c';
int i = 10;
double d = 10;
long l = 1;
String s = "Hello";
Which of the following will compile without error? (5 scores)
A.c=c+i; 不能把int类型转换成char
B.s+=i;
C.i+=s; 不能把String类型转换成int
D.c+=s; 不能把String类型转换成char


15. Given the following class definition, which of the following statements would be legal after the comment //Here? (5 scores)
class InOut{
String s= new String("Between");
public void amethod(final int iArgs){
int iam;
class Bicycle{
public void sayHello(){
//Here
}
}//End of bicycle class
}//End of amethod
public void another(){
int iOther;
}
}
A. System.out.println(s);
B. System.out.println(iOther);
C. System.out.println(iam);
D. System.out.println(iArgs);
...全文
317 31 打赏 收藏 转发到动态 举报
写回复
用AI写文章
31 条回复
切换为时间正序
请发表友善的回复…
发表回复
why_java 2009-08-13
  • 打赏
  • 举报
回复

英语也不好
要扑了
llsen 2009-04-23
  • 打赏
  • 举报
回复
来晚了,,
ykwfly 2009-04-23
  • 打赏
  • 举报
回复

英语也不好 帮顶个吧!!
ben0759 2009-04-23
  • 打赏
  • 举报
回复
看到好头晕。。。哇。。。
cbdhxka 2009-04-23
  • 打赏
  • 举报
回复
[Quote=引用 24 楼 qsrock 的回复:]
6. What is the value of variable x after the following block of JavaScript code is run? (5 scores)
x=0;
y=2;
while(y>0.5 || y <0.0) {
x = x+1;
y = y/x - y;
}
A. 0
B. 1//这一个是正确的
C. more than 1
D. undetermined since the code divides by zero
E. less than 1
[/Quote]

1正确 value of variable x
qsrock 2009-04-23
  • 打赏
  • 举报
回复
25. Which interface defines the methods for retrieving form parameters? (5 scores)
A.ServletRequest
B.ServletResponse
C.HTTPRequest
D.HTTPResponse

A是正确的
qsrock 2009-04-23
  • 打赏
  • 举报
回复
6. What is the value of variable x after the following block of JavaScript code is run? (5 scores)
x=0;
y=2;
while(y>0.5 || y<0.0) {
x = x+1;
y = y/x - y;
}
A. 0
B. 1//这一个是正确的
C. more than 1
D. undetermined since the code divides by zero
E. less than 1
wsmh3333 2009-04-23
  • 打赏
  • 举报
回复
看不懂鸟语……
mankeyluo 2009-04-23
  • 打赏
  • 举报
回复
6. What is the value of variable x after the following block of JavaScript code is run? (5 scores)
x=0;
y=2;
while(y>0.5 || y<0.0) {
x = x+1;
y = y/x - y;
}
A. 0
B. 1
C. more than 1
D. undetermined since the code divides by zero
E. less than 1
zfl110 2009-04-23
  • 打赏
  • 举报
回复
13 d,17 a
rgmlkthh 2009-04-23
  • 打赏
  • 举报
回复
ding.mark
zfl110 2009-04-23
  • 打赏
  • 举报
回复
5 a
moonjaya 2009-04-23
  • 打赏
  • 举报
回复
帮你顶下..
Billy.Wang 2009-04-23
  • 打赏
  • 举报
回复
25. Which interface defines the methods for retrieving form parameters? (5 scores)
A.ServletRequest
B.ServletResponse
C.HTTPRequest
D.HTTPResponse

A

其他人继续吧。我要忙一会了。
oh_jf 2009-04-23
  • 打赏
  • 举报
回复
12:D
pathuang68 2009-04-23
  • 打赏
  • 举报
回复
想帮你做,但是实在木有时间。Sorry
Billy.Wang 2009-04-23
  • 打赏
  • 举报
回复
24. You normally write a servlet by overriding the doPut, doGet, and doPost methods. Which class do they come from? (5 scores)
A.HttpServletRequest
B.HttpServletResponse
C.HttpServlet
D.HttpSession

C


刚那个26题答案我不太确定。
zuguanqun 2009-04-23
  • 打赏
  • 举报
回复
4 b
Billy.Wang 2009-04-23
  • 打赏
  • 举报
回复
26. Given the following deployment descriptor code:
<servlet>
<servlet-name>test</servlet-name>
<servlet-class>TestServlet</servlet-class>
<init-param>
<param-name>color</param-name>
<param-value>green</param-value>
</init-param>
</servlet>
Which methods can be used to access a servlet initialization parameter color? (5 scores)
A.Servlet.getInitParameter()
B.HttpServletRequest.getParameter()
C.ServletContext.getInitParameter()
D.ServletConfig.getInitParameter()

C
Billy.Wang 2009-04-23
  • 打赏
  • 举报
回复
27. Which of the following objects are available within JSP? (5 scores)
A.request
B.response
C.error
D.exception

AB
加载更多回复(11)

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧