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