Quiz
Chapter 1: Quiz
Crie uma conta grátis para terminar este quiz
Salve seu progresso e veja sua nota final.
Já tem uma conta? Inicie sessão
Perguntas do quiz (25)
1 In the following code, identify which line is redundant.
1. import java.lang.String;
2. import java.lang.*;
3. public class Foo {
4. String name;
5. }- A4
- B1
- C2
- D3
2Which of the following import statements imports an entire group of classes contained in the java.lang package?
- Aimport *.java.lang
- Bimport *.java.lang;
- Cimport java.lang.*
- Dimport java.lang.*;
3Which path does the Java runtime environment use for searching?
- AClass path
- BFile Path
- CEnvironment path
- DSearch path
4Which of the following will create a package named My?
- Apackage My[];
- Bpackage My;
- Cpack My();
- Dpackage My package;
5Consider the given string:
Mack John Lisa Maria
What is the output of the following Java statement?
System.out.println(args[2]);- ALisa
- BMaria
- CMack
- DJohn
6For any non-null reference values a and b, which of the following values will be returned by the expression a.equals(b) if b.equals(a) returns true?
- Atrue
- Bfalse
- Cnull
- D0
7In the following code, you need to import the two classes FileInputStream and FileOutputStream.
public class CopyFile {
String name;
}
What is the best way to import these files?- Aimport java.FileInput Stream;
import java.FileOutput Stream; - Bimport java.nio.*;
- Cimport java.*.*;
- Dimport java.io.FileInputStream.*;
import java.io.FileOutputStream.*;
- Aimport java.FileInput Stream;
8Which two keywords are used for decimal-point value?
- Ashort and long
- Bfloat and double
- Cfloat and long
- Dlong and double
9What is the default initialization value of long variable type?
- Afalse
- B0
- C0.0
- Dnull
10Which of the following represents the correct sequence of these three in a Java application?
1. package declaration
2. class definition
3. import statement- A1, 2, 3
- B3, 2, 1
- C1, 3, 2
- D2, 3, 1
11Which of the following is a reserved word in Java?
- Aarray
- Bloop
- Cnull
- Dnum
12Which of the following packages does not need explicit import statements if any Java source code uses classes contained within them?
- Ajava.lang
- Bjava.io
- Cjava.util
- Djava.net
13Which of the following separates package names from subpackages and classes?
- A,
- B.
- C;
- D:
14What are the two primary elements of Java classes?
- AFields and datatypes
- BModels and datatypes
- CFields and methods
- DMethods and datatypes
15Which package is automatically imported by Java?
- Ajava.util
- Bjava.nio
- Cjava.io
- Djava.lang
16What do you call a mechanism for organizing a set of related classes and interfaces?
- AJava applet
- BJava package
- CJava API
- DJavaBeans
17Which of the following is the correct example of the Java identifier?
- Adollar
- Bdollar 4
- C-dollar
- D4dollar!
18Which of the following is the reason for having unique package names in Java?
- ATo avoid naming conflicts between different development groups using the same package
- BTo allow classes of one package to access classes of another package
- CTo allow a user to know the exact IP address from where to download required classes
- DTo declare the specific ownership of classes
19Which of the following characters tells the Java compiler to import an entire package?
- A.
- B@
- C*
- D;
20What do you understand by JVM?
- AA set of programming tools for developing Java applications
- BA virtual machine that runs Java bytecodes
- CA program that turns Java bytecode into instructions
- DA program development environment for writing Java applets
21Which statement is not supported by Java?
- Awhile
- Bswitch
- Cgoto
- Dfor
22Which keyword of Java doesn't return any value?
- Aint
- Bvoid
- Cpublic
- Dprivate
23Identify the parameter in the given example.
public void setName(String newName)- AString
- Bvoid
- CsetName
- DnewName
24What will happen if the same modifier appears more than once in a class, method, or variable declaration?
- AAn exception will be thrown during runtime.
- BThe Java compiler is intelligent enough to ignore such mistakes.
- CThe code will compile without an error.
- DA compile-time error will occur.
25Which of the following methods run when an object is eligible for garbage collection?
- Adispose()
- Bmain()
- CSystem.gc()
- Dfinalized()
Informações
- Descrição
- Java I Quiz sobre Chapter 1: Quiz, criado por Ed Woo em 26-07-2016.
- Autor
- Ed Woo
- Idioma
- English
- Visualizações
- 0
- Histórico
- Criado em 26 jul 2016 · atualizado em 23 nov 2016
- Etiquetas
- Avaliação
- Ainda sem avaliações Avalie este quiz