Deck 4: Introduction to Control Statements

ملء الشاشة (f)
exit full mode
سؤال
Some programmers prefer to use for loops instead of while loops because the loop control variable can be declared in its header. ____________________
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Use an if statement to instruct a program to execute one statement if the condition is true, and another if the condition is false.
سؤال
Because it returns a value of true or false, the condition in an if statement must be a(n) ____ expression.

A) Boolean
B) control
C) else
D) entry-controlled
سؤال
An off-by-one error occurs when the value returned is one more or less than the expected result.
سؤال
When a program responds more slowly than expected, it is reasonable to assume that it is stuck in an overloading loop. ____________________
سؤال
____ must always occur in pairs.

A) Semicolons
B) Conditions
C) Statements
D) Braces
سؤال
A program that controls how many times a loop is executed is called a task-controlled loop. ____________________
سؤال
m++ and m = m + 1 are the same thing.
سؤال
____ is when the same name is used for two different methods.

A) Infinite loop
B) Overloading
C) Iteration
D) Sentinel
سؤال
In a while statement, if the condition is false from the outset, the statement(s) inside the loop never execute.
سؤال
A program can output data to a file.
سؤال
In a for statement, the counter is updated at the top of the loop.
سؤال
It is better to underuse braces or parentheses than to overuse them.
سؤال
FIGURE 4-1 FIGURE 4-1   Figure 4-1 above is an example of a flowchart. _________________________<div style=padding-top: 35px>
Figure 4-1 above is an example of a flowchart. _________________________
سؤال
A program used to simulate coin toss results uses a random number generator.
سؤال
For a loop to terminate, each pass must move the variables in the condition significantly closer to satisfying the condition.
سؤال
In Java, while and if-else are examples of conditional statements. ____________________
سؤال
An if-else statement is commonly used to check user inputs for validity before processing them.
سؤال
The decrement operator is ____.

A) --
B) ++
C) /
D) !=
سؤال
If a method's signature is labeled ____, the message is sent to the method's class instead of to an object.

A) class
B) iterative
C) static
D) count-controlled
سؤال
In a text file, numeric data can be separated by any of the following EXCEPT ____.

A) return
B) space
C) tab
D) newline
سؤال
Data can be output to a text file using the class ____.

A) Scanner
B) WriteData
C) PrintWriter
D) TextFile
سؤال
Carter thinks his program is stuck in an infinite loop. What should he do to his PC to make it stop?

A) Unplug the computer.
B) Press Ctrl+C.
C) Press Ctrl+Alt+Delete.
D) Restart the computer.
سؤال
Gabrielle is using a text file to input the list of numbers. Which of the following is NOT true?

A) If the file is missing, the JVM will thrown an I/O exception.
B) The numbers must be separated by whitespace characters.
C) Gabrielle uses the PrintWriter class to read the data in the text file.
D) The text file must contain a special character that marks the end of the file.
سؤال
An I/O exception is in the category of ____ exceptions.

A) thrown
B) checked
C) run-time
D) overloading
سؤال
The ____________________ operator decreases a variable's value by one.
سؤال
A(n) ____ is a special value that marks the end of a list.

A) break
B) sentinel
C) counter
D) iteration
سؤال
In a(n) ____-controlled loop, the continuation condition is tested at the top of the loop on each pass.

A) task
B) entry
C) count
D) All of the above
سؤال
A(n) ____ is a small window that asks for information, and includes a text field and command buttons.

A) panel
B) message dialog box
C) task pane
D) input dialog box
سؤال
The ____ statement is used to write count-controlled loops.

A) for
B) number
C) cntr
D) if-else
سؤال
The____ operator means not equal to.

A) --
B) = =
C) <=
D) !=
سؤال
The presence or absence of the ____ symbol(s) can seriously affect the logic of a selection statement.

A) { }
B) //
C) ;
D) /* */
سؤال
Which of the following is true about using a text file for input?

