for (j=0; j < list.length; j++)
if (list[j] < temp) c++;
A . It finds the smallest value and stores it in temp
B . It finds the largest value and stores it in temp
C . It counts the number of elements equal to the smallest value in list
D . It counts the number of elements in list that are less than temp
E . It sorts the values in list to be in ascending order
答案:D。if(list[j]<temp)c++;语句将list中的每个元素与temp进行比较,并且仅当元素小于temp时才将一个元素添加到c中,因此它计算list中小于temp的元素数,并将结果存储在c中。>
A . true
B . false
答案:B。决定调用哪个方法的是对象的类型,而不是引用的类型。
A . true
B . false
答案:A。这是使用类名声明引用变量的多态函数之一。
A . true
B . false
答案:A。大多数其他搜索技术都要求对其数据进行排序,以便获得更高的效率(速度)。但是,线性搜索没有这样的要求。结果是,线性搜索可能比人们期望的要慢,但它总是有效的,而且人们在搜索数据之前不需要支付排序数据的(昂贵的)代价。
A . true
B . false
答案:B。只有对数据进行排序时,二进制搜索才起作用。二进制搜索算法通过假设每对数据元素之间有严格的关系来进行,无论是升序还是降序。如果没有这个顺序,二进制搜索将无法正常工作。
A . the active methods in the order that they were invoked
B . the active methods in the opposite order that they were invoked
C . the values of all instance data of the object where the exception was raised
D . the values of all instance data of the object where the exception was raised and all local variables and parameters of the method where the exception was raised
E . the name of the exception thrown
答案:B。调用堆栈跟踪提供存储在运行时堆栈上的方法的名称。方法名从堆栈中移除的顺序与它们的放置顺序相反,也就是说,最早的方法首先放置在堆栈中,下一个方法第二个放置在堆栈中,以此类推,以便最近调用的方法是堆栈中的最后一个项,因此它是第一个移除的项。堆栈跟踪然后按调用它们的相反顺序显示所有活动方法(最新的先显示)。
A . Error
B . Exception
C . RuntimeException
D . IllegalAccessException
E . CheckedException
答案:C。这两个异常都是RuntimeException的子级,RuntimeException本身是Exception的子级。error是一个可丢弃的对象,它不同于exception,而illegalaccessexception和checkedeexception是exception的子级,但不是runtimeexception。
A . throw
B . throws
C . try
D . Throwable
E . goto
答案:A。保留字throw用于在检测到异常时引发异常,如:if(score<0)throw new illegalTestScoreException(“input score”+score+“is negative”);>
A . has both print and println methods and PrintStream only has print
B . can output both byte and character streams and PrintStream can only output byte streams
C . has error checking mechanisms as part of the class and PrintStream does not
D . will not throw checked exceptions and PrintStream will
E . all of the above
答案:C。printwriter类是writer类,而printstream类是stream类。主要的区别在于,printwriter是专门为文件设计的,因此有错误检查机制,这些机制不是printstream的一部分。
A . checked exceptions need not be listed in a throws clause
B . unchecked exceptions must be listed in a throws clause
C . neither kind of exception follows the rules of exception propagation
D . an unchecked exception requires no throws clause
E . a checked exception always must be caught by a try block; an unchecked exception does not
答案:D。必须捕获选中的异常,或者必须将其列在throws子句中。未检查的异常不需要throws子句。这两种异常都遵循异常传播的规则。
A . true
B . false
答案:A。异常是敏感的事件,或者是在没有异常处理程序的情况下无法正常处理的运行时情况。异常由关联的异常处理程序捕获。如果抛出异常但未处理,则程序必须终止。
A . true
B . false
答案:A。所有try语句必须至少有一个catch语句,否则没有理由使用try语句。对于可能引发的每种类型的异常,都可以有一个catch语句。程序员可以根据需要指定任意多个catch语句。此外,try语句可能有finally子句,但不需要。
代码行数(新增/累积) | 博客量(新增/累积) | 学习时间(新增/累积) | 重要成长 | |
---|---|---|---|---|
目标 | 10000行 | 30篇 | 400小时 | |
第一周 | 138/138 | 2/2 | 25/25 | 学会写和上传代码,会编简单的输出程序 |
第二周 | 88/226 | 1/3 | 30/55 | 起文件名不能太长 |
第三周 | 898/1124 | 2/5 | 35/90 | Java类里面的方法和C语言的函数很像 |
第四周 | 632/1756 | 2/7 | 30/120 | 可以用继承extends简化重复的代码 |
第五周 | 770/2526 | 2/9 | 45/165 | --amend -m可以重命名没push的文件 |
第六周 | 3947/6473 | 2/11 | 40/205 | 接口类的功能要分散,利用多继承完成功能 |
20182309 2019-2020-1 《数据结构与面向对象程序设计》第6周学习总结
原文:https://www.cnblogs.com/blueflameashe/p/11679518.html