Deck 2: Basic Elements of Java
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/50
العب
ملء الشاشة (f)
Deck 2: Basic Elements of Java
1
When evaluating a mixed expression, all integer operands are converted to floating-point numbers with the decimal part of zero.
True
2
Suppose console is a Scanner object initialized with the standard input device. The expression console.nextInt(); is used to read one int value and the expression console.nextDouble(); is used to read two int values.
False
3
An identifier can be any sequence of characters and integers.
False
4
Operators of the same precedence are evaluated from right to left.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
5
A value such as 'd' is called a character constant.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
6
The number of significant digits in a double variable is up to 15.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
7
Suppose that index is an int variable. The statement index = index + 1; is equivalent to index++;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
8
The value of a variable may change during program execution.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
9
When a value of one data type is automatically changed to another data type, an implicit type coercion has occurred.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
10
The pair of characters // is used for single line comments.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
11
An operator that has only one operand is called a unique operator.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
12
Java automatically initializes all variables.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
13
The null string contains only the blank character.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
14
If a = 4; and b = 3;, then after the statement a = b; executes, the value of b is 4 and the value of a is 3.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
15
Suppose x = 18.6. The output of the statement System.out.println((int)(x) / 3); is 6.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
16
The Java language is strongly typed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
17
Suppose console is a Scanner object initialized with the standard input device and feet and inches are int variables. Consider the following statements: feet = console.nextInt();
inches = console.nextInt(); These statements require the value of feet and inches to be input on separate lines.
inches = console.nextInt(); These statements require the value of feet and inches to be input on separate lines.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
18
The symbol '5' does not belong to the char data type because 5 is a digit.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
19
The data type float is a floating-point data type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
20
The == characters are a special symbol in Java.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
21
The character sequence \n moves the insertion point at the end of the current line.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
22
The value of the expression 14 % 3 is ____.
A) 1
B) 2
C) 3
D) 4
A) 1
B) 2
C) 3
D) 4
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
23
Operators that have two operands are called ____.
A) unary operators
B) binary operators
C) operators
D) expressions
A) unary operators
B) binary operators
C) operators
D) expressions
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
24
In Java, a period is used to terminate a statement.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
25
The expression (int)8.7 evaluates to ____.
A) 8
B) 8.0
C) 9.0
D) 9
A) 8
B) 8.0
C) 9.0
D) 9
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
26
The ____ rules of a programming language tell you which statements are legal, or accepted by the programming language.
A) semantic
B) logical
C) syntax
D) grammatical
A) semantic
B) logical
C) syntax
D) grammatical
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
27
Which of the following is a valid int value?
A) 3279
B) 3,279
C) 3270.00
D) -922337203684547758808
A) 3279
B) 3,279
C) 3270.00
D) -922337203684547758808
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
28
Suppose that x and y are int variables and x = 7 and y = 8. After the statement: x = x * y - 2; executes, the value of x is ____.
A) 42
B) 54
C) 56
D) 58
A) 42
B) 54
C) 56
D) 58
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
29
Suppose x = 8. After the execution of the statement y = x++; y is 8 and x is 10.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
30
The memory allocated for a double value is ____ bytes.
A) 2
B) 4
C) 8
D) 16
A) 2
B) 4
C) 8
D) 16
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
31
Which of the following is a valid char value?
A) '$_'
B) '%'
C) 'n\'
D) "a"
A) '$_'
B) '%'
C) 'n\'
D) "a"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
32
What type of Java statement(s) stores a value in a variable?
A) input
B) output
C) assignment
D) Both an input statement and an assignment statement
A) input
B) output
C) assignment
D) Both an input statement and an assignment statement
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
33
The value of the expression 5 + 10 % 4 - 3 is ____.
A) 0
B) 2
C) 4
D) 5
A) 0
B) 2
C) 4
D) 5
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
34
If ++x is used in an expression, first the expression is evaluated, and then the value of x is incremented by 1.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
35
Which of the following statements about a named constant is NOT true?
A) Its content cannot change during program execution.
B) Its value can be changed during program execution.
C) It is a memory location.
D) It is declared using the reserved word final.
A) Its content cannot change during program execution.
B) Its value can be changed during program execution.
C) It is a memory location.
D) It is declared using the reserved word final.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
36
The length of the string "first java program" is:
A) 16
B) 18
C) 19
D) 20
A) 16
B) 18
C) 19
D) 20
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
37
Which of the following is NOT a reserved word in Java?
A) double
B) throws
C) static
D) num
A) double
B) throws
C) static
D) num
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
38
Both System.out.println and System.out.print can be used to output a string on the standard output device.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
39
The expression (double)(5 + 4) evaluates to ____.
A) 8
B) 9
C) 9.0
D) 10.0
A) 8
B) 9
C) 9.0
D) 10.0
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
40
Which of the following is a valid Java identifier?
A) $pay
B) 4myGrade!
C) newGrade!
D) 1dollar
A) $pay
B) 4myGrade!
C) newGrade!
D) 1dollar
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
41
Given
Char ch;
Int num;
Double pay; Which of the following assignment statements are valid?
(i) ch = ' * ' ;
(ii) pay = num * pay;
(iii) rate * 40 = pay;
A) Only (i) is valid
B) (i) and (ii) are valid
C) (ii) and (iii) are valid
D) (i) and (iii) are valid
Char ch;
Int num;
Double pay; Which of the following assignment statements are valid?
(i) ch = ' * ' ;
(ii) pay = num * pay;
(iii) rate * 40 = pay;
A) Only (i) is valid
B) (i) and (ii) are valid
C) (ii) and (iii) are valid
D) (i) and (iii) are valid
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
42
The declaration int a, b, c; is equivalent to which of the following?
A) int a , b c;
B) int a;
Int b;
Int c;
C) int abc;
D) int a b c;
A) int a , b c;
B) int a;
Int b;
Int c;
C) int abc;
D) int a b c;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
43
Consider the following program. // Insertion Point 1
Public class CircleArea
{
// Insertion Point 2
Static final float PI = 3.14 public static void main(String[]args)
{
//Insertion Point 3 float r = 2.0;
Float area;
Area = PI * r * r;
System.out.println( " Area = " + area);
}
// Insertion Point 4
} In the above code, where do the import statements belong?
A) Insertion Point 1
B) Insertion Point 2
C) Insertion Point 3
D) Insertion Point 4
Public class CircleArea
{
// Insertion Point 2
Static final float PI = 3.14 public static void main(String[]args)
{
//Insertion Point 3 float r = 2.0;
Float area;
Area = PI * r * r;
System.out.println( " Area = " + area);
}
// Insertion Point 4
} In the above code, where do the import statements belong?
A) Insertion Point 1
B) Insertion Point 2
C) Insertion Point 3
D) Insertion Point 4
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
44
Which of the following is the newline character?
A) \r
B) \n
C) \l
D) \b
A) \r
B) \n
C) \l
D) \b
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
45
____ are executable statements that inform the user what to do.
A) Variables
B) Prompt lines
C) Named constants
D) Expressions
A) Variables
B) Prompt lines
C) Named constants
D) Expressions
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
46
Suppose x = 4 and y = 2. If the statement x *= y; is executed once, what is the value of x?
A) 2
B) 4
C) 8
D) This is an illegal statement in Java.
A) 2
B) 4
C) 8
D) This is an illegal statement in Java.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
47
What is the output of the following statement? System.out.println("Welcome \n Home");
A) WelcomeHome
B) Welcome Home
C) Welcome Home
D) Welcome \n Home
A) WelcomeHome
B) Welcome Home
C) Welcome Home
D) Welcome \n Home
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
48
Consider the following program. public class CircleArea
{
Static Scanner console = new Scanner(System.in); static final float PI = 3.14; public static void main(String[]args)
{
Float r;
Float area;
R = console.nextDouble();
Area = PI * r * r;
System.out.println( " Area = " + area);
}
} To successfully compile this program, which of the following import statement is required?
A) import java.io;
B) import java.util;
C) import java.lang;
D) No import statement is required
{
Static Scanner console = new Scanner(System.in); static final float PI = 3.14; public static void main(String[]args)
{
Float r;
Float area;
R = console.nextDouble();
Area = PI * r * r;
System.out.println( " Area = " + area);
}
} To successfully compile this program, which of the following import statement is required?
A) import java.io;
B) import java.util;
C) import java.lang;
D) No import statement is required
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
49
The standard output object in Java is ____.
A) output
B) System.out
C) Sys.out
D) System.in
A) output
B) System.out
C) Sys.out
D) System.in
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
50
Suppose that alpha and beta are int variables. The statement alpha = --beta; is equivalent to the statement(s) ____.
A) beta = beta - 1; alpha = 1 - beta;
B) beta = beta - 1; alpha = beta - 1;
C) beta = beta - 1; alpha = beta;
D) alpha = beta; beta = beta - 1;
A) beta = beta - 1; alpha = 1 - beta;
B) beta = beta - 1; alpha = beta - 1;
C) beta = beta - 1; alpha = beta;
D) alpha = beta; beta = beta - 1;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck