Deck 4: Loops and Files

ملء الشاشة (f)
exit full mode
سؤال
The do-while loop must be terminated with a semicolon.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
A(n) __________ is a special value that cannot be mistaken as a member of a list of data items and signals that there are no more data items to be processed.

A) accumulator
B) sentinel
C) delimiter
D) terminator
سؤال
In a for loop, the control variable is always incremented.
سؤال
The do-while loop is ideal in situations where you always want the loop to iterate at least once.
سؤال
A loop that executes as long as a particular condition exists is called a(n) __________ loop.

A) infinite
B) count-controlled
C) conditional
D) relational
سؤال
When the continue statement is encountered in a loop, all the statements in the body of the loop that appear after it are ignored, and the loop prepares for the next iteration.
سؤال
When you open a file with the PrintWriter class, the class can potentially throw an IOException.
سؤال
When you pass the name of a file to the PrintWriter constructor and the file already exists, it will be erased and a new empty file with the same name will be created.
سؤال
An item that separates other items is known as a

A) partition
B) delimiter
C) sentinel
D) terminator
سؤال
A loop that repeats a specific number of times is known as a(n) __________ loop.

A) count-controlled
B) infinite
C) conditional
D) pretest
سؤال
A __________ loop will always be executed at least once.

A) pretest
B) posttest
C) conditional
D) user-controlled
سؤال
When the break statement is encountered in a loop, all the statements in the body of the loop that appear after it are ignored, and the loop prepares for the next iteration.
سؤال
The variable used to keep a running total in a loop is called a(n) __________.

A) accumulator
B) sentinel
C) summation
D) integer
سؤال
Java provides a set of simple unary operators designed just for incrementing and decrementing variables.
سؤال
In a for loop, the control variable cannot be initialized to a constant value and tested against a constant value.
سؤال
Before entering a loop to compute a running total, the program should first

A) set the accumulator variable to an initial value, often zero
B) set all variables to zero
C) read all the values into main memory
D) know exactly how many values there are to total
سؤال
The while loop is always the best choice in situations where the exact number of iterations is known.
سؤال
The while loop has two important parts: (1) a boolean expression that is tested for a true or false value, and (2) a statement or block of statements that is repeated as long as the expression is true.
سؤال
A file must always be opened before using it and closed when the program is finished using it.
سؤال
A __________ is a value that signals when the end of a list of values has been reached.

A) terminal
B) sentinel
C) token
D) delimiter
سؤال
When working with the PrintWriter class, which of the following import statements should you have near the top of your program?

A) import javax.swing.*;
B) import javac.io.*;
C) import java.io.*;
D) import java.file.*;
سؤال
How many times will the following do-while loop be executed?
int x = 11;
Do
{
X += 20;
} while (x > 100);

A) 0
B) 1
C) 5
D) 4
سؤال
The __________ loop is ideal in situations where you always want the loop to iterate at least once.

A) for
B) while
C) do-while
D) posttest
سؤال
What will be the value of x after the following code is executed?
int x, y = 4, z = 6;
X = (y++) * (++z);

A) 24
B) 28
C) 30
D) 35
سؤال
Which of the following is the method you can use to determine whether a file exists?

A) the File class's canOpen method
B) the Scanner class's exists method
C) the File class's exists method
D) the PrintWriter class's fileExists method
سؤال
If a loop does not contain, within itself, a valid way to terminate, it is called a(n) __________ loop

A) for
B) while
C) do-while
D) infinite
سؤال
In all but very rare cases, loops must contain, within themselves

A) nested loops
B) a way to terminate
C) arithmetic operators
D) nested decision strucures
سؤال
Which of the following statements opens a file named MyFile.txt and allows you to read data from it?

A) Scanner inputFile = new Scanner("MyFile.txt");
B) File file = new File("MyFile.txt");
Scanner inputFile = new Scanner(file);
C) File Scanner = new File("MyFile.txt");
D) PrintWriter inputFile = new PrintWriter("MyFile.txt");
سؤال
What will be the value of x after the following code is executed?
int x, y = 15;
X = y--;

