SSD3 Multiple-Choice Quiz 3
来源:互联网 发布:ubuntu 唤醒后 编辑:程序博客网 时间:2024/06/03 18:58
1. The return type for a method thatreturns nothing to its caller is
(a) false
(b) void
(c) null
(d) not specified in the method definition
Correct answer is (b)
2. Whichof the following statements about class variables in Java is not true?
(a) Non-static methods in a class canaccess the class variable defined in the same class.
(b) Class variables do not need thereference to the object of the instantiated class to access them.
(c) Class variables require the modifierstatic in the declarations.
(d) All objects have their own copy of theclass variable defined in the instantiated class.
Correct answer is (d)
3.
Whatis used to indicate that a method does not return a value? (a) the name of theclass to which it belongs
(b) the keyword static
(c) the keyword void
(d) the omission of the return type
Correctanswer is (c)
4.
Consider the following Java programsegment.
import java.io.*;
public class Test {
public Test( ) {
System.out.println("default");
}
public Test( int i ) {
System.out.println("non-default");
}
public static void main(String[] args) {
Test t = new Test(2);
}
}
Which of the following will be outputduring execution of the program segment?
(a) The line of text"non-default"
(b) The line of text "default"
(c) The line of text "default"followed by the line of text "non-default"
(d) The line of text"non-default" followed by the line of text "default"
Correctanswer is (a)
5.
Which of the following statements aboutconstructors in Java is true?
(a) A class can define more than oneconstructor.
(b) A constructor must be defined asstatic.
(c) A constructor must be defined aspublic.
(d) A class must define at least oneconstructor.
Correctanswer is (a)
6.
Whichis the Java keyword used to denote a class method?
(a) class
(b) final
(c) private
(d) static
Correctanswer is (d)
7.
If the method int sum(int a, int b) isdefined in a Java class C, which of the following methods cannot coexist as adifferent method in class C?
(a) float sum(int x, float y)
(b) int sum(float a, int b)
(c) int sum(int x, int y)
(d) int sum(int x, float y)
Correctanswer is (c)
8.
Whichis a Java access modifier used to designate that a particular data field willnot be inherited by a subclass?
(a) private
(b) final
(c) protected
(d) default
Correctanswer is (a)
9.
Fromwithin a child class, its parent class is referred to via the keyword
(a) parent
(b) base
(c) this
(d) super
Correctanswer is (d)
10.
Whena subclass defines an instance method with the same return type and signatureas a method in its parent, the parent's method is said to be
(a) private
(b) overridden
(c) overloaded
(d) hidden
Correctanswer is (b)
2.
Ifa class contains a constructor, that constructor will be invoked
(a) each time an object of that class isinstantiated
(b) once at the beginning of any programthat uses that class
(c) each time an object of that class goesout of scope
(d) once the first time an object of thatclass is instantiated
Correctanswer is (a)
3.
Theterm class variable is a synonym for
(a) a read-only variable
(b) a private data field
(c) an instance variable
(d) a static data field
Correctanswer is (d)
5.
Which of the following categorizations canbe applied to both the data fields and the methods in a Java class?
(a) native and non-native
(b) abstract and non-abstract
(c) static and non-static
(d) default and non-default
Correctanswer is (c)
9.
Consider the following Java classdefinitions.
public class Object1 {
protected String d(){
return "Hi";
}
}
public class Object2 extends Object1 {
protected String d(){
return super.d();
}
}
Which of the following statements is (are) trueregarding the definitions?
1.Class Object2 inherits from class Object1.
2.Class Object2 overrides method d.
3.Method d returns equivalent results when executed from either class.
(a) I and III only
(b) I, II, and III
(c) I and II only
(d) III only
Correctanswer is (b)
- SSD3 Multiple-Choice Quiz 3
- SSD3 Multiple-Choice Quiz 1
- SSD3 : Multiple-Choice Quiz 4
- ssd3 Multiple-Choice Quiz 1
- ssd3 Multiple-Choice Quiz 2
- SSD6 Multiple-Choice Quiz 4
- View Assessment Result: Multiple-Choice Quiz 2
- ssd6选择题——multiple-choice quiz 1
- ssd3:Practical Quiz 1 SecondsCalculator
- ssd3:Practical Quiz 1 iCarnegie Information
- ssd3:Practical Quiz 2 Debugging Class DNASequence
- Multiple choice listview in Android
- hdu 1712, multiple-choice knapsack,
- The ThreeWays about Radio , the multiple choice ......
- 2E02-View-Lists-multiple -choice-list
- 常用的dialog,包括:single Choice Dialog,Multiple choice Dialog,Input Dialog ,Progress Dialog....
- CHOICE
- Choice
- oracle的lpad函数
- NHibernate
- 圆角的实现(用最简单的方法,我认为是这样)
- 使用ExtJS GridPanel从Web Service 获取、绑定和显示数据
- 我收集的网页
- SSD3 Multiple-Choice Quiz 3
- Java设置classpth,path,java_home环境变量的目的
- BITBLt实例
- ExtJS中从WebService获取数据保存到本地,填充GridPanel实现静态数据分页
- VC多线程编程
- 网站开发中常用js表单取值方法
- Maven 常用命令连载
- SQL中合并分拆表方法汇总
- 查看 SQL 中JOB 的运行状态