Nothing Special   »   [go: up one dir, main page]

Quiz 4 Java Fundamental

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

QUIZ 4 JAVA FUNDAMENTAL

1.Which
of the Mark for
followi Review
ng (1) Points
define
sa
driver
class?
Contains a main method and other static methods. (*)

Contains classes that define objects.

Contains a main method, a package, static methods, and classes that define objects.

None of the above.

Incorrect. Refer to Section 4 Lesson 2.

2. Which of the two diagrams below illustrate the general form of a Java program?
Mark for
Review
(1) Points
Example A

Example B (*)

Correct

3. The following defines a package keyword:


Mark for
Review
(1) Points
Defines where this class lives relative to other classes, and provides a level of access
control. (*)
Provides the compiler information that identifies outside classes used within the
current class.
Precedes the name of the class.

Correct

4. The following defines an import keyword:


Mark for
Review
(1) Points
Provides the compiler information that identifies outside classes used within the
current class. (*)
Defines where this class lives relative to other classes, and provides a level of access
control.
Precedes the name of the class.

Correct

5. Given the code below, which of the following would equate to true?
Mark for
String s1 = "yes"; Review
String s2 = "yes"; (1) Points
String s3 = new String(s1);
(Choose all correct answers)
s1.equals(s2) (*)

s1 = s2

s1 == s2 (*)

s3.equals(s1) (*)

s3 == s1

Incorrect. Refer to Section 4 Lesson 4.

6The following program prints "Equal". True


.or false?
Mark for
Review
(1)
Points

True (*)

False

Incorrect. Refer to Section 4 Lesson 4.

7. Consider the following code snippet. What is printed?

Mark for
Review
(1)
Points
PoliiPolii (*)

Polii

auaacauaac

auaac

ArrayIndexOutofBoundsException is thrown

Correct

8. Multiple windows are used when more than one file is open
in the edit area. True or False?
Mark for
Review
(1)
Points
True

False (*)

Correct

9. In Eclipse, when you run a Java Application, where may the


results display?
Mark for
Review
(1)
Points
Editor Window

Console View (*)

Debug View

Task List

None of the above

Correct

10. A workspace can not have more than one stored projects.
True or false?
Mark for
Review
(1)
Points
True

False (*)

Correct

6The following program prints "Equal". True or


.false?
Mark for
Review
(1)
Points

True (*)

False

Incorrect. Refer to Section 4 Lesson 4.

7. Consider the following code snippet. What is printed?

Mark for
Review
(1)
Points

PoliiPolii (*)

Polii

auaacauaac

auaac

ArrayIndexOutofBoundsException is thrown

Correct

8. Multiple windows are used when more than one file is open
in the edit area. True or False?
Mark for
Review
(1)
Points
True

False (*)

Correct
9. In Eclipse, when you run a Java Application, where may the
results display?
Mark for
Review
(1)
Points
Editor Window

Console View (*)

Debug View

Task List

None of the above

Correct

10. A workspace can not have more than one stored projects.
True or false?
Mark for
Review
(1)
Points
True

False (*)

Correct
11Given
. the Mark for
followin Review
g (1) Points
declarati
on,
which
line of
Java
code
properly
casts
one type
into
another
without
data
loss?

int
i=3,j=4;
double
y=2.54;
int x=(double)2.54;

double x=(double)(i/j);

double x= double i/j;


double x=i/j;

double x=(double)i/j; (*)

Correct

12. Examine the following code:


Mark for
Review
(1) Points

What is the value of variable x?


2.5

14

2 (*)

Incorrect. Refer to Section 4 Lesson 3.

13. Which of the following is not a legal name for a variable?


Mark for
Review
(1) Points
R2d2

dgo2sleep

4geeks (*)

to_be_or_not_to_be

Correct

14. What two values can a boolean variable have?


Mark for
Review
(1) Points
Arithmetic and logic operators

Relational and logic operators

Numbers and characters

True and false (*)

Integers and floating point types

Correct

15. Which of the following declarations are correct?


Mark for
Review
(1) Points
(Choose all correct answers)
double duty; (*)

boolean value = 12;

float loan; (*)

int start = 34, 3nd = 99;

Correct

You might also like