You are on page 1of 20

KVIZ BROJ 01

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 4 Quiz

(Answer all questions in this section)

1. Suppose that str1 and str2 are two strings. Which of the statements or expressions are valid?
Mark for Review

(1) Points

String str3 = str1 - str2;

str1 += str2; (*)

Str1 -= str2;

str1 >= str2

[Correct] Correct

2. The following program prints "Equal". True or false?

Mark for Review

(1) Points

True (*)
False

[Correct] Correct

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

String str = String( "Hello" );

True or false? Mark for Review

(1) Points

True

False (*)

[Correct] Correct

4. Two variables are required to support a conversion of one unit of measure to another unit of
measure. True or False? Mark for Review

(1) Points

True (*)
False

[Correct] Correct

5. A _______________ is used to organize Java related files. Mark for Review

(1) Points

Collection

Project

Package (*)

Workspace

[Correct] Correct

Page 1 of 3

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 4 Quiz

(Answer all questions in this section)


6. What symbols are required for a compiler to ignore a comment? Mark for Review

(1) Points

/*/

*/

/*

// (*)

[Correct] Correct

7. Match each of the following literals ('x', 10, 10.2, 100L, "hello") with its respective data type.
Mark for Review

(1) Points

boolean, byte, int, long, Short

char, double, int, long, String

char, int, long, float, String


char, boolean, float, long, String

char, int, double, long, String (*)

[Correct] Correct

8. Which of the following is a legal identifier? Mark for Review

(1) Points

apple (*)

7up

boolean

grand Total

[Incorrect] Incorrect. Refer to Section 4 Lesson 3.

9. What are Java's primitive types? Mark for Review

(1) Points
boolean, thread, char, double, float, int, long and short

object, byte, string, char, float, int, long and short

boolean, byte, char, double, float, int, long, and short (*)

boolean, thread, stringbuffer, char, int, float, long and short

boolean, byte, string, thread, int, double, long and short

[Correct] Correct

10. Which line of Java code assigns the value of 5 raised to the power of 8 to a? Mark for
Review

(1) Points

int a=Math.pow(5,8);

int a=Math.pow(8,5);

double a=15^8;

double a=Math.pow(5,8); (*)


double a=pow(8,5);

[Correct] Correct

Page 2 of 3

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 4 Quiz

(Answer all questions in this section)

11. Which of the following is the name of a Java primitive data type? Mark for Review

(1) Points

int (*)

String

Object

Rectangle

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

Precedes the name of the class.

Provides the compiler information that identifies outside classes used within the current class.

[Correct] Correct

13. The following defines an import keyword: Mark for Review

(1) Points

Defines where this class lives relative to other classes, and provides a level of access control.

Precedes the name of the class.

Provides the compiler information that identifies outside classes used within the current class. (*)

[Correct] Correct
14. The following defines a class keyword: Mark for Review

(1) Points

Provides the compiler information that identifies outside classes used within the current class.

Precedes the name of the class. (*)

Defines where this class lives relative to other classes, and provides a level of access control.

[Correct] Correct

15. The following defines a class keyword: Mark for Review

(1) Points

Defines where this class lives relative to other classes, and provides a level of access control.

Precedes the name of the class. (*)

Provides the compiler information that identifies outside classes used within the current class.

[Correct] Correct
Page 3 of 3

KVIZ BROJ 02

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 4 Quiz

(Answer all questions in this section)

1. A _______________ is used to organize Java related files. Mark for Review

(1) Points

Workspace

Project

Collection

Package (*)

[Correct] Correct

2. What symbols are required for a compiler to ignore a comment? Mark for Review

(1) Points

*/
/*

/*/

// (*)

[Correct] Correct

3. Eclipse provides an edit area to help you navigate a hierarchy of information. True or False?
Mark for Review

(1) Points

True

False (*)

[Correct] 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] Correct

5. The following defines a class keyword: Mark for Review

(1) Points

Defines where this class lives relative to other classes, and provides a level of access control.

Precedes the name of the class. (*)

Provides the compiler information that identifies outside classes used within the current class.

[Correct] Correct

Page 1 of 3

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 4 Quiz

(Answer all questions in this section)


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

Mark for Review

(1) Points

Example A

Example B (*)

[Correct] Correct

7. 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? Mark for Review

(1) Points

True

False (*)

[Correct] Correct

8. 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? Mark for Review
(1) Points

True (*)

False

[Correct] Correct

9. The following program prints "Not Equal":

True or false? Mark for Review

(1) Points

True (*)

False

[Incorrect] Incorrect. Refer to Section 4 Lesson 4.

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


Mark for Review

(1) Points

The code does not compile.

AtlanticPacificIndianArcticSouthern

An ArrayIndexOutofBoundsException is thrown. (*)

55555

87658

[Incorrect] Incorrect. Refer to Section 4 Lesson 4.

Page 2 of 3

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 4 Quiz

(Answer all questions in this section)


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

Example A

Example B (*)

Correct

7. When importing another package into a class you must import the entire package as well
Mark for
as the package classes that will be called. True or False?
Review
(1) Points

True
False (*)

Correct

8. Declaring and instantiating a String is much like any other type of variable. However, once
Mark for
instantiated, they are final and cannot be changed. True or false?
Review
(1) Points

True (*)

False

Correct

9. The following program prints "Not Equal":


Mark for
Review
(1) Points

True or false?

True (*)

False

Incorrect. Refer to Section 4 Lesson 4.

10 Consider the following code snippet. What is printed?


Mark for
.
Review
(1) Points

The code does not compile.


AtlanticPacificIndianArcticSouthern

An ArrayIndexOutofBoundsException is thrown. (*)

55555

87658

Incorrect. Refer to Section 4 Lesson 4.

Page 2 of 3

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 4 Quiz

(Answer all questions in this section)

11.Which line of Java code assigns the value of 5 raised to the power of 8 to a?
Mark for Review
(1) Points

double a=15^8;

double a=pow(8,5);

double a=Math.pow(5,8); (*)

int a=Math.pow(5,8);

int a=Math.pow(8,5);

Correct

12.Which of the following is the name of a Java primitive data type?


Mark for Review
(1) Points

Object

Rectangle
int (*)

String

Correct

13.Which of the following declarations are correct?


Mark for Review
(1) Points

(Choose all correct answers)

boolean value = 12;

double duty; (*)

float loan; (*)

int start = 34, 3nd = 99;

Incorrect. Refer to Section 4 Lesson 3.

14.What two values can a boolean variable have?


Mark for Review
(1) Points

Relational and logic operators

Arithmetic and logic operators

Numbers and characters

True and false (*)

Integers and floating point types

Correct

15.Which line of Java code properly calculates the area of a triangle using A=1/2(b)(h)
Mark for Review
where b and h are Java primitive integers?
(1) Points
double A=(double)1/(double)2*b*h; (*)

double A=(double)(1/2)*b*h;

double A=1/2bh;

double A=1/2*b*h;

Correct

Page 3 of 3

You might also like