A) The data set can be much larger.
B) Data can be input faster and with less chance of error.
C) Data can be used repeatedly with the same program or with different programs.
D) All of the above are true.
سؤال
Use a(n) ____ statement rather than two if statements when the alternative courses of action are mutually exclusive.

A) while
B) for
C) if-else
D) whether
سؤال
A loop that continues until something specific is accomplished is called a(n) ____-controlled loop.

A) count
B) entry
C) task
D) outcome
سؤال
FIGURE 4-2 <strong>FIGURE 4-2   Figure 4-2 above represents the behavior of a(n) ____ statement.</strong> A) if-else B) while C) random D) infinite <div style=padding-top: 35px>
Figure 4-2 above represents the behavior of a(n) ____ statement.

A) if-else
B) while
C) random
D) infinite
سؤال
To get out of a loop prematurely, use a(n) ____ statement.

A) exit
B) false
C) break
D) then
سؤال
A typical loop has four component parts, including all of the following EXCEPT ___ statements.

A) initializing
B) body
C) update
D) verification
سؤال
Each pass through a loop is called a(n) ____________________.
سؤال
The ____________________ operator increases a variable's value by one.
سؤال
Identify the letter of the choice that best matches the phrase or definition.
a.Random
b.Update
c.Abs
d.Exception
e.Break
What happens when a program encounters an operation that it cannot perform at runtime.
سؤال
____________________ statements execute within each pass and implement the calculation in question.
سؤال
Identify the letter of the choice that best matches the phrase or definition.
a.Random
b.Update
c.Abs
d.Exception
e.Break
A statement that changes the values of the variables tested in the termination condition.
سؤال
Identify the letter of the choice that best matches the phrase or definition.
a.Random
b.Update
c.Abs
d.Exception
e.Break
Exits a loop before the condition is false.
سؤال
Identify the letter of the choice that best matches the phrase or definition.
a.Random
b.Update
c.Abs
d.Exception
e.Break
A method in the Math class.
سؤال
A(n) ____________________ control statement is located inside another control statement.
سؤال
Identify the letter of the choice that best matches the phrase or definition.
a.Random
b.Update
c.Abs
d.Exception
e.Break
A class used to simulate stock market fluctuations.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/47
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 4: Introduction to Control Statements
1
Some programmers prefer to use for loops instead of while loops because the loop control variable can be declared in its header. ____________________
True
2
Use an if statement to instruct a program to execute one statement if the condition is true, and another if the condition is false.
False
3
Because it returns a value of true or false, the condition in an if statement must be a(n) ____ expression.

A) Boolean
B) control
C) else
D) entry-controlled
A
4
An off-by-one error occurs when the value returned is one more or less than the expected result.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
5
When a program responds more slowly than expected, it is reasonable to assume that it is stuck in an overloading loop. ____________________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
6
____ must always occur in pairs.

A) Semicolons
B) Conditions
C) Statements
D) Braces
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
7
A program that controls how many times a loop is executed is called a task-controlled loop. ____________________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
8
m++ and m = m + 1 are the same thing.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
9
____ is when the same name is used for two different methods.

A) Infinite loop
B) Overloading
C) Iteration
D) Sentinel
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
10
In a while statement, if the condition is false from the outset, the statement(s) inside the loop never execute.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
11
A program can output data to a file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
12
In a for statement, the counter is updated at the top of the loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
13
It is better to underuse braces or parentheses than to overuse them.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
14
FIGURE 4-1 FIGURE 4-1   Figure 4-1 above is an example of a flowchart. _________________________
Figure 4-1 above is an example of a flowchart. _________________________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
15
A program used to simulate coin toss results uses a random number generator.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
16
For a loop to terminate, each pass must move the variables in the condition significantly closer to satisfying the condition.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
17
In Java, while and if-else are examples of conditional statements. ____________________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
18
An if-else statement is commonly used to check user inputs for validity before processing them.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
19
The decrement operator is ____.

A) --
B) ++
C) /
D) !=
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
20
If a method's signature is labeled ____, the message is sent to the method's class instead of to an object.