A) 14
B) 16
C) 0
D) 15
سؤال
What will be the value of x after the following code is executed?
int x = 10;
While (x < 100)
{
X += 100;
}

A) 100
B) 90
C) 110
D) 10
سؤال
What will be the value of x after the following statements are executed?
int x = 10;
For (int y = 5; y < 20; y +=5)
X += y;

A) 25
B) 30
C) 50
D) 40
سؤال
Given the following statement, which statement will write the string "Calvin" to the file DiskFile.txt?
PrintWriter diskOut = new PrintWriter("DiskFile.txt");

A) System.out.println(diskOut, "Calvin");
B) PrintWriter.println("Calvin");
C) DiskFile.println("Calvin");
D) diskOut.println("Calvin");
سؤال
What will be the values of x and y as a result of the following code?
int x = 25, y = 8;
X += y++;

A) x = 34, y = 9
B) x = 25, y = 8
C) x = 33, y = 8
D) x = 33, y = 9
سؤال
How many times will the following do-while loop be executed?
int x = 11;
Do
{
X += 20;
} while (x <= 100);

A) 5
B) 4
C) 3
D) 1
سؤال
Assume that inputFile references a Scanner object that was used to open a file. Which of the following while loops is the correct way to read data from the file until the end of the file is reached?

A) while (inputFile.nextLine == " ")
{ ).. }
B) while (inputFile != null)
{ ).. }
C) while (!inputFile.EOF)
{ ).. }
D) while (inputFile.hasNext())
{ ).. }
سؤال
What will be printed after the following code is executed? for (int number = 5; number <= 15; number +=3)
System.out.print(number + ", ");

A) 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
B) 5, 8, 11, 14, 17,
C) 5, 8, 11, 14
D) This is an invalid for statement.
سؤال
The __________ loop is ideal in situations where the exact number of iterations is known.

A) for
B) while
C) do-while
D) posttest
سؤال
How many times will the following for loop be executed?
for (int count = 10; count <= 21; count++)
System.out.println("Java is great!");

A) 0
B) 12
C) 10
D) 11
سؤال
Which of the following statements opens a file named MyFile.txt and allows you to append data to its existing contents?

A) FileWriter fwriter = new FileWriter("MyFile.txt");
PrintWriter outFile = new PrintWriter(fwriter);
B) FileWriter fwriter = new FileWriter("MyFile.txt", true);
PrintWriter outFile = new PrintWriter(fwriter);
C) PrintWriter outfile = new PrintWriter("MyFile.txt", true);
D) PrintWriter outfile = new PrintWriter(true, "MyFile.txt");
سؤال
Assuming that inputFile references a Scanner object that was used to open a file, which of the following statements will read an int from the file?

A) int number = inputFile.next();
B) int number = inputFile.integer();
C) int number = inputFile.readInt();
D) int number = inputFile.nextInt();
سؤال
What will be the values of x aand y after the following code is executed? int x = 12, y = 5;
X += y--;

A) x = 12, y = 5
B) x = 16, y = 4
C) x = 17, y = 5
D) x = 17, y = 4
سؤال
What will be the values of x and y after the following code is executed? int x, y = 15, z = 3;
X = (y--) / (++z);

A) 3
B) 4
C) 5
D) 6
سؤال
Which is a control structure that causes a statement or group of statements to repeat?

A) block
B) loop
C) prefix mode
D) body
سؤال
Select all that apply. Which method of the Random class will return a random number within the range of 0.0 and 1.0?

A) nextDouble()
B) nextLong()
C) nextFloat()
D) nextInt(int n)
سؤال
Which of the following statements will create an object from the Random class?

A) randomNumbers() = new Random();
B) Random myNumber = new Random();
C) myNumber = new Random();
D) Random = new randomNumbers();
سؤال
Which of the following are pre-test loops?

A) while, for, do-while
B) while, do-while
C) while, for
D) for, do-while
سؤال
Select all that apply. Which of the following steps is normally performed by a for loop?

A) update the control variable during each iteration
B) test the control variable by comparing it to a maximum or minimum value
C) terminate when the control variable reaches its maximum or minimum value
D) initialize the control variable to a starting value
سؤال
A random number, created as an object of the Random class, is always a(n) __________.

