当前位置:网站首页 > Java基础 > 正文

java20道基础测试




1.我们可以在下列哪个 HTML 元素中放置 Javascript 代码?()

A.<script>

B.<javascript>

C.<js>

D.<scripting>


2.写 "Hello World" 的正确 Javascript 语法是?()

A.("Hello World")

B."Hello World"

C.response.write("Hello World")

D.document.write("Hello World")


3.插入 Javacript 的正确位置是?()

A.<body>部分

B.<head>部分

C.<body>部分和<head>部分均可


4.引用名为 "xxx.js" 的外部脚本的正确语法是?()

A.<script src="https://mp.weixin..com/xxx.js">

B.<script href="https://mp.weixin..com/xxx.js">

C.<script name="xxx.js">


5.如何在警告框中写入 "Hello World"?()

A.alertBox="Hello World"

B.msgBox("Hello World")

C.alert("Hello World")

D.alertBox("Hello World")


6.如何创建函数?()

A.function:myFunction()

B.function myFunction()

C.function=myFunction()


7.如何调用名为 "myFunction" 的函数?()

A.call function myFunction

B.call myFunction()

C.myFunction()


8.如何编写当 i 等于 5 时执行一些语句的条件语句?()

A.if (i==5)

B.if i=5 then

C.if i=5

D.if i==5 then

9.如何编写当 i 不等于 5 时执行一些语句的条件语句?()

A.if =! 5 then

B.if >< 5

C.if (i >< 5)

D.if (i != 5)



10.在 JavaScript 中,有多少种不同类型的循环?()

A.两种。for 循环和 while 循环。

B.四种。for 循环、while 循环、do...while 循环以及 loop...until 循环。

C.一种。for 循环。


11.for 循环如何开始?()

A.for (i <= 5; i++)

B.for (i = 0; i <= 5; i++)

C.for (i = 0; i <= 5)

D.for i = 1 to 5


12.如何在 JavaScript 中添加注释?()

A.' This is a comment

B.<!--This is a comment-->

Chttps://mp.weixin..com//This is a comment


13.可插入多行注释的 JavaScript 语法是?()

Ahttps://mp.weixin..com/*This comment has more than one line*/

java20道基础测试

Bhttps://mp.weixin..com//This comment has more than one line//

C.<!--This comment has more than one line-->


14.定义 JavaScript 数组的正确方法是?()

A.var txt = new Array="George","John","Thomas"

B.var txt = new Array(1:"George",2:"John",3:"Thomas")

C.var txt = new Array("George","John","Thomas")

D.var txt = new Array:1=("George")2=("John")3=("Thomas")


15.如何把 7.25 四舍五入为最接近的整数?()

A.round(7.25)

B.rnd(7.25)

C.Math.rnd(7.25)

D.Math.round(7.25)


16.如何求得 2 和 4 中最大的数?()

A.Math.ceil(2,4)

B.Math.max(2,4)

C.ceil(2,4)

D.top(2,4)


17.打开名为 "window2" 的新窗口的 JavaScript 语法是?()

A.open.new("http://www.w3cschool.cn","window2")

B.new.window("http://www.w3cschool.cn","window2")

C.new("http://www.w3cschool.cn","window2")

D.window.open("http://www.w3cschool.cn","window2")


18.如何在浏览器的状态栏放入一条消息?()

A.statusbar = "put your message here"

B.window.status = "put your message here"

C.window.status("put your message here")

D.status("put your message here")


19.如何获得客户端浏览器的名称?()

A.client.navName

B.navigator.appName

C.browser.name


20.外部脚本必须包含 <script> 标签。()

版权声明


相关文章:

  • java基础之标识符2024-11-01 11:42:01
  • java16基础2024-11-01 11:42:01
  • java工作基础不好可以找到工作吗2024-11-01 11:42:01
  • 基础java中冒泡排序2024-11-01 11:42:01
  • java包装类型与基础类型比较2024-11-01 11:42:01
  • java基础重要部分2024-11-01 11:42:01
  • java笔试基础题被刷2024-11-01 11:42:01
  • 有java基础网课2024-11-01 11:42:01
  • 无锡java零基础学习2024-11-01 11:42:01
  • java基础知识重点2024-11-01 11:42:01