8. Separate methods and logical operators Flashcards

1
Q

What are the values of the following expressions?

1) 3 < 4 && ( 7 > 10 || 19 == 20)
2) 3 < 4 && ( 7 > 10 || 19 != 20)
3) 3 < 4 || ( 7 > 10 && 19 == 20)
4) 3 < 4 || ( 7 > 10 && 19 != 20)
5) 3 < 4 && 7 > 10 || 19 == 20
6) 3 < 4 && 7 > 10 || 19 != 20
7) 3 < 4 || 7 > 10 && 19 == 20
8) 3 < 4 || 7 > 10 && 19 != 20

A

ss

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

Why are methods called methods?

A

ss

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

When should methods have private visibility?

A

ss

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

What two attributes does a method parameter have at compile time? How many parameters can a method have?

A

ss

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

What is the difference between method arguments and method parameters?

A

ss

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

Can a void method have parameters? What (else) can it not have?

A

ss

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

What statement is used to produce the result from a method? How do we know what kind of result can be produced?

A

ss

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

What is the name for the mechanism for passing arguments to methods in Java? What is the significance of the approach?

A

ss

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

How do we print an int value with space padding up to twelve characters?

A

ss

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

How do we get an int value printed with zero padding up to twelve characters?

A

ss

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

What does the following code do?

int y = 100;
for (int x = 0; x < y; x++, y–)
System.out.println(x + y);

A

ss

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

Why is boolean type called boolean?

A

ss

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

Why do text data strings need to be members of a type?

A

ss

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

How do we stop two methods having variables of the same name?

A

ss

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

What other term is used for local variables?

A

ss

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

What are the differences between class variables and local variables?

A

ss

17
Q

What is wrong with the following?

int count = 10, isRaining = false, retirementAge = 65;

A

ss

18
Q

What is wrong with the code like following?

if (be == true)
bv = true;
else
bv = false;

A

xx