A) object
B) integer
C) float
D) class
سؤال
What will be the value of x after the following code is executed?
int x = 10, y = 20;
While (y < 100)
{
X += y;
}

A) 90
B) 110
C) 210
D) this is an infinite loop
سؤال
In the following code, what values could be read into number to terminate the while loop? Scanner keyboard = new Scanner(System.in);
System.out.print("Enter a number: ");
Int number = keyboard.nextInt();
While (number < 100 && number > 500)
{
System.out.print("Enter another number: ");
Number = keyboard.nextInt();
}

A) Numbers less than 100 or greater than 500
B) Numbers in the range 100 - 499
C) Numbers in the range 100 - 500
D) Impossible - the boolean condition can never be true
سؤال
The variable that controls the number of times a loop iterates is known as a(n) __________.

A) counter variable
B) loop control variable
C) running total
D) decrement variable
سؤال
In the following code, what values could be read into number to terminate the while loop? Scanner keyboard = new Scanner(System.in);
System.out.print("Enter a number: ");
Int number = keyboard.nextInt();
While (number < 100 || number > 500)
{
System.out.print("Enter another number: ");
Number = keyboard.nextInt();
}

A) Numbers less than 100
B) Numbers greater than 500
C) Numbers in the range 100 - 499
D) Numbers in the range 100 - 500
سؤال
What will be the value of x after the following code is executed?
int x = 10, y = 20;
While (y < 100)
{
X += y;
Y += 20;
}

A) 130
B) 210
C) 110
D) 90
سؤال
Each repetition of a loop is known as a(n) __________.

A) iteration
B) cycle
C) execution
D) lap
سؤال
The __________ loop allows the user to decide on the number of iterations.

A) counter controlled loop
B) dynamically executed loop
C) user controlled loop
D) infinite loop
سؤال
Which of the following expressions will generate a random number in the range of 1 through 10?

A) myNumber = randomNumbers.nextInt(10);
B) myNumber = randomNumbers.nextInt(1) + 10;
C) myNumber = randomNumbers.nextInt(11) - 1;
D) myNumber = randomNumbers.nextInt(10) + 1;
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/56
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 4: Loops and Files
1
The do-while loop must be terminated with a semicolon.
True
2
A(n) __________ is a special value that cannot be mistaken as a member of a list of data items and signals that there are no more data items to be processed.

A) accumulator
B) sentinel
C) delimiter
D) terminator
B
3
In a for loop, the control variable is always incremented.
False
4
The do-while loop is ideal in situations where you always want the loop to iterate at least once.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
5
A loop that executes as long as a particular condition exists is called a(n) __________ loop.

A) infinite
B) count-controlled
C) conditional
D) relational
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
6
When the continue statement is encountered in a loop, all the statements in the body of the loop that appear after it are ignored, and the loop prepares for the next iteration.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
7
When you open a file with the PrintWriter class, the class can potentially throw an IOException.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
8
When you pass the name of a file to the PrintWriter constructor and the file already exists, it will be erased and a new empty file with the same name will be created.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
9
An item that separates other items is known as a

A) partition
B) delimiter
C) sentinel
D) terminator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
10
A loop that repeats a specific number of times is known as a(n) __________ loop.

A) count-controlled
B) infinite
C) conditional
D) pretest
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
11
A __________ loop will always be executed at least once.

A) pretest
B) posttest
C) conditional
D) user-controlled
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
12
When the break statement is encountered in a loop, all the statements in the body of the loop that appear after it are ignored, and the loop prepares for the next iteration.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
13
The variable used to keep a running total in a loop is called a(n) __________.

A) accumulator
B) sentinel
C) summation
D) integer
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
14
Java provides a set of simple unary operators designed just for incrementing and decrementing variables.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
15
In a for loop, the control variable cannot be initialized to a constant value and tested against a constant value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
16
Before entering a loop to compute a running total, the program should first

A) set the accumulator variable to an initial value, often zero
B) set all variables to zero
C) read all the values into main memory
D) know exactly how many values there are to total
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
17
The while loop is always the best choice in situations where the exact number of iterations is known.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
18
The while loop has two important parts: (1) a boolean expression that is tested for a true or false value, and (2) a statement or block of statements that is repeated as long as the expression is true.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
19
A file must always be opened before using it and closed when the program is finished using it.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
20
A __________ is a value that signals when the end of a list of values has been reached.

A) terminal
B) sentinel
C) token
D) delimiter
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
21
When working with the PrintWriter class, which of the following import statements should you have near the top of your program?

A) import javax.swing.*;
B) import javac.io.*;
C) import java.io.*;
D) import java.file.*;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
22
How many times will the following do-while loop be executed?
int x = 11;
Do
{
X += 20;
} while (x > 100);

A) 0
B) 1
C) 5
D) 4
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
23
The __________ loop is ideal in situations where you always want the loop to iterate at least once.

A) for
B) while
C) do-while
D) posttest
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
24
What will be the value of x after the following code is executed?
int x, y = 4, z = 6;
X = (y++) * (++z);

A) 24
B) 28
C) 30
D) 35
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
25
Which of the following is the method you can use to determine whether a file exists?

A) the File class's canOpen method
B) the Scanner class's exists method
C) the File class's exists method
D) the PrintWriter class's fileExists method
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
26
If a loop does not contain, within itself, a valid way to terminate, it is called a(n) __________ loop

A) for
B) while
C) do-while
D) infinite
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
27
In all but very rare cases, loops must contain, within themselves

A) nested loops
B) a way to terminate
C) arithmetic operators
D) nested decision strucures
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
28
Which of the following statements opens a file named MyFile.txt and allows you to read data from it?

A) Scanner inputFile = new Scanner("MyFile.txt");
B) File file = new File("MyFile.txt");
Scanner inputFile = new Scanner(file);
C) File Scanner = new File("MyFile.txt");
D) PrintWriter inputFile = new PrintWriter("MyFile.txt");
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
29
What will be the value of x after the following code is executed?
int x, y = 15;
X = y--;

A) 14
B) 16
C) 0
D) 15
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
30
What will be the value of x after the following code is executed?
int x = 10;
While (x < 100)
{
X += 100;
}

A) 100
B) 90
C) 110
D) 10
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
31
What will be the value of x after the following statements are executed?
int x = 10;
For (int y = 5; y < 20; y +=5)
X += y;

A) 25
B) 30
C) 50
D) 40
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
32
Given the following statement, which statement will write the string "Calvin" to the file DiskFile.txt?
PrintWriter diskOut = new PrintWriter("DiskFile.txt");

A) System.out.println(diskOut, "Calvin");
B) PrintWriter.println("Calvin");
C) DiskFile.println("Calvin");
D) diskOut.println("Calvin");
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
33
What will be the values of x and y as a result of the following code?
int x = 25, y = 8;
X += y++;

A) x = 34, y = 9
B) x = 25, y = 8
C) x = 33, y = 8
D) x = 33, y = 9
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
34
How many times will the following do-while loop be executed?
int x = 11;
Do
{
X += 20;
} while (x <= 100);

A) 5
B) 4
C) 3
D) 1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
35
Assume that inputFile references a Scanner object that was used to open a file. Which of the following while loops is the correct way to read data from the file until the end of the file is reached?

A) while (inputFile.nextLine == " ")
{ ).. }
B) while (inputFile != null)
{ ).. }
C) while (!inputFile.EOF)
{ ).. }
D) while (inputFile.hasNext())
{ ).. }
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
36
What will be printed after the following code is executed? for (int number = 5; number <= 15; number +=3)
System.out.print(number + ", ");

A) 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
B) 5, 8, 11, 14, 17,
C) 5, 8, 11, 14
D) This is an invalid for statement.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
37
The __________ loop is ideal in situations where the exact number of iterations is known.

A) for
B) while
C) do-while
D) posttest
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
38
How many times will the following for loop be executed?
for (int count = 10; count <= 21; count++)
System.out.println("Java is great!");

A) 0
B) 12
C) 10
D) 11
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
39
Which of the following statements opens a file named MyFile.txt and allows you to append data to its existing contents?

