Deck 3: Decision Structures
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/58
العب
ملء الشاشة (f)
Deck 3: Decision Structures
1
All it takes for an OR expression to be true is for one of the subexpressions to be true.
True
2
When two strings are compared using the String class's compareTo method, the comparison is not case sensitive.
False
3
__________ operators are used to determine whether a specific relationship exists between two values.
A) Assignment
B) Arithmetic
C) Logical
D) Relational
A) Assignment
B) Arithmetic
C) Logical
D) Relational
D
4
If str1 and str2 are both String objects, which of the following expressions will correctly determine whether or not they are equal?
A) str1 = str2
B) str1 && str2
C) str1.equals(str2)
D) str1 += str2
A) str1 = str2
B) str1 && str2
C) str1.equals(str2)
D) str1 += str2
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
5
If the expression on the left side of the && operator is false, the expression on the right side will not be checked.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
6
Programs never need more than one path of execution.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
7
Which of the following expressions could be used to perform a case-insensitive comparison of two String objects named str1 and str2?
A) str1.equalsIgnoreCase(str2)
B) str1.equalsInsensitive(str2)
C) str1 != str2
D) str1 || str2
A) str1.equalsIgnoreCase(str2)
B) str1.equalsInsensitive(str2)
C) str1 != str2
D) str1 || str2
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
8
A block of code is enclosed in a set of
A) braces, { }
B) parentheses, ( )
C) brackets, [ ]
D) double quotes, " "
A) braces, { }
B) parentheses, ( )
C) brackets, [ ]
D) double quotes, " "
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
9
When testing for character values, the switch statement does not test for the case of the character.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
10
The System.out.printf method formats a string and displays it in the console window.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
11
The String.format method works exactly like the System.out.printf method, except that it does not display the formatted string on the screen.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
12
In a switch statement, each of the case values must be unique.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
13
In a switch statement, if two different values for the CaseExpression would result in the same code being executed, you must have two copies of the code, one after each CaseExpression.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
14
A local variable's scope always ends at the closing brace of the block of code in which it is declared.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
15
The if-else statement will execute one group of statements if its boolean expression is true or another group if its boolean expression is false.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
16
The switch statement is a
A) multiple alternative decision structure
B) nested decision structure
C) sequence structure
D) test expression
A) multiple alternative decision structure
B) nested decision structure
C) sequence structure
D) test expression
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
17
All it takes for an AND expression to be true is for one of the subexpressions to be true.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
18
In an if-else statement, if the boolean expression is false then
A) no statements or blocks are executed
B) the statement or block following the else is executed
C) the first statement or block is executed
D) all the statements or blocks are executed
A) no statements or blocks are executed
B) the statement or block following the else is executed
C) the first statement or block is executed
D) all the statements or blocks are executed
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
19
When testing for character values, the switch statement does not test for the case of the character.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
20
Unicode is an international encoding system that is extensive enough to represent all the characters of all the world's alphabets.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
21
What will be the value of pay after the following statements are executed?
int hours = 45;
Double pay, payRate = 10.00;
Pay = hours <= 40 ? hours * payRate :
40 * payRate + (hours - 40) *payRate * 1.5;
A) 400.00
B) 450.00
C) 465.00
D) 475.00
int hours = 45;
Double pay, payRate = 10.00;
Pay = hours <= 40 ? hours * payRate :
40 * payRate + (hours - 40) *payRate * 1.5;
A) 400.00
B) 450.00
C) 465.00
D) 475.00
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
22
The __________ statement is used to create a decision structure which allows a program to have more than one path of execution.
A) block
B) if
C) null
D) flag
A) block
B) if
C) null
D) flag
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
23
A __________ is a boolean variable that signals when some condition exists in the program.
A) sentinel
B) flag
C) block
D) case
A) sentinel
B) flag
C) block
D) case
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
24
What will be the value of x after the following statements are executed?
int x = 10;
Switch (x)
{
Case 10:
X += 15;
Case 12:
X -= 5;
Break;
Default:
X *= 3;
}
A) 30
B) 20
C) 25
D) 5
int x = 10;
Switch (x)
{
Case 10:
X += 15;
Case 12:
X -= 5;
Break;
Default:
X *= 3;
}
A) 30
B) 20
C) 25
D) 5
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
25
Which of the following expressions determines whether the char variable, chrA, is not equal to the letter 'A'?
A) chrA == 'A'
B) chrA != 'A'
C) chrA || 'A'
D) chrA.notEquals(A)
A) chrA == 'A'
B) chrA != 'A'
C) chrA || 'A'
D) chrA.notEquals(A)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
26
What will be the values of ans, x, and y after the following statements are executed?
int ans = 35, x = 50, y = 50;
If (x >= y)
{
Ans = x + 10;
X -= y;
}
Else
{
Ans = y + 10;
Y += x;
}
A) ans = 60, x = 0, y = 50
B) ans = 45, x = 50, y = 0
C) ans = 45, x = 50, y = 50
D) ans = 60, x = 50, y = 100
int ans = 35, x = 50, y = 50;
If (x >= y)
{
Ans = x + 10;
X -= y;
}
Else
{
Ans = y + 10;
Y += x;
}
A) ans = 60, x = 0, y = 50
B) ans = 45, x = 50, y = 0
C) ans = 45, x = 50, y = 50
D) ans = 60, x = 50, y = 100
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
27
In Java, when a character is stored in memory, it is actually the __________ that is stored.
A) Unicode number
B) ASCII code
C) floating-point value
D) letter, symbol, or number
A) Unicode number
B) ASCII code
C) floating-point value
D) letter, symbol, or number
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
28
What will be the value of bonus after the following statements are executed? int bonus, sales = 10000;
If (sales < 5000)
Bonus = 200;
Else if (sales < 7500)
Bonus = 500;
Else if (sales < 10000)
Bonus = 750;
Else if (sales < 20000)
Bonus = 1000;
Else
Bonus = 1250;
A) 750
B) 1250
C) 500
D) 1000
If (sales < 5000)
Bonus = 200;
Else if (sales < 7500)
Bonus = 500;
Else if (sales < 10000)
Bonus = 750;
Else if (sales < 20000)
Bonus = 1000;
Else
Bonus = 1250;
A) 750
B) 1250
C) 500
D) 1000
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
29
The boolean expression in an if statement must evaluate to
A) degrees or radians
B) true or false
C) positive or negative
D) left or right
A) degrees or radians
B) true or false
C) positive or negative
D) left or right
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
30
What will be displayed after the following statements are executed?
int y = 10;
If (y == 10)
{
Int x = 30;
X += y;
System.out.println(x);
}
A) 40
B) 30
C) 20
D) The code contains an error and will not compile.
int y = 10;
If (y == 10)
{
Int x = 30;
X += y;
System.out.println(x);
}
A) 40
B) 30
C) 20
D) The code contains an error and will not compile.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
31
What will be the value of discountRate after the following statements are executed?
double discountRate;
Char custType = 'B';
Switch (custType)
{
Case 'A':
DiscountRate = 0.08;
Break;
Case 'B':
DiscountRate = 0.06;
Case 'C':
DiscountRate = 0.04;
Default:
DiscountRate = 0.0;
}
A) 0.08
B) 0.06
C) 0.04
D) 0.0
double discountRate;
Char custType = 'B';
Switch (custType)
{
Case 'A':
DiscountRate = 0.08;
Break;
Case 'B':
DiscountRate = 0.06;
Case 'C':
DiscountRate = 0.04;
Default:
DiscountRate = 0.0;
}
A) 0.08
B) 0.06
C) 0.04
D) 0.0
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
32
What will be the value of discountRate after the following statements are executed?
double discountRate = 0.0;
Int purchase = 1250;
Char cust = 'N';
If (purchase > 1000)
If (cust == 'Y')
DiscountRate = 0.05;
Else
DiscountRate = 0.04;
Else if (purchase > 750)
If (cust == 'Y')
DiscountRate = 0.04;
Else
DiscountRate = 0.03;
Else
DiscountRate = 0.0;
A) 0.0
B) 0.04
C) 0.05
D) 0.03
double discountRate = 0.0;
Int purchase = 1250;
Char cust = 'N';
If (purchase > 1000)
If (cust == 'Y')
DiscountRate = 0.05;
Else
DiscountRate = 0.04;
Else if (purchase > 750)
If (cust == 'Y')
DiscountRate = 0.04;
Else
DiscountRate = 0.03;
Else
DiscountRate = 0.0;
A) 0.0
B) 0.04
C) 0.05
D) 0.03
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
33
Java requires that the boolean expression being tested by an if statement be enclosed in
A) a set of parentheses
B) a set of braces
C) a set of double quotes
D) a set of brackets
A) a set of parentheses
B) a set of braces
C) a set of double quotes
D) a set of brackets
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
34
Which of the following statements determines whether the variable temp is within the range of 0 through 100 (inclusive)?
A) if (temp >= 0 && temp <= 100)
B) if (temp > 0 && temp < 100)
C) if (temp >= 0 || temp <= 100)
D) if (temp > 0 || temp < 100)
A) if (temp >= 0 && temp <= 100)
B) if (temp > 0 && temp < 100)
C) if (temp >= 0 || temp <= 100)
D) if (temp > 0 || temp < 100)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
35
What will be the value of x after the following statements are executed?
int x = 75;
Int y = 60;
If (x > y)
X = x - y;
A) 60
B) 75
C) 15
D) 135
int x = 75;
Int y = 60;
If (x > y)
X = x - y;
A) 60
B) 75
C) 15
D) 135
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
36
What will be the value of ans after the following statements are executed?
int x = 40;
Int y = 40;
If (x = y)
Ans = x + 10;
A) 30
B) 80
C) 50
D) The code contains an error and will not compile.
int x = 40;
Int y = 40;
If (x = y)
Ans = x + 10;
A) 30
B) 80
C) 50
D) The code contains an error and will not compile.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
37
What will be displayed after the following statements are executed?
int ans = 10;
Int x = 65;
Int y = 55;
If (x >= y)
{
Int ans = x + y;
}
System.out.println(ans);
A) 10
B) 120
C) 100
D) The code contains an error and will not compile.
int ans = 10;
Int x = 65;
Int y = 55;
If (x >= y)
{
Int ans = x + y;
}
System.out.println(ans);
A) 10
B) 120
C) 100
D) The code contains an error and will not compile.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
38
A flag may have the values
A) defined or undefined
B) true or false
C) of any range of integers
D) of any Unicode character
A) defined or undefined
B) true or false
C) of any range of integers
D) of any Unicode character
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
39
What will be the value of discountRate after the following statements are executed?
double discountRate = 0.0;
Int purchase = 100;
If (purchase > 1000)
DiscountRate = 0.05;
Else if (purchase > 750)
DiscountRate = 0.03;
Else if (purchase > 500)
DiscountRate = 0.01;
A) 0.0
B) 0.05
C) 0.03
D) 0.01
double discountRate = 0.0;
Int purchase = 100;
If (purchase > 1000)
DiscountRate = 0.05;
Else if (purchase > 750)
DiscountRate = 0.03;
Else if (purchase > 500)
DiscountRate = 0.01;
A) 0.0
B) 0.05
C) 0.03
D) 0.01
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
40
Which of the following expressions will determine whether x is less than or equal to y?
A) x <= y
B) x => y
C) x >= y
D) x =< y
A) x <= y
B) x => y
C) x >= y
D) x =< y
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
41
Which of the following is the correct boolean expression to test for: int x being a value less than or equal to 500 or greater than 650, or int y not equal to 1000?
A) ((x >= 500 && x < 650) && (y != 1000))
B) ((x <= 500 OR x > 650) AND !))
C) ((x >= 500 || x < 650) || (y != 1000))
D) ((x <= 500 || x > 650) && !(y == 1000))
A) ((x >= 500 && x < 650) && (y != 1000))
B) ((x <= 500 OR x > 650) AND !))
C) ((x >= 500 || x < 650) || (y != 1000))
D) ((x <= 500 || x > 650) && !(y == 1000))
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
42
What is the value of ans after the following code has been executed?
int x = 35;
Int y = 20, ans = 80;
If (x < y)
Ans += y;
A) 80
B) 100
C) 35
D) 55
int x = 35;
Int y = 20, ans = 80;
If (x < y)
Ans += y;
A) 80
B) 100
C) 35
D) 55
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
43
An expression tested by an if statement must evaluate to
A) 0 or 1
B) +1 or -1
C) true or false
D) t or f
A) 0 or 1
B) +1 or -1
C) true or false
D) t or f
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
44
What is the value of x after the following code has been executed?
int x = 75;
Int y = 90;
If (x != y)
X += y;
A) 75
B) 90
C) 15
D) 165
int x = 75;
Int y = 90;
If (x != y)
X += y;
A) 75
B) 90
C) 15
D) 165
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
45
What would be the value of bonus after the following statements are executed? int bonus, sales = 85000;
Char dept = 'S';
If (sales > 100000)
If (dept == 'R')
Bonus = 2000;
Else
Bonus = 1500;
Else if (sales > 75000)
If (dept == 'R')
Bonus = 1250;
Else
Bonus = 1000;
Else
Bonus = 0;
A) 2000
B) 1500
C) 1250
D) 1000
Char dept = 'S';
If (sales > 100000)
If (dept == 'R')
Bonus = 2000;
Else
Bonus = 1500;
Else if (sales > 75000)
If (dept == 'R')
Bonus = 1250;
Else
Bonus = 1000;
Else
Bonus = 0;
A) 2000
B) 1500
C) 1250
D) 1000
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
46
________ works like this: If the expression on the left side of the && operator is false, the expression the right side will not be checked.
A) short-circuit evaluation
B) reverse logic
C) Boolean logic
D) relational evaluation
A) short-circuit evaluation
B) reverse logic
C) Boolean logic
D) relational evaluation
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
47
What does the following code display?
int d = 9, e = 12;
System.out.printf("%d %d\n", d, e);
A) %d %d
B) 9 12
C) %d 9
D) %9 %12
int d = 9, e = 12;
System.out.printf("%d %d\n", d, e);
A) %d %d
B) 9 12
C) %d 9
D) %9 %12
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
48
Which of the following is the correct boolean expression to test for: int x being a value between, but not including, 500 and 650, or int y not equal to 1000?
A) ((x >= 500 && x <= 650) && (y != 1000))
B) ((x > 500 AND x < 650) OR !))
C) ((x > 500 && x < 650) || (y != 1000))
D) ((x < 500 && x > 650) || !(y == 1000))
A) ((x >= 500 && x <= 650) && (y != 1000))
B) ((x > 500 AND x < 650) OR !))
C) ((x > 500 && x < 650) || (y != 1000))
D) ((x < 500 && x > 650) || !(y == 1000))
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
49
What would be the value of discountRate after the following statements are executed?
double discountRate = 0.0;
Int purchase = 1250;
If (purchase > 1000)
DiscountRate = .05;
If (purchase > 750)
DiscountRate = .03;
If (purchase > 500)
DiscountRate = .01;
Else
DiscountRate = 0;
A) .05
B) .03
C) .01
D) 0
double discountRate = 0.0;
Int purchase = 1250;
If (purchase > 1000)
DiscountRate = .05;
If (purchase > 750)
DiscountRate = .03;
If (purchase > 500)
DiscountRate = .01;
Else
DiscountRate = 0;
A) .05
B) .03
C) .01
D) 0
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
50
Which of the following is the not equal operator?
A) <>
B) NOT
C) *&
D) !=
A) <>
B) NOT
C) *&
D) !=
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
51
What is the value of charges after the following code has been executed?
double charges, rate = 7.00;
Int time = 180;
Charges = time <= 119 ? rate * 2 :
Time / 60.0 * rate;
A) 7.00
B) 14.00
C) 21.00
D) 28.00
double charges, rate = 7.00;
Int time = 180;
Charges = time <= 119 ? rate * 2 :
Time / 60.0 * rate;
A) 7.00
B) 14.00
C) 21.00
D) 28.00
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
52
Which of the following will format 12.7801 to display as $12.78?
A) System.out.printf("$%,.2f", 12.7801);
B) System.out.printf("%f", 12.7801);
C) System.out.printf("%.2f $$", 12.7801);
D) System.out.printf("$d", 12.7801);
A) System.out.printf("$%,.2f", 12.7801);
B) System.out.printf("%f", 12.7801);
C) System.out.printf("%.2f $$", 12.7801);
D) System.out.printf("$d", 12.7801);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
53
What would be the value of bonus after the following statements are executed? int bonus, sales = 1250;
If (sales > 1000)
Bonus = 100;
If (sales > 750)
Bonus = 50;
If (sales > 500)
Bonus = 25;
Else
Bonus = 0;
A) 100
B) 500
C) 25
D) 0
If (sales > 1000)
Bonus = 100;
If (sales > 750)
Bonus = 50;
If (sales > 500)
Bonus = 25;
Else
Bonus = 0;
A) 100
B) 500
C) 25
D) 0
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
54
Which of the following will format 12.78 to display as 12.8%?
A) System.out.printf("%2.1d%", 12.78);
B) System.out.printf("%.2f%%", 12.78);
C) System.out.printf("%1.2d%", 12.78);
D) System.out.printf("%.1f%%", 12.78);
A) System.out.printf("%2.1d%", 12.78);
B) System.out.printf("%.2f%%", 12.78);
C) System.out.printf("%1.2d%", 12.78);
D) System.out.printf("%.1f%%", 12.78);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
55
What will be printed when the following code is executed?
double x = 45678.259;
System.out.printf("%,.2f", x);
A) 45678.259
B) 0,045,678.26
C) 45,678.26
D) 45,678.3
double x = 45678.259;
System.out.printf("%,.2f", x);
A) 45678.259
B) 0,045,678.26
C) 45,678.26
D) 45,678.3
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
56
What does the following code display?
double x = 12.3798146;
System.out.printf("%.2f\n", x);
A) 123798146
B) 1238
C) %12.38
D) 12.38
double x = 12.3798146;
System.out.printf("%.2f\n", x);
A) 123798146
B) 1238
C) %12.38
D) 12.38
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
57
If you prematurely terminate an if statement with a semicolon, the compiler will
A) not display an error message
B) assume you are placing a null statement there
C) both (a) and (b)
D) none of these
A) not display an error message
B) assume you are placing a null statement there
C) both (a) and (b)
D) none of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck
58
What is the value of ans, x, and y after the following statements are executed?
int ans = 0, x = 15, y = 25;
If ( x >= y)
{
Ans = x + 10;
X -=y;
}
Else
{
Ans = y + 10;
Y += x;
}
A) ans = 0, x = 15, y = 25
B) ans = 25, x = -10, y = 25
C) ans = 35, x = 15, y = 40
D) ans = 25, x = 15, y = 40
int ans = 0, x = 15, y = 25;
If ( x >= y)
{
Ans = x + 10;
X -=y;
}
Else
{
Ans = y + 10;
Y += x;
}
A) ans = 0, x = 15, y = 25
B) ans = 25, x = -10, y = 25
C) ans = 35, x = 15, y = 40
D) ans = 25, x = 15, y = 40
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 58 في هذه المجموعة.
فتح الحزمة
k this deck