Pregunta 1
Pregunta
Which statement is not true about package statements?
Respuesta
-
Package statements are optional.
-
Package statements are limited to one per source file.
-
Standard Java coding convention for package names reverses the domain name of the organization or group creating the package.
-
The package names beginning with javas.* and javaw.* are reserved.
Pregunta 2
Pregunta
Which statement represents a valid statement that will allow for the inclusion of classes from the java.util package?
Respuesta
-
import java.util;
-
import java.util.*;
-
#include java.util;
-
#include java.util.*;
Pregunta 3
Pregunta
List four interfaces of the Collections API.
Respuesta
-
ArrayList, Map, Set, Queue
-
List, Map, Set, Queue
-
List, Map, HashSet, PriorityQueue
-
List, HashMap, HashSet, PriorityQueue
Pregunta 4
Pregunta
Which class in the java.io package allows for the reading and writing of files to specified locations within a file?
Respuesta
-
File
-
FileDescriptor
-
FilenameFilter
-
RandomAccessFile
Pregunta 5
Pregunta
Which MS Windows–based command-line utility will allow you to run the Java interpreter without launching the console window?
Respuesta
-
javaw
-
interpw
-
java -wo
-
jconsole
Pregunta 6
Pregunta
What is the correct import package needed to use the ArrayList class?
Pregunta 7
Pregunta
Of the following packages, which contain classes for building a graphical interface? (Choose all that apply.)
Respuesta
-
java.awt
-
java.io
-
java.net
-
javax.swing
-
java.util
Pregunta 8
Pregunta
Which of the following statements is correct?
Respuesta
-
A Java class can extend only one superclass.
-
A Java class can extend multiple superclasses.
-
A Java class cannot extend any superclasses.
-
A Java class does not extend superclasses; it implements them.
Pregunta 9
Pregunta
You have created a set of classes for your company and would like to include them in a package. Which one of the following would be a valid package name?
Respuesta
-
your company name
-
com.your company name
-
java.your company name
-
java.your_company_name
-
com.your_company_name
Pregunta 10
Pregunta
What is the result of running the following command:
javac Simulator.java
Respuesta
-
The simulator program would be executed.
-
A bytecode file Simulator.class would be created.
-
A bytecode file Simulator.java would be created.
-
An error would be displayed because this is the wrong syntax.
Pregunta 11
Pregunta
Of the following, which types of statements must be used to count the number of nickels in a String array of various coins?
Respuesta
-
Assignment
-
Assertion
-
Iteration
-
Conditional
Pregunta 12
Pregunta
The following short code segment contains two errors. What are they?
int a = 1;
does
a = 2;
while (a == 1)
Respuesta
-
The declaration for the variable a must occur within the dowhile statement.
-
Braces must be included for do-while statements even when only one statement is enclosed.
-
There is no does keyword; only the do keyword is allowed as part of a conditional statement.
-
The do-while statement must end with a semicolon.
Pregunta 13
Pregunta
The continue and break statements are allowed within what types of statements?
Pregunta 14
Pregunta
Select the commenting style that uses symbols designed to work with Javadoc.
Respuesta
-
// @author Robert
-
/* @author Robert */
-
/** @author Robert */
-
/** @author Robert ;
Pregunta 15
Pregunta
Given the following code segments, which answer is NOT a valid Javaimplementation because it won’t compile?
Respuesta
-
int variableA = 10;
float variableB = 10.5f;
int variableC = variableA + variableB;
-
int variableA = 10;
float variableB = 10.5f;
float variableC = variableA + variableB;
-
byte variableA = 10;
float variableB = 10.5f;
float variableC = variableA + variableB;
-
byte variableA = 10;
double variableB = 10.5f;
double variableC = variableA + variableB;