2018春季java校招_微策略2018春季校招java研发笔试题

1、Multiple Choice

A hash table contains 10 buckets and uses linear probing to resolve collisions.The key values are integers and the hash function used is( Key % 10).If the values 43,165,62,123,142 are inserted in the table, in what location would the key value 142 be inserted?

Linear probing is a method for resolving collisions in hash tables, data structures for maintaining a collection of key-value pairs and looking up the value associated with a given key. When the hash function causes a collision by mapping a new key to a cell of the hash table that is already occupied by another key, linear probing searches the table for the closest following free location and inserts the new key there.

A. 2

B. 3

C. 4

D. 6

2、Multiple Choice

The average time required to perform a successful sequential search for an element in an array A containing n elements is given by

A. (n+1)/2

B.  n

C. n(n+1)/2

D.

3、Multiple Choice

For merging two sorted lists of sizes m and n into a sorted list of sizes m+n,the numbers of comparisons required are

A. O(m)

B. O(n)

C. O(m + n)

D. O(logm + logn)

4、Trees Traversal

The postorder and preorder traversal of a binary tree are given below-

postorder :D E B F G C A

preorder: A B D E C F G respectively

The inorder traversal of the binary tree is()Pick one of the choices

A. D B E A F C G

B. E D B G F C A

C. E D B F G C A

D. D E F G B C A

5. Lookup operations

There are several factors that affect the efficiency of lookup operations in a hash table.Which of the following is NOT one of those factors?

A. Number of elements stored in the hash table

B. Size of elements stored in the hash table

C. Number of buckets in the hash table

D. Quality of the hash function

6、Java :Threads

What is the output of the following Java snippet?

public class SampleDemo

implements Runnable {

private

Thread t ;

private String

threadName;

SampleDemo

(String threadName) {

this.threadName

= threadName;

}

public

void run(){

while

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值