Você está na página 1de 2

1.

When importing another package into a class you must import only the package
classes that will be called and not the entire package. True or false? False (*)
2. Which of the following defines a driver class? Contains a main method and other
static methods. (*)
3. The following defines a class keyword: Precedes the name of the class. (*)
4. When importing another package into a class you must import the entire
package as well as the package classes that will be called. True or False? False
(*)
5. Eclipse does not provide views to help you navigate a hierarchy of information.
True or False? False (*)
6. In a project, 1 of the classes must contain a main method. True or False? True (*)
7. The ______________ is the location into which you will store and save your files.
Workspace (*)
8. Given the code
String s1 = "abcdef";
String s2 = "abcdef";
String s3 = new String(s1);
Which of the following would equate to false? s3 == s1 (*)
9. The following program prints "Equal". True or false?

True (*)
10.Consider the following code snippet. What is printed?

87668 (*)
11.Consider the following:
You are writing a class and are using a global variable. Inside a method you
declare a local variable with the same name as the global variable.
This programming style is poor because inside the method the global variable
will have precedence over the local variable with the same name.
True or false? False (*)
12.What does the following program output?

total cost: 40 (*)


13.What two values can a boolean variable have? True and false (*)
14.Which of the following is the name of a Java primitive data type? double (*)
15.What is the output of the following lines of code?
int j=7,k=5,m=8,result;
result=j-k%3*m;
System.out.println(result);
-9 (*)
16.The following program prints "Equal". True or false?

False (*)

17.The following code is an example of instantiating a String object:


String str = String( "Hello" );
True or false? False (*)
18.What will the following code segment output?

""\<br> " (*)


19.For every opening curly brace { there must be a closing curly brace} or the
program will not compile without error. True or False? True (*)
20.A workspace can not have more than one stored projects. True or false? False (*)
21.Which of the following is not correct Java code? double x=Math.pow; (*)
22.Which of the following is not a legal name for a variable? 4geeks (*)
23.What are Java's primitive types? boolean, byte, char, double, float, int, long, and
short (*)
24.Which of the following statements correctly assigns "3 times 10 to the 4th
power" to the variable number? double number=3e4; (*)
25.The following defines a package keyword: Defines where this class lives relative
to other classes, and provides a level of access control. (*)
26.The following defines an import keyword: Provides the compiler information that
identifies outside classes used within the current class. (*)
27.Which line of code does not assign 3.5 to the variable x? 3.5=x; (*)
28.Which line of Java code assigns the value of 5 raised to the power of 8 to a?
double a=Math.pow(5,8); (*)
29.What is the output of the following lines of code?
int j=7,k=5,m=8,result;
result=j/m*k;
System.out.println(result); 0 (*)
30.Consider the following code snippet.

What is printed? 1 (*)


31.Which of the following instantiates a String named name to Oracle? String
name="Oracle"; (*)
32.You can return to the Eclipse Welcome Page by choosing Welcome from what
menu? Help (*)
33.Semi-colons at the end of each line are not required to compile successfully. True
or False? False (*)
34.A perspective is described as: A combination of views and editors (*)
35.Which line of Java code will assign the value of the square root of 11 to a
variable named a? double a=Math.sqrt(11); (*)
36.Which of the following is not a legal name for a variable? 2bad (*)
37.A _______________ is used to organize Java related files. Package (*)
38.Tabs are used when more than one file is open in the edit area. True or False?
True (*)
39.Given the code:
String s = new String("abc");
Which of the following statements will change the length of s to the largest
length? None of the above will change the length of s. (*)
40.The == operator tests if two String references are pointing to the same String
object. True or false? True (*)
41. When importing another package into a class you must import the entire package as well as the
package classes that will be called. True or False? False (*)

42. The following code is an example of a correct initialization statement:


43.

char c="c";False (*)

Você também pode gostar