1. The name of a
Javasource file
(a) has no restrictions
(b) must be the same as the
classit defines, ignoring case
(c) must use the extension .
class(d) must be the same as the
classit defines, respecting case
2. Which of the following statements is (are) true about the use of an asterisk (*) in a
Javaimport statement?
Ⅰ.It does not incur run-time overhead.
Ⅱ.It can be used to import multiple packages with a single statement.
Ⅲ.It can be used to import multiple
classes with a single statement
(a) I, II, and III
(b) I and III only
(c) I only
(d) III only
.....
9. According to the
Javacode conventions, files that contain
Javasource code have the suffix _____, and compiled bytecode files have the suffix _____.
(a) .
class, .
java(b) .
class, .
javac
(c) .
java, .
class(d) .
javac, .
class10. As an aid in debugging a program in
Java, print statements may be used to display which of the following types of information?
I. The names of methods being called
II. The values of the parameters of a method
Ⅲ. The values of the instance variables of a
class(a) I and II only (b) I and III only
(c) II and III only (d) I, II, and III
1. In a UML
classdiagram's representation of a
class, the top, middle, and lower rectangular compartments respectively describe the _____ of the
class.
(a) name, attributes, and methods (b) name, methods, and constants
(c) 笔试题 java基础 英文 attributes, methods, and name (d) attributes, methods, and constants
2. UML
classdiagrams can describe which of the following?
I. The in
ternal structure of
classes
Ⅱ. Relationships between
classes
(a) I and II (b) II only (c) None (d) I only
.......
1.The term
classvariable is a synonym for
(a) a private data field
(b) a static data field
(c) a read-only variable
(d) an instance variable
2. Consider the following
Javaprogram segment.
import
java.io.*;
public

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);
}
}
.........
9. When a
subclassdefines an instance method with the same return type and signature as a method in its parent, the parent's method is said to be
(a) private (b) hidden (c) overloaded (d) overridden
10. Which is a
Javaaccess modifier used to
designate that a particular data field will not be inherited by a
subclass?
(a) final (b) protected (c) private (d) default
1. Consider the following
Javaprogram segment.
String[] str = {"Three","Two","One"};
for (int i = 0; i < str.length; ++i) {
System.out.println(str[i]+"/");
}
What will be output upon execution of the program segment?
(a) Three/Two/One/ (b) Three,Two,One
(c) One,Two,Three (d) One/Two/Three/
2. Consider the following
Javaprogram segment.
int[] arr;
arr = new int[3];
arr[2]=19;
arr[1]=17;
arr[0]=15;
Which of the following
Javastatements is syntactically correct and semantically identical to the program segment?
(a) int[] arr= {15, 17, 19};
(b) int[3] arr = {15, 17, 19};
(c) int arr = {15, 17, 19};
(d) int arr[3]= {15, 17, 19};
........
2. Which of the following statements is (are) true about any
abstractmethod in
Java?
I. It contains no definition.
Ⅱ. It cannot be declared public.
(a) I and II (b) I only (c) None (d) II only
3. Consider the following
Javaprogram fragment.
public void drive(Vehicle v) {
...
}
...
drive(obj);
The method call drive(obj) is valid if obj is which of the following?
I. A descendent of
classVehicle
II. An ancestor of
classVehicle
Ⅲ. An object of
classVehicle
(a) I and III only (b) I, II, and III
(c) III only (d) II and III only
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/2722.html