JAVA练习题含答案-answertopratice3

更新时间:2023-05-17 11:54:02 阅读: 评论:0

JAVA练习题含答案-answertopratice3
初一历史手抄报
Chapter 3
Flow of Control
Multiple Choice
1)An if lection statement executes if and only if:
(a)the Boolean condition evaluates to fal.
(b)the Boolean condition evaluates to true.
(c)the Boolean condition is short-circuited.
(d)none of the above.
Answer:B (e page 97)
2) A compound statement is enclod between:
(a)[ ]
(b){ }
(c)( )
(d)< >
Answer:B (e page 98)
3) A multi-way if-el statement
(a)allows you to choo one cour of action.
(b)always executes the el statement.
(c)allows you to choo among alternative cours of action.
(d)executes all Boolean conditions that evaluate to true.
Answer:C (e page 100)
4)The controlling expression for a switch statement includes all of the following types except:
(a)char
(b)int
(c)byte
(d)double
Answer:D (e page 104)鱿鱼汤的做法
Copyright ? 2006 Pearson Education Addison-Wesley. All rights rerved. 1
2
5)To compare two strings lexicographically the String method ____________ should be ud.
(a)equals
(b)equalsIgnoreCa
(c)compareTo
(d)==
Answer:C (e page 112)
6)When using a compound Boolean expression joined by an && (AND) in an if statement:
(a)Both expressions must evaluate to true for the statement to execute.
(b)The first expression must evaluate to true and the cond expression must evaluate to fal for
the statement to execute.
(c)The first expression must evaluate to fal and the cond expression must evaluate t
业务流程梳理
o true for
the statement to execute.
(d)Both expressions must evaluate to fal for the statement to execute.
Answer:A (e page 116)
7)The OR operator in Java is reprented by:
(a)!
(b)&&
(c)| |
(d)None of the above
Answer:C (e page 116)
8)The negation operator in Java is reprented by:
(a)!
(b)&&
(c)| |
(d)None of the above
Answer:A (e page 116)
9)The ____________ operator has the highest precedence.
(a)*
(b)dot
(c)+=
(d)decrement
Answer:B (e page 123)
10)The looping mechanism that always executes at least once is the _____________ statement.
(a)if…el
(b)do…while
防火小报(c)while
抱犊崮(d)for
Answer:B (e page 132)
.
Chapter 3 Flow of Control 3
11) A mixture of programming language and human language is known as:
(a)Algorithms
连续打嗝(b)Recipes
(c)Directions
(d)Pudocode
Answer:D (e page 134)女包品牌排行榜
12)When the number of repetitions are known in advance, you should u a ___________ statement.
(a)while
(b)do…while
(c)for
(d)None of the above
Answer:C (e page 141)
13)To terminate a program, u the Java statement:
(a)System.quit(0);
(d(0);
(c)System.abort(0);
(it(0);
Answer:D (e page 148)
True/Fal
1)An if-el statement choos between two alternative statements bad on the value of a Boolean
expression.
Answer:True (e page 96)
2)You may omit the el part of an if-el statement if no alternative action is required.
Answer:True (e page 97)
3)In a switch statement, the choice of which branch to execute is determined by an expression given in
parenthes after the keyword switch.
Answer:True (e page 104)
4)In a switch statement, the default ca is always executed.
Answer:Fal (e page 104)
5)Not including the break statements within a switch statement results in a syntax error.
Answer:Fal (e page 104)
6)The equality operator (==) may be ud to test if two string objects contain the same va
lue.
Answer:Fal (e page 111)宝可梦怎么画
4
7)Boolean expressions are ud to control branch and loop statements.
Answer:True (e page 116)
8)The for statement, do…while statement and while statement are examples of branching mechanisms.

本文发布于:2023-05-17 11:54:02,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/667300.html

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

标签:排行榜   练习题   手抄报   鱿鱼   梳理   防火   女包
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图