JavaOOP2015复习题1

更新时间:2023-07-28 06:23:07 阅读: 评论:0

JavaOOP2015复习题1
JavaOOP复习题1
Part I: Multiple Choice Questions:
1.24 % 5 is _____
A. 2
B. 0
C. 4
D. 1
E. 3
Key:c
#
2.If you attempt to add an int, a byte, a long, and a double, the result will be a __________ value.
A. int
B. long
C. byte
D. double
Key:d
#
3.What is the result of 45 / 4?
A. 11
B. 12
C. 10
D. 11.25
Key:a
#
4.In Java, the word true is ________.
A. a Boolean literal
B. a Java keyword
C. same as value 0
D. same as value 1
Key:a
#
5.The following code displays ___________.
double temperature = 50;
if (temperature >= 100)
System.out.println("too hot");
el if (temperature <= 40)
System.out.println("too cold");
el
System.out.println("just right");
A. too hot
B. too cold
C. too hot too cold just right
D. just right
Key:d
#
6.The "less than or equal to" comparison operator in Java is __________.
A. <<
B. =<
C. !=
D. <=
E. <
Key:d
#
噬神之书
7.Analyze the following code fragments that assign a boolean value to the variable even.
Code 1:
if (number % 2 == 0)
even = true;英语拼读规则
el
even = fal;
Code 2:
even = (number % 2 == 0) ? true: fal;
Code 3:
even = number % 2 == 0;
A. Code 3 has a syntax error, becau you attempt to assign number to even.
B. Code 2 has a syntax error, becau you cannot have true and fal literals in the conditional expression.
C. All three are correct, but Code 1 is preferred.
D. All three are correct, but Code 2 is preferred.
E. All three are correct, but Code 3 is preferred.
Key:e
#
8.How many times will the following code print "Welcome to Java"? int count = 0;
带有日字旁的字
do {
System.out.println("Welcome to Java");
} while (count++ < 10);
A. 10
B. 8
C. 0
D. 9
乒乓球用英语怎么说E. 11
Key:e
#
9.What is the value in count after the following loop is executed?恐龙主题乐园
int count = 0;
do {
System.out.println("Welcome to Java");
} while (count++ < 9);
System.out.println(count);
A. 11
B. 0
C. 9
D. 8
E. 10
Key:e
#
10.What is the number of iterations in the following loop:
for (int i = 1; i <= n; i++) {
// iteration
}
A. 2*n
B. n
C. n - 1
D. n + 1
Key:b
#
开业啦图片11.What is the output for y?
int y = 0;
for (int i = 0; i<10; ++i) {
y += i;
}
System.out.println(y);
A. 45
B. 12
C. 13
D. 10
E. 11
Key:a
#
12.What is i after the following for loop?
int y = 0;
for (int i = 0; i<10; ++i) {
y += i;
}
A. 9
B. 10
C. undefined
D. 11
Key:c
#
13.__________ is to implement one method in the structure chart at a time from the top to the bottom.
A. Stepwi refinement
B. Top-down approach
C. Bottom-up and top-down approach
D. Bottom-up approach
Key:b
#
14.Analyze the following code.
public class Test {
public static void main(String[] args) {
工作态度评价System.out.println(max(1, 2));

本文发布于:2023-07-28 06:23:07,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/89/1099622.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:评价   梦想   规则   带有
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图