笔试解答-----大家检查一下了

The quality of answers is important. It is OK to skip some questions. 可以用中文回答.
I) Computer operations (make the answer less than 4 lines for each question)
1. List troubleshooting steps if your Windows is unable to boot.
答:首先要根据系统不同启动时反馈的具体信息来采取不同的对策。 但大部分电脑不能启动的原因是:硬盘插口有没有坏掉,主板能不能连接上,硬盘上面的跳线插好没有 ,内存条查好了没有.在看看你的系统文件是不是坏掉了.
在看你的显卡声卡坏掉了没有,有时会影响你的机器正常启动 .只要采取相应的检查就可以了。
2. If a PC cannot access Internet (no virus, browser is fine), how to troubleshoot the network problem?
答:首先检查网络是否通畅,即检查本地连接是否正常,然后是检查网卡和ip地址设置是否正确,这些都能导致网络瘫痪,具体措施是:ping 自己机子的ip ,如果通,说明自己机器的tcp/ip和ip没问题,再ping 网关如果通,说明已经上路由器,最后ping 些大型网站地址,如果都不通就是dns设置错误。
3. If a PC is installed Linux, describe steps to install Windows on the same PC and test it.
答:首先下载虚拟启动文件,即为了配置虚拟机,然后重启电脑进入虚拟系统,加载windows安装文件即可
II) Computer science (make the answer less than 4 lines for each question)
4. How to calculate the execution time of a simple instruction “a=3” without writing a program?
答:首先在寄存器中为a变量分配存储空间,然后为其赋值为3,
        根据CPU的频率可以计算出时钟周期,乘以2从而得到该指令的运行时间。
III) Programming
5 How to write code to delete a specific node in a single link list (单链表)that takes O(1) time? That is, the time deleting a node is the same (independent from the length of the list.) Input is a pointer to the node to be deleted. Show your algorithm in pseudo code. Hint: just 3 steps.
答: q = p->next();
     p->next() = q->next();
     delete q;
个人观点:用空间换时间,把链表每个节点的指针留下作为一个数组,然后可以直接访问每个节点
插入和删除的时间复杂度就是o(1)

6 Class A generates random integers between -100 and 100 at a random frequency between 0 and 2 seconds. Class B decrements a counter when class A generated a negative integer and increments when class A generated a positive integer. Class B's counter needs to be updated in real time as class A generates numbers.
Show Java/C++ code when A and B are different threads.   
答:
import java.util.Random;
public class CurrentThread {
  
/**
* @param args
*/
public static void main(String[] args) {
       new A();//实例化类A
       new B();//实例化化B
}

class A implements Runnable{//类A
Thread th;
static int intRand;//随机数
Random r=new Random();
A() {
   th=new Thread(this);
   th.start();
    }
public void run() {//实现抽象方法
   while(true) {
    intRand=100-r.nextInt(200);//随机产生(-100,100)中的整数a
    try {
     intRand=r.nextInt(2000);//随机产生数字的周期时间(0,2)秒
     Thread.sleep(intRand);
    } catch (InterruptedException e) {
     System.out.println("Thread is Interrupted");
    }
   }
}
}

class B implements Runnable {//类B
   static int count=0;//静态变量

 public synchronized void deposit(int count) {//加法
  count += amt;
 }

 public synchronized void withdraw(int count) {//减法
  count -= amt;
  }

public void run() {//实现抽象方法
   if(A.intRand>0) {//a大于0的情况
           deposit(A.intRand);
         }else {//a小于0
         withdraw(A.intRand);
      }
   System.out.println("0b2's value is:"+B.count);//在控制台输出count的结果
             }
}

}
IV) Design
7. A video software has 3 buttons: Play, Pause, Step Forward. Initially, only play button is visible. When user clicks play button, it starts to play video and only pause button is visible. Click pause, only play and step forward buttons are visible. Complete the state machine table below with 3 states: Play, Pause, Null.

State / Event Click Play button Click Pause button Click Step Forward button   
Init Pause Null Null   
Play Play Pause Null   
Pause Pause Null Pause

8. In a simple game, a ball is moving along a line from the left end toward the right end.
Show UML class diagram

分析如下:
class ball                                  
{
property:
     xpoint;
mothod:
     goMove();
     backMove();
}

class line
{
   property:
     startPosition;
     endPosition;
}
其中ball.xpoint的范围是[line.startposition,line.endposition]

抱歉,由于现在所在的网吧的电脑上只有写字板,不能进行画图。

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值