1.假设需实现构造函数Scope,它的特性如下:

1
2
3
4
5
6
7
8
9
10
var scopeA = new Scope();
scopeA.title = 'My title';
var scopeB = scopeA.$clone();
// 实例有$clone方法用创建一个对象克隆,表现如下
console.log(scopeB.title === 'My title'); //输出 true
scopeA.title = 'Home title';
console.log(scopeB.title === 'Home title'); //输出true
//但是一旦scopeB主动修改它的属性,scopeA并不受影响
scopeB.title = 'scopeB title';
console.log(scopeA.title === 'Home title'); //输出 true

请实现满足这个条件构造函数Scope(只需要实现上述描述需求即可);

解答:

1
2
3
4
5
6
7
8
9
10
11
function Scope () {}
Scope.prototype.$clone = function() {
return Object.create(this, {
constructor: {
value: Scope,
enumerable: true,
writeable: true,
configurable: true
}
});
}


2.题目图片

1
2
3
<html>
</html>

3.使用HTML+CSS实现如图布局,border-width:5px,格子大小是50px*50px,hover时边框变成红色,需要考虑语义化。
题目图片

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!doctype html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
</script>
<style>
.table {
display: table;
border-collapse: collapse;
}
.row {
display: table-row;
}
.cell {
display:table-cell;
width: 50px;
height: 50px;
border: 5px solid blue;
}
.cell:hover {
border-color: red;
}
</style>
</head>
<body>
<div class="table">
<div class="row">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="row">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="row">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
</div>
</body>
</html>

4.在移动端浏览器,页面采用click事件,会存在300ms的延迟,为什么();
A.浏览器先要阻止默认事件
B.浏览器底层在处理一些操作,等待操作完成后才能执行click操作
C.浏览器需要等待一段时间来判断是不是双击(double tap)
D.这是浏览器的一个BUG
5.MVC是一种常见的架构,以下描述错误的是?()
A.只有Web系统才能使用MVC
B.只有能够保存在数据库里面的实体才能称之为模型(Model)
C.只有以HTML形式显示的页面才是视图(View)
D.模型变更之后,只有控制器(Controller)才能驱动视图变更或重新渲染视图
6.下面这段java代码的输出结果是?(不考虑java1.5之前的老版本和换行)(C)

1
2
3
4
5
6
7
8
9
public class HelloWorld{
public static void main(String[] args) {
Integer i1 = 127, i2 = 127, i3 = 128, i4 = 128;
System.out.println(i1 == i2);
System.out.println(i1.equals(i2));
System.out.println(i3 == i4);
System.out.println(i3.equals(i4));
}
}

A.false true true true
B.true flase true true
C.true true false true
D.true true true false
7.以下这些树中,属于平衡二叉树的有那些?()
A.红黑树
B.二叉查找树
C.B+树
D.二叉树
E.完全二叉树
8.以下javascript代码执行结果是?(A)

1
2
3
4
5
6
var i = 1;
(function(){
x = 2;
y = 2;
})();
console.log(x == y);

A.TRUE B.FALSE C.浏览器脚本错误 D.null
9.下面代码,页面打开后能弹出alert(1)的有:()
A.<iframe src="javascript:alert(1)"></iframe>
B.<img src="" onerror="alert(1)" />
C.IE下,<s style="top:expression(alert(1))"></s>
D.<div onclick="alert(1)"></div>