综合知识Java工程师单选难度 3真题改编 · 2023
207. 已知字符集{ a, b, c, d, e, f },若各字符出现的次数分别为{ 6, 3, 8, 2, 10, 4 },若字符f对应的哈夫曼编码为100,则字符e对应的哈夫曼编码为?
练习本题 ›
综合知识Java工程师单选难度 3真题改编 · 2023
208. 下面答案可能正确的是
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
public class NowCoder {
public static void main(String[] args) {
String key = null;
Integer value = null;
Hashtable table = new Hashtable();
key="3";value=4;
table.put(key, value);
key="2";value=2;
table.put(key, value);
key="3";value=2;
table.put(key, value);
iteratorEntryset(table);
}
private static void iteratorEntryset(Hashtable table) {
if (table == null)
return ;
String key = null;
Integer integer = null;
Iterator iter = table.entrySet().iterator();
while(iter.hasNext()) {
Map.Entry entry = (Map.Entry)iter.next();
key = (String)entry.getKey();
integer = (Integer)entry.getValue();
System.out.println(key+" -- "+integer.intValue());
}
}
}
练习本题 ›
综合知识Java工程师单选难度 3真题改编 · 2023
213. 如下代码: public static void main(String[] args) {
int[] da1 = new int[]{1, 3, 5};
int[] da2 = new int[]{2, 4, 6};
System.out.print(da2[da1[0]]);
interchange(da1, da2);
System.out.print(da1[da2[0]]);
}
static void interchange(int[] da1, int[] da2) {
int[] dat = da1;
da1 = da2;
da2 = dat;
}
请问编译运行的结果是什么?
练习本题 ›
综合知识前端工程师单选难度 3真题改编 · 2023
239. 对于一个数字组成的数组 nums,现在需要执行在不改动 nums 的基础上去重操作,返回一个新的无重复元素的数组,以下几段代码能完成这一操作的是() (1)
const newNums = Array.from(new Set(nums))
(2)
const newNums = nums.filter((n, i) => {
return nums.indexOf(n) === i
})
(3)
const newNums = nums.forEach((n, i) => {
return nums.indexOf(n) === i
})
(4)
const newNums = nums.reduce((acc, n, i) => {
return [].concat(acc, nums.indexOf(n) === i ? n : []
)
})
练习本题 ›
综合知识Java工程师单选难度 3真题改编
240. 假设磁头当前位于116道,正在向磁道序号增加的方向移动。现有一个磁道访问请求序列为48, 59, 37, 81, 125, 195, 185, 205采用电梯调度SCAN算法得到的磁道访问序列是:
练习本题 ›