A) FileWriter fwriter = new FileWriter("MyFile.txt");
PrintWriter outFile = new PrintWriter(fwriter);
B) FileWriter fwriter = new FileWriter("MyFile.txt", true);
PrintWriter outFile = new PrintWriter(fwriter);
C) PrintWriter outfile = new PrintWriter("MyFile.txt", true);
D) PrintWriter outfile = new PrintWriter(true, "MyFile.txt");
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
40
Assuming that inputFile references a Scanner object that was used to open a file, which of the following statements will read an int from the file?

A) int number = inputFile.next();
B) int number = inputFile.integer();
C) int number = inputFile.readInt();
D) int number = inputFile.nextInt();
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
41
What will be the values of x aand y after the following code is executed? int x = 12, y = 5;
X += y--;

A) x = 12, y = 5
B) x = 16, y = 4
C) x = 17, y = 5
D) x = 17, y = 4
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
42
What will be the values of x and y after the following code is executed? int x, y = 15, z = 3;
X = (y--) / (++z);

A) 3
B) 4
C) 5
D) 6
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
43
Which is a control structure that causes a statement or group of statements to repeat?

A) block
B) loop
C) prefix mode
D) body
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
44
Select all that apply. Which method of the Random class will return a random number within the range of 0.0 and 1.0?

A) nextDouble()
B) nextLong()
C) nextFloat()
D) nextInt(int n)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
45
Which of the following statements will create an object from the Random class?

A) randomNumbers() = new Random();
B) Random myNumber = new Random();
C) myNumber = new Random();
D) Random = new randomNumbers();
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
46
Which of the following are pre-test loops?

A) while, for, do-while
B) while, do-while
C) while, for
D) for, do-while
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
47
Select all that apply. Which of the following steps is normally performed by a for loop?

A) update the control variable during each iteration
B) test the control variable by comparing it to a maximum or minimum value
C) terminate when the control variable reaches its maximum or minimum value
D) initialize the control variable to a starting value
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
48
A random number, created as an object of the Random class, is always a(n) __________.

A) object
B) integer
C) float
D) class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
49
What will be the value of x after the following code is executed?
int x = 10, y = 20;
While (y < 100)
{
X += y;
}

A) 90
B) 110
C) 210
D) this is an infinite loop
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
50
In the following code, what values could be read into number to terminate the while loop? Scanner keyboard = new Scanner(System.in);
System.out.print("Enter a number: ");
Int number = keyboard.nextInt();
While (number < 100 && number > 500)
{
System.out.print("Enter another number: ");
Number = keyboard.nextInt();
}

A) Numbers less than 100 or greater than 500
B) Numbers in the range 100 - 499
C) Numbers in the range 100 - 500
D) Impossible - the boolean condition can never be true
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
51
The variable that controls the number of times a loop iterates is known as a(n) __________.

A) counter variable
B) loop control variable
C) running total
D) decrement variable
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
52
In the following code, what values could be read into number to terminate the while loop? Scanner keyboard = new Scanner(System.in);
System.out.print("Enter a number: ");
Int number = keyboard.nextInt();
While (number < 100 || number > 500)
{
System.out.print("Enter another number: ");
Number = keyboard.nextInt();
}

A) Numbers less than 100
B) Numbers greater than 500
C) Numbers in the range 100 - 499
D) Numbers in the range 100 - 500
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
53
What will be the value of x after the following code is executed?
int x = 10, y = 20;
While (y < 100)
{
X += y;
Y += 20;
}

A) 130
B) 210
C) 110
D) 90
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
54
Each repetition of a loop is known as a(n) __________.

A) iteration
B) cycle
C) execution
D) lap
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
55
The __________ loop allows the user to decide on the number of iterations.

A) counter controlled loop
B) dynamically executed loop
C) user controlled loop
D) infinite loop
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
56
Which of the following expressions will generate a random number in the range of 1 through 10?

A) myNumber = randomNumbers.nextInt(10);
B) myNumber = randomNumbers.nextInt(1) + 10;
C) myNumber = randomNumbers.nextInt(11) - 1;
D) myNumber = randomNumbers.nextInt(10) + 1;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.