Quiz
Primer Set de Preguntas Java OCA Exam (1z0-803)
Questions in this quiz (15)
1Which statement is not true about package statements?
- APackage statements are optional.
- BPackage statements are limited to one per source file.
- CStandard Java coding convention for package names reverses the domain name of the organization or group creating the package.
- DThe package names beginning with javas.* and javaw.* are reserved.
2Which statement represents a valid statement that will allow for the inclusion of classes from the java.util package?
- Aimport java.util;
- Bimport java.util.*;
- C#include java.util;
- D#include java.util.*;
3List four interfaces of the Collections API.
- AArrayList, Map, Set, Queue
- BList, Map, Set, Queue
- CList, Map, HashSet, PriorityQueue
- DList, HashMap, HashSet, PriorityQueue
4Which class in the java.io package allows for the reading and writing of files to specified locations within a file?
- AFile
- BFileDescriptor
- CFilenameFilter
- DRandomAccessFile
5Which MS Windows–based command-line utility will allow you to run the Java interpreter without launching the console window?
- Ajavaw
- Binterpw
- Cjava -wo
- Djconsole
6What is the correct import package needed to use the ArrayList class?
- Aimport java.awt.*;
- Bimport java.io.*;
- Cimport java.net.*;
- Dimport javax.swing.*;
- Eimport java.util.*;
- FThis is a trick question, because it is part of the java.lang package that is imported automatically.
7Of the following packages, which contain classes for building a graphical interface? (Choose all that apply.)
- Ajava.awt
- Bjava.io
- Cjava.net
- Djavax.swing
- Ejava.util
8Which of the following statements is correct?
- AA Java class can extend only one superclass.
- BA Java class can extend multiple superclasses.
- CA Java class cannot extend any superclasses.
- DA Java class does not extend superclasses; it implements them.
9You 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?
- Ayour company name
- Bcom.your company name
- Cjava.your company name
- Djava.your_company_name
- Ecom.your_company_name
10What is the result of running the following command:
javac Simulator.java- AThe simulator program would be executed.
- BA bytecode file Simulator.class would be created.
- CA bytecode file Simulator.java would be created.
- DAn error would be displayed because this is the wrong syntax.
11Of the following, which types of statements must be used to count the number of nickels in a String array of various coins?
- AAssignment
- BAssertion
- CIteration
- DConditional
12The following short code segment contains two errors. What are they?
int a = 1;
does
a = 2;
while (a == 1)- AThe declaration for the variable a must occur within the dowhile statement.
- BBraces must be included for do-while statements even when only one statement is enclosed.
- CThere is no does keyword; only the do keyword is allowed as part of a conditional statement.
- DThe do-while statement must end with a semicolon.
13The continue and break statements are allowed within what types of statements?
- ALoop statements
- BAll conditional statements
- CThe switch statement
- DExpression statements
14Select the commenting style that uses symbols designed to work with Javadoc.
- A// @author Robert
- B/* @author Robert */
- C/** @author Robert */
- D/** @author Robert ;
15Given the following code segments, which answer is NOT a valid Javaimplementation because it won’t compile?
- Aint variableA = 10;
float variableB = 10.5f;
int variableC = variableA + variableB; - Bint variableA = 10;
float variableB = 10.5f;
float variableC = variableA + variableB; - Cbyte variableA = 10;
float variableB = 10.5f;
float variableC = variableA + variableB; - Dbyte variableA = 10;
double variableB = 10.5f;
double variableC = variableA + variableB;
- Aint variableA = 10;
Information
- Description
- Quiz on Primer Set de Preguntas Java OCA Exam (1z0-803), created by webmasterMyJavaZone on 14/06/2014.
- Author
- webmasterMyJavaZone
- Language
- Español
- Views
- 32,424
- Rating
- No ratings yet Rate this quiz