Senin, 20 November 2017

Java Fundamental Section 4

1.  Which of the following is not correct Java code?
double x=Math.pow; (*)

2.  Which of the following statements correctly assigns "3 times 10 to the 4th power" to the variable number?
double number=3e4; (*)

3.  Select the declaration and initialization statement that will hold the letter J.
char letter='J'; (*)

4.  What two values can a boolean variable have?
True and false (*)

5.  What will the method methodA print to the screen?

1.Public ClassA {
2.Int g=5; // global variable
3.Public void methodA() {
4.Int g=6 // local variable
5.System.out.println (g*3);
6.}
7.}
18 (*)


6.  A workspace can not have more than one stored projects. True or false?
False (*)

7.  A perspective is described as:
None of the above

8.  For every opening curly brace { there does not need to be a closing curly brace} for the program to compile without error. True or False?
False (*)

9.  The following defines a class keyword:
Precedes the name of the class. (*)

10.  Which of the two diagrams below illustrate the general form of a Java program?















Example B (*)

11.  The following defines an import keyword:
Provides the compiler information that identifies outside classes used within the current class. (*)

12.  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 (*)

13.  Which of the following creates a String named Char?
String Char; (*)

14.  The String methods equals and compareTo perform similar functions and differ in their return type. True or false?
True (*)

15.  Declaring and instantiating a String is much like any other type of variable. However, once instantiated, they are final and cannot be changed. True or false?
True (*)


1.  Which of the following is not correct Java code?
double x=Math.pow; (*)

2.  Which of the following statements correctly assigns "3 times 10 to the 4th power" to the variable number?
double number=3e4; (*)

3.  Select the declaration and initialization statement that will hold the letter J.
char letter='J'; (*)

4.  What two values can a boolean variable have?
True and false (*)

5.  What will the method methodA print to the screen?

1.Public ClassA {
2.Int g=5; // global variable
3.Public void methodA() {
4.Int g=6 // local variable
5.System.out.println (g*3);
6.}
7.}
18 (*)


1.  A combination of views and editors are referred to as _______________.
A perspective (*)

2.  You can return to the Eclipse Welcome Page by choosing Welcome from what menu?
Help (*)

3.  When converting gallons to liters its best to put the calculation result into a variable with a _______________ data type.
Double(*)

4.  Which of the following is the name of a Java primitive data type?
Int(*)

5.  Which of the following declarations are correct?

(Choose all correct answers)
double duty; (*)
float loan; (*)

6.  Select the declaration and initialization statement that will hold the letter J.
char letter='J'; (*)

7.  Which of the following examples of Java code is not correct?
boolean b=1; (*)

8.  Which of the following statements correctly assigns "3 times 10 to the 4th power" to the variable number?
double number=3e4; (*)


9. The following program prints "Not Equal":











True or false?
 True (*)


10.  Consider the following code snippet

String forest = new String("Black");
System.out.println(forest.length());

What is printed?
5 (*)

11.  Suppose that s1 and s2 are two strings. Which of the statements or expressions are valid?
(Choose all correct answers)

int m = s1.length(); (*)
String s3 = s1 + s2; (*)
s1.compareTo(s2); (*)

12.  The following defines a class keyword:
Precedes the name of the class. (*)

13.  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 (*)

14. Which of the two diagrams below illustrate the general from a
Java program?














Example B (*)

15.  Which of the following defines a driver class?
Contains a main method and other static methods. (*)

Tidak ada komentar:

Posting Komentar