AP计算机教程2-10:简单多选题
0:00
What does the following code print?
System.out.println(2 % 3);
对于整数除法,当被除数比除数小时,商是0,余数等于被除数。
1
What does the following code print?
System.out.println(19 % 5);
商是3,余数是19与15的差即4。
3
What does the following code print?
System.out.println(1 / 3);
此处为整数除法,当被除数比除数小时,商是0。
2
What does the following code print?
System.out.println(2 + 3 * 5 - 1);
先乘除,后加减。
4
Given the following code segment, what is the value of b
when it finishes executing?
double a = 9.6982; int b = 12; b = (int) a;
Java中将整数转换为浮点数时,小数点后的数字将被直接舍去,并非四舍五入。
4
Which of the following is the decimal value for the binary number 1001011?
\(2^6+2^3+2+1=64+8+2+1=75\)
1
How many bits would you need to represent 25 distinct values?
\(2^5=32>25>2^4=16\)
1
What is the hexadecimal equivalent of the following binary number: 110100?
二进制的四位对应十六进制的一位。0011对应3,0100对应4。
1
What is the binary equivalent of the following base 10 number: 187?
\(187=128+32+16+8+2+1=2^7+2^5+2^4+2^3+2^1+2^0\)
3
0 条评论