A) class
B) iterative
C) static
D) count-controlled
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
21
In a text file, numeric data can be separated by any of the following EXCEPT ____.

A) return
B) space
C) tab
D) newline
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
22
Data can be output to a text file using the class ____.

A) Scanner
B) WriteData
C) PrintWriter
D) TextFile
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
23
Carter thinks his program is stuck in an infinite loop. What should he do to his PC to make it stop?

A) Unplug the computer.
B) Press Ctrl+C.
C) Press Ctrl+Alt+Delete.
D) Restart the computer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
24
Gabrielle is using a text file to input the list of numbers. Which of the following is NOT true?

A) If the file is missing, the JVM will thrown an I/O exception.
B) The numbers must be separated by whitespace characters.
C) Gabrielle uses the PrintWriter class to read the data in the text file.
D) The text file must contain a special character that marks the end of the file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
25
An I/O exception is in the category of ____ exceptions.

A) thrown
B) checked
C) run-time
D) overloading
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
26
The ____________________ operator decreases a variable's value by one.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
27
A(n) ____ is a special value that marks the end of a list.

A) break
B) sentinel
C) counter
D) iteration
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
28
In a(n) ____-controlled loop, the continuation condition is tested at the top of the loop on each pass.

A) task
B) entry
C) count
D) All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
29
A(n) ____ is a small window that asks for information, and includes a text field and command buttons.

A) panel
B) message dialog box
C) task pane
D) input dialog box
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
30
The ____ statement is used to write count-controlled loops.

A) for
B) number
C) cntr
D) if-else
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
31
The____ operator means not equal to.

A) --
B) = =
C) <=
D) !=
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
32
The presence or absence of the ____ symbol(s) can seriously affect the logic of a selection statement.

A) { }
B) //
C) ;
D) /* */
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
33
Which of the following is true about using a text file for input?

A) The data set can be much larger.
B) Data can be input faster and with less chance of error.
C) Data can be used repeatedly with the same program or with different programs.
D) All of the above are true.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
34
Use a(n) ____ statement rather than two if statements when the alternative courses of action are mutually exclusive.

A) while
B) for
C) if-else
D) whether
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
35
A loop that continues until something specific is accomplished is called a(n) ____-controlled loop.

A) count
B) entry
C) task
D) outcome
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
36
FIGURE 4-2 <strong>FIGURE 4-2   Figure 4-2 above represents the behavior of a(n) ____ statement.</strong> A) if-else B) while C) random D) infinite
Figure 4-2 above represents the behavior of a(n) ____ statement.

A) if-else
B) while
C) random
D) infinite
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
37
To get out of a loop prematurely, use a(n) ____ statement.

A) exit
B) false
C) break
D) then
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
38
A typical loop has four component parts, including all of the following EXCEPT ___ statements.

A) initializing
B) body
C) update
D) verification
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
39
Each pass through a loop is called a(n) ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
40
The ____________________ operator increases a variable's value by one.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
41
Identify the letter of the choice that best matches the phrase or definition.
a.Random
b.Update
c.Abs
d.Exception
e.Break
What happens when a program encounters an operation that it cannot perform at runtime.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
42
____________________ statements execute within each pass and implement the calculation in question.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
43
Identify the letter of the choice that best matches the phrase or definition.
a.Random
b.Update
c.Abs
d.Exception
e.Break
A statement that changes the values of the variables tested in the termination condition.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
44
Identify the letter of the choice that best matches the phrase or definition.
a.Random
b.Update
c.Abs
d.Exception
e.Break
Exits a loop before the condition is false.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
45
Identify the letter of the choice that best matches the phrase or definition.
a.Random
b.Update
c.Abs
d.Exception
e.Break
A method in the Math class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
46
A(n) ____________________ control statement is located inside another control statement.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
47
Identify the letter of the choice that best matches the phrase or definition.
a.Random
b.Update
c.Abs
d.Exception
e.Break
A class used to simulate stock market fluctuations.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.