Test
My Java Study Guide
Este test tiene tipos de pregunta que se abren en el reproductor de siempre.
Preguntas del test (29)
1___________ is attached to the class of the composing class to denote the aggregation relationship with the composed object.
- AAn empty diamond
- BA solid diamond
- CAn empty oval
- DA solid oval
2Write an expression that creates a Double object for the number 5.3
[blank_start]_______________________________[blank_end]- Anew Double(5.3)
3Write an expression that returns a decimal integer from a binary string 1011
[blank_start]__________________________________[blank_end]- AInteger.parseInt("1011", 2)
4Write an expression for the minimum int type value
[blank_start]______________________________[blank_end]- AInteger.MIN_VALUE
5The type of the first argument in Integer.parseInt() can only be of the String type
- AVerdadero
- BFalso
6s1 and s2 reference the same String object
String s1 = new String("foo");
String s2 = s1;
s1 += "bar";- AVerdadero
- BFalso
7Which of the following are real StringBuilder methods?
- Aclear
- Binsert
- Cadd
- Ddelete
- Ereverse
- FsetCharAt
- Gappend
8A subclass is a subset of its superclass
- AVerdadero
- BFalso
9If a parameter is an object the formal and actual parameters will reference the same object
- AVerdadero
- BFalso
10The output of the following code is: [blank_start]_________[blank_end]
public class MainProgram {
public static void main(String[] args) {
C shore = new C();
}
}
class A {
public A() {
System.out.print("A");
}
}
class B extends A {
public B() {
System.out.print("B");
}
}
class C extends B {
}- AAB
11If a method defined in a subclass is private in its superclass, the two methods are completely unrelated.
- AVerdadero
- BFalso
12Overloading allows a programmer to have more than one method with the same name but with different signatures to distinguish them.
- AVerdadero
- BFalso
13Overriding allows a programmer to have more than one method with the same name but with different signatures to distinguish them.
- AVerdadero
- BFalso
14A method in a subclass can overload a method in the superclass
- AVerdadero
- BFalso
15You can pass a supertype variable to a subtype without explicit casting
- AVerdadero
- BFalso
16Which of these statements will cause an error?
public class Test {
public static void main(String[] args) {
m(new Pistol());
m(new Gun());
m(new Weapon());
m(new Object());
}
public static void m(Gun x) {
System.out.println(x.toString());
}
}
class Pistol extends Gun{
}
class Gun extends Weapon {
@Override
public String toString() {
return "Gun";
}
}
class Weapon extends Object {
@Override
public String toString() {
return "Weapon";
}
}- Am(new Pistol());
- Bm(new Gun());
- Cm(new Weapon());
- Dm(new Object());
17Casting an object reference variable affects the contents of the object.
- AVerdadero
- BFalso
18Primitive data type arrays are compatible with Object[]
- AVerdadero
- BFalso
19 Suppose ArrayList x contains two strings [Beijing, Singapore]. Write a line of code to cause it to become [Beijing, Chicago, Singapore].
[blank_start]__________________________________[blank_end]- Ax.add(1,"Chicago");
20The arrayList's .remove() method will work if its only parameter is either an index or an item in the arrayList
- AVerdadero
- BFalso
21The array's .asList(array) method requires the array's contents be objects
- AVerdadero
- BFalso
22The methods in java.util.Collections work on Arrays
- AVerdadero
- BFalso
23Which of these classes cannot be extended?
- Aclass foo { }
- Bclass foo { private foo() { }}
- Cfinal class foo{ }
- Dclass foo { protected foo() { }}
- Eclass foo { public foo() { }}
24This operation returns an exception:
long value = Long.MAX_VALUE + 1;- AVerdadero
- BFalso
25 An instance of _________ describes the errors caused by your program and external circumstances.
- ARuntimeException
- BException
- CError
- DThrowable
26Write an expression that returns the size of the file for a File object f.
[blank_start]_____________________[blank_end]- Af.length()
27Write an expression to test if a File object f represents a directory.
[blank_start]______________[blank_end]- Af.isDirectory()
28Write an expression that tests if a File object f represents a file.
[blank_start]______________________[blank_end]- Af.isFile()
29Enter an expression that returns the path separator character
[blank_start]_______________[blank_end]- AFile.pathSeparatorChar
Información
- Descripción
- Test sobre My Java Study Guide, creado por Row Rowyer el 05/12/2018.
- Autor
- Row Rowyer
- Idioma
- English
- Visitas
- 0
- Etiquetas
- Valoración
- Aún sin valoraciones Valora este test