CPSC 250 Fundamental Java Flashcards
1
Q
<p>1 + 2</p>
A
<p>3</p>
2
Q
<p>1 / 2</p>
A
<p>0</p>
3
Q
<p>1 / 2.0</p>
A
<p>0.5</p>
4
Q
<p>1 + "2"</p>
A
<p>"12" (String)</p>
5
Q
<p>1 + 7 - 9 * 2</p>
A
<p>-10</p>
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>
7
Q
<p>What is % ?</p>
A
<p>Modulus: gives the remainder for division</p>
8
Q
<p>1 + 2</p>
A
<p>3</p>
9
Q
<p>1.0 + 2.0</p>
A
<p>3.0</p>
10
Q
<p>1 / 2</p>
A
<p>0</p>
10
Q
<p>1.0 / 2.0</p>
A
<p>0.5</p>
11
Q
<p>1.0 / 2</p>
A
<p>0.5</p>
12
Q
<p>1 / 2.0</p>
A
<p>0.5</p>
13
Q
<p>"1" + 2</p>
A
<p>"12" (String)</p>
14
Q
<p>1 + "2"</p>
A
<p>"12" (String)</p>