CPSC 250 Fundamental Java Flashcards

1
Q

<p>1 + 2</p>

A

<p>3</p>

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

<p>1 / 2</p>

A

<p>0</p>

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

<p>1 / 2.0</p>

A

<p>0.5</p>

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

<p>1 + &#34;2&#34;</p>

A

<p>&#34;12&#34; (String)</p>

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

<p>1 + 7 - 9 * 2</p>

A

<p>-10</p>

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

<p>What is operator precedence for: () ++ + -- - * / %</p>

A

<p>First:() Second:++ -- (prefix before/postfix after) + - Third: * / % For Ties: First-parsed=First Evaluated</p>

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

<p>What is % ?</p>

A

<p>Modulus: gives the remainder for division</p>

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

<p>1 + 2</p>

A

<p>3</p>

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

<p>1.0 + 2.0</p>

A

<p>3.0</p>

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

<p>1 / 2</p>

A

<p>0</p>

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

<p>1.0 / 2.0</p>

A

<p>0.5</p>

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

<p>1.0 / 2</p>

A

<p>0.5</p>

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

<p>1 / 2.0</p>

A

<p>0.5</p>

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

<p>"1" + 2</p>

A

<p>"12" (String)</p>

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

<p>1 + "2"</p>

A

<p>"12" (String)</p>

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

<p>1 + 2 + &#34;3&#34;</p>

A

<p>&#34;33&#34; (String)</p>

16
Q

<p>7 / 2 + 10 % 4</p>

A

<p>5</p>

17
Q

<p>1 + 7 - 9 * 2</p>

A

<p>-10</p>

18
Q

<p>10 % 3 + 4 * 8</p>

A

<p>33</p>

19
Q

<p>4 - 1 / 2 * -3</p>

A

<p>4</p>

20
Q

<p>4 - 1 / 2 * -3</p>

A

<p>4</p>

21
Q

<p>6 % 7 + 8 - 9</p>

A

<p>5</p>

22
Q

<p>6.5 % 2.5</p>

A

<p>1.5</p>

23
Q

<p>6.5 % 2.5</p>

A

<p>1.5</p>

24
Q

<p>int a = 2; int b = 4; a++ * ++b</p>

A

<p>10</p>