给出的题目如下:

我的解答如下:

For program 1:
1.

where i > 0 is the fault , it should be changed to i>= 0 to avoid x is just one element situation.

2.x[] ={} or x[]={n}(n is equal to any numb),for example x[] ={1};
//test: x[] = {};y =2
//expected = NullPointerException; output = NullPointerException
3.
//test:x[] ={3 2 5} ; y = 2
//expected = 1; output = 1
4.
//test:x[] ={3} ; y = 2
//expected = -1; output = -1
For program 2:
1.

where the for loop is to get the first ZERO in array, it should be changed to
for(int i = x.length -1; i >= 0; i --)
2.
it is impossible, cause it doesn't belong to the fault. Its code is to get the First ZERO NOT LAST
3.
//test:x=[2 1 0]
//expect = 2; output = 2
4.
//test:x=[0 1 2]
//expect = 0 ; output = 0          

软件测试作业 - fault error failure的更多相关文章

  1. 软件测试中的fault,error,failure

    问题:给定两段代码,设计fault,error,failure的测试用例. fault:即引起错误的原因,类似病因. error:类似疾病引起的内部结果. failure:类似疾病引起的症状. 代码1 ...

  2. 结对编程2—Fault&Error&Failure

    学习进度表 点滴成就 学习时间 新编写代码行数 博客量(篇) 学到知识点 第一周 8 0 0 了解软件工程 第二周 10 0 1 博文一篇 第三周 15 0 2 选择项目.调查问卷 第四周 20 80 ...

  3. ST HW2 fault & error & failure

    Software Testing 3014218128 牛菲菲 Below are two faulty programs. Each includes a test case that result ...

  4. 结对编程--fault,error,failure的程序设计

    一.结对编程内容: 1.不能触发Fault. 2.触发Fault,但是不触发Error. 3.触发Error,但不触发Failure. 二.结对编程人员 1.周浩,周宗耀 2.结对截图: 三.结对项目 ...

  5. 结对项目——fault,error,failure的程序设计

    一.结对编程内容: 1.不能触发Fault. 2.触发Fault,但是不触发Error. 3.触发Error,但不触发Failure. 二.结对编程人员 1.周宗耀.周浩: 2.结对截图: 三.结对项 ...

  6. NDK配置debug环境时:Error:FAILURE: Build failed with an exception

    Error:FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:ex ...

  7. Error: failure: repodata/repomd.xml from fedora: [Errno 256] No more mirrors to try.

    记录一个小问题,重新买的linux换yum源的时候一直提示: Error: failure: repodata/repomd.xml ] No more mirrors to try. 一直说那个XM ...

  8. [linux]Error: failure: repodata/repomd.xml from fedora: [Errno 256] No more mirrors to try.

    在使用fedora17 系统的yum源的时候出现了例如以下错误: Error: failure: repodata/repomd.xml from fedora: [Errno 256] No mor ...

  9. 安装zabbix-agent报错 Error: failure: repodata/primary.xml.gz from zabbix: [Errno 256] No more mirrors to try.

    安装zabbix-agent报错 yum install -y zabbix-agent Loaded plugins: fastestmirror, refresh-packagekit, secu ...

随机推荐

  1. 【bzoj 4764】弹飞大爷

    Description 自从WC退役以来,大爷是越来越懒惰了.为了帮助他活动筋骨,也是受到了弹飞绵羊一题的启发,机房的小伙伴们决定齐心合力构造一个下面这样的序列.这个序列共有N项,每项都代表了一个小伙 ...

  2. APPLE-SA-2019-3-25-3 tvOS 12.2

    APPLE-SA-2019-3-25-3 tvOS 12.2 tvOS 12.2 is now available and addresses the following: CFStringAvail ...

  3. Java EE之Request部分方法使用示例

    Description: ApplicationProjectName:MedicineMs login.jsp[action:login|method:get] to loginServlet Ou ...

  4. Django相关面试题

    Django框架的生命请求周期 浏览器上输入地址,回车然后发生了什么? => Http请求生命周期 ? 什么是wsgi 以及作用? 中间件 中间件的执行流程? 中间件的执行流程? 说一下Djan ...

  5. Hadoop之HDFS思维导图

  6. linux 权限管理 初识

  7. MySql cmd下的学习笔记 —— 有关建立表的操作(有关于数据类型)

    (01)建表的过程实际上是 声明字段 的过程 一. 列类型(字段): 存储同样的数据时,不同的列类型,所占据的空间和效率是不一样的,这就是建表时要考虑的意义. 二.MySQL三大列类型     数值型 ...

  8. CentOS 7安装Redis

    第一步:安装gcc依赖 先通过gcc -v是否有安装gcc,如果没有安装,执行命令 yum install -y gcc(yum install -y gcc-c++) 第二步:下载redis安装包 ...

  9. pythonのSocket

    TCP/IP 三次握手 第一次 A向B 发送 syn 请求 然后B给A返回 syn + ack A收到后,给B返回ack 握手成功. Socket 网络编程 实现通信 要通过IP+Port Socke ...

  10. CentOS7.4安装部署KVM虚拟机

    命令:virt-manager 可以查看已经安装的虚拟机 参考文档:1.https://blog.csdn.net/qq_39452428/article/details/80781403