Ch 6 & 7 Quiz 4 Flashcards

1
Q

Study #2

A

2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

T/F: the interface of a class describes what a class does and how it can be used by showing the implementation

A

F: the interface of a class describes what a class does and how it can be used without showing the implementation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The word interface in Java can be used as___

A

Class interface
Graphical User Interface
Method interface
Language construct

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Study #6

A

Study #6

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Question 7

A

Q 7

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

T/F: an object is said to be immutable if it’s contents or state cannot be changed once it has been created. Strings are an example of immutable objects.

A

T

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Will this code compile and if not what line would cause the error?

String userAnswer = reader.getInput().trim().toLowerCase();
String rightAnswer = “java is democratic” + 3;
int calcResult = 5 + 1;
int rightResult = 5;

if (calcResult == rightResult && userAnswer == rightAnswer)
{
System.out.println(“Maybe you are right”)
}

A

Code will compile because the syntax is correct

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Auto-boxing

A

Where the compiler take the decision to convert a primitive value (ex: int) into an object of its wrapper class (ex: Integer)

Study #12

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Auto-unboxing

A

Where the compiler take a decision to covert an object of a wrapper class (ex: Integer) into its primitive value (ex: int)

Study #12

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

javadoc comment

A

The comment start symbol must have 2 asterisks.

/**
This is a javadoc comment
*/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Study 15

A

Study 15

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

T/F: The following code will compile correctly:

public class MyVote
{
private static int voteResult = 0;
private int voteID = 0;
private static final int voteTruth = voteResult + voteID;
}

A

F: static variable can’t refer to non-static variable. voteTruth (static variable) is referring to voteID (non-static)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

17

A

17

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Study #20

A

20

How well did you know this?
1
Not at all
2
3
4
5
Perfectly