Deck 2: Java Fundamentals

ملء الشاشة (f)
exit full mode
سؤال
What will be displayed as a result of executing the following code? int x = 5, y = 20;
X += 32;
Y /= 4;
System.out.println("x = " + x + ", y = " + y);

A) x = 32, y = 4
B) x = 9, y = 52
C) x = 37, y = 5
D) x = 160, y = 80
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
In Java, ___________ must be declared before they can be used.

A) Variables
B) Literals
C) Key words
D) Comments
سؤال
To compile a program named First, use the following command:

A) java First.java
B) javac First
C) javac First.java
D) compile First.javac
سؤال
In Java, the beginning of a comment is marked with:

A) //
B) ""
C) ;
D) #
سؤال
What would be printed out as a result of the following code? System.out.println("The quick brown fox" +
"jumped over the \n"
"slow moving hen.");

A) The quick brown fox jumped over the \nslow moving hen.
B) The quick brown fox jumped over the
Slow moving hen.
C) The quick brown fox
Jumped over the
Slow moving hen.
D) Nothing. This is an error.
سؤال
What is the result of the following expression? 10 + 5 * 3 - 20

A) -5
B) 5
C) 25
D) -50
سؤال
Which of the following cannot be used as identifiers in Java?

A) Variable names
B) Class names
C) Key words
D) All of the above
E) None of the above
سؤال
What is the result of the following expression? 25 / 4 + 4 * 10 % 3

A) 19
B) 5.25
C) 3
D) 7
سؤال
When the + operator is used with strings, it is known as the:

A) Assignment operator
B) String concatenation operator
C) Addition operator
D) Combined assignment operator
سؤال
The term ___________ typically refers to the device that displays console output.

A) Standard output device
B) Central processing unit
C) Secondary storage device
D) Liquid crystal display
سؤال
Which of the following is valid?

A) float y;
Y = 54.9;
B) float y;
Double z;
Z = 934.21;
Y = z;
C) float w;
W = 1.0f;
D) float v;
V = 1.0;
سؤال
This is a value that is written into the code of a program.

A) literal
B) assignment statement
C) variable
D) operator
سؤال
The boolean data type may contain values in the following range of values

A) true or false
B) -128 to + 127
C) - 2,147,483,648 to +2,147,483,647
D) - 32,768 to +32,767
سؤال
Which of the following is not a rule that must be followed when naming identifiers?

A) The first character must be one of the letters a-z, A-Z, and underscore or a dollar sign.
B) Identifiers can contain spaces.
C) Uppercase and lowercase characters are distinct.
D) After the first character, you may use the letters a-z, A-Z, the underscore, a dollar sign, or digits 0-9.
سؤال
Character literals are enclosed in _____; string literals are enclosed in _____.

A) single quotes; single quotes
B) double quotes; double quotes
C) single quotes; double quotes
D) double quotes; single quotes
سؤال
Which one of the following would contain the translated Java byte code for a program named Demo?

A) Demo.java
B) Demo.code
C) Demo.class
D) Demo.byte
سؤال
A Java program must have at least one of these:

A) Class definition
B) Variable
C) Comment
D) System.out.println(); statement
سؤال
In Java, it is standard practice to capitalize the first letter of:

A) Class names
B) Variable names
C) Key words
D) Literals
سؤال
If the following Java statements are executed, what will be displayed? System.out.println("The top three winners are\n");
System.out.print("Jody, the Giant\n");
System.out.print("Buffy, the Barbarian");
System.out.println("Adelle, the Alligator");

A) The top three winners are
Jody, the Giant
Buffy, the Barbarian
Adelle, the Alligator
B) The top three winners are
Jody, the Giant\nBuffy, the BarbarianAdelle, the Alligator
C) The top three winners are Jody, the Giant\nBuffy, the BarbarianAdelle, and the Albino
D) The top three winners are
Jody, the Giant
Buffy, the BarbarianAdelle, the Alligator
سؤال
Which of the following is not a primitive data type?

A) short
B) long
C) float
D) String
سؤال
Every Java application program must have

A) a class named MAIN
B) a method named main
C) comments
D) integer variables
سؤال
What will be displayed as a result of executing the following code? int x = 6;
String msg = "I am enjoying this class.";
String msg1 = msg.toUpperCase();
String msg2 = msg.toLowerCase();
Char ltr = msg.charAt(x);
Int strSize = msg.length();
System.out.println(msg);
System.out.println(msg1);
System.out.println(msg2);
System.out.println("Character at index x = " +
Ltr);
System.out.println("msg has " + strSize +
"characters.");

A) I am enjoying this class.
I AM ENJOYING THIS CLASS.
I am enjoying this class.
Character at index x = e
Msg has 24 characters.
B) I am enjoying this class.
I AM ENJOYING THIS CLASS.
I am enjoying this class.
Character at index x = e
Msg has 25 characters.
C) I am enjoying this class.
I AM ENJOYING THIS CLASS.
I am enjoying this class.
Character at index x = n
Msg has 24 characters.
D) I am enjoying this class.
I AM ENJOYING THIS CLASS.
I am enjoying this class.
Character at index x = n
Msg has 25characters.
سؤال
What is the result of the following expression? 17 % 3 * 2 - 12 + 15

A) 7
B) 8
C) 12
D) 105
سؤال
The primitive data types only allow a(n) _____ to hold a single value.

A) variable
B) object
C) class
D) literal
سؤال
What will be displayed as a result of executing the following code? public class test
{
Public static void main(String[] args)
{
Int value1 = 9;
System.out.println(value1);
Int value2 = 45;
System.out.println(value2);
System.out.println(value3);
Value = 16;
}
}

A) 9
45
16
B) 94516
C) 9 45 16
D) Nothing, this is an error
سؤال
What is the result of the following expression? 25 - 7 * 3 + 12 / 3

A) 6
B) 8
C) 10
D) 12
سؤال
If x has been declared an int, which of the following statements is invalid?

A) x = 0;
B) x = -58932;
C) x = 1,000;
D) x = 592;
سؤال
Variables of the boolean data type are useful for

A) working with small integers
B) evaluating true/false conditions
C) working with very large integers
D) evaluating scientific notation
سؤال
To display the output on the next line, you can use the println method or use this escape sequence in the print method.

A) \n
B) \r
C) \t
D) \b
سؤال
What would be displayed as a result of the following code? int x = 578;
System.out.print("There are " +
X + 5 + "\n" +
"hens in the hen house.");

A) There are 583 hens in the hen house.
B) There are 5785 hens in the hen house.
C) There are x5\nhens in the hen house.
D) There are 5785
Hens in the hen house.
سؤال
What will be displayed after the following statements have been executed? int x = 15, y = 20, z = 32;
X += 12;
Y /= 6;
Z -= 14;
System.out.println("x = " + x +
", y = " + y +
", z = " +z);

A) x = 27, y = 3.333, z = 18
B) x = 27, y = 2, z = 18
C) x = 27, y = 3, z = 18
D) x = 37, y = 14, z = 4
سؤال
This is a named storage location in the computer's memory.

A) Literal
B) Constant
C) Variable
D) Operator
سؤال
What will be the displayed when the following code is executed? final int x = 22, y = 4;
Y += x;
System.out.println("x = " + x +
", y = " + y);

A) x = 22, y = 4
B) x = 22, y = 26
C) x = 22, y = 88
D) Nothing, this is an error
سؤال
Which of the following is not a valid comment statement?

A) // comment 1
B) /* comment 2 */
C) */ comment 3 /*
D) /** comment 4 */
سؤال
Variables are classified according to their

A) value
B) data type
C) names
D) location in the program
سؤال
In the following Java statement what value is stored in the variable name? String name = "John Doe";

A) John Doe
B) The memory address where "John Doe" is located
C) name
D) The memory address where name is located
سؤال
What will be the value of z as a result of executing the following code? int x = 5, y = 28;
Float z;
Z = (float) (y / x);

A) 5.60
B) 5.6
C) 3.0
D) 5.0
سؤال
What will be the value of z after the following statements have been executed? int x = 4, y = 33;
Double z;
Z = (double) (y / x);

A) 8.25
B) 4
C) 8
D) 8.0
سؤال
To print "Hello, world" on the monitor, use the following Java statement

A) SystemOutPrintln("Hello, world");
B) System.out.println{"Hello, world"}
C) System.out.println("Hello, world");
D) Print "Hello, world";
سؤال
Given the declaration double r;, which of the following statements is invalid?

A) r = 326.75;
B) r = 9.4632e15;
C) r = 9.4632E15;
D) r = 2.9X106;
سؤال
Both character literals and string literals can be assigned to a char variable.
سؤال
In Java the variable named total is the same as the variable named Total.
سؤال
Which of the following is a valid Java statement?

A) String str = 'John Doe';
B) string str = "John Doe";
C) string str = 'John Doe';
D) String str = "John Doe";
سؤال
A variable's scope is the part of the program that has access to the variable.
سؤال
Which Scanner class method reads a String?

A) readString()
B) nextString()
C) getString()
D) nextLine()
سؤال
A Java program will not compile unless it contains the correct line numbers.
سؤال
Assuming that pay has been declared a double, the following statement is valid.
pay = 2,583.44;
سؤال
This is a variable whose content is read only and cannot be changed during the program's execution.

A) operator
B) literal
C) named constant
D) reserved word
سؤال
Which of the following does not describe a valid comment in Java?

A) Single line comments, two forward slashes - //
B) Multi-line comments, start with /* and end with */
C) Multi-line comments, start with */ and end with /*
D) Documentation comments, any comments starting with /** and ending with */
سؤال
Which one of the following methods would you use to convert a string to a double?

A) Byte.ParseByte
B) Long.ParseLong
C) Integer.ParseInt
D) Double.ParseDouble
سؤال
If the compiler encounters a statement that uses a variable before the variable is declared, an error will result.
سؤال
Java is a case-insensitive language.
سؤال
Although the dollar sign is a legal identifier character, you should not use it because it is normally used for special purposes.
سؤال
What will be displayed as a result of executing the following code? int x = 8;
String msg = "I am enjoying java.";
String msg1 = msg.toUpperCase();
String msg2 = msg.toLowerCase();
Char ltr = msg.charAt(x);
Int strSize = msg.length();
System.out.println(msg);
System.out.println(msg1);
System.out.println(msg2);
System.out.println("Character at index x = " +
Ltr);
System.out.println("msg has " + strSize +
" characters.");

A) I am enjoying java.
I AM ENJOYING JAVA.
I am enjoying java.
Character at index x = j
Msg has 20 characters.
B) I am enjoying java.
I AM ENJOYING JAVA.
I am enjoying java.
Character at index x = o
Msg has 20 characters.
C) I am enjoying java.
I AM ENJOYING JAVA.
I am enjoying java.
Character at index x = o
Msg has 19 characters.
D) I am enjoying java.
I AM ENJOYING JAVA.
I am enjoying java.
Character at index x = y
Msg has 19 characters.
سؤال
What will be displayed after the following statements have been executed? final double x = 99.0;
X = 54.3;
System.out.println("x = " + x );

A) x = 54.3
B) x = 99
C) x = 153.3
D) Nothing, this is an error.
سؤال
Which of the following statements correctly creates a Scanner object for keyboard input?

A) Scanner kbd = new Scanner(System.keyboard);
B) Scanner keyboard(System.in);
C) Scanner keyboard = new Scanner(System.in);
D) Keyboard scanner = new Keyboard(System.in);
سؤال
Class names and key words are examples of variables.
سؤال
All Java statements end with semicolons.
سؤال
Named constants are initialized with a value, that value cannot be changed during the execution of the program.
سؤال
Which Scanner class method reads an int?

A) readInt()
B) nextInt()
C) getInt()
D) read_int()
سؤال
Programming style includes techniques for consistently putting spaces and indentation in a program so visual cues are created.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/61
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 2: Java Fundamentals
1
What will be displayed as a result of executing the following code? int x = 5, y = 20;
X += 32;
Y /= 4;
System.out.println("x = " + x + ", y = " + y);

A) x = 32, y = 4
B) x = 9, y = 52
C) x = 37, y = 5
D) x = 160, y = 80
C
2
In Java, ___________ must be declared before they can be used.

A) Variables
B) Literals
C) Key words
D) Comments
A
3
To compile a program named First, use the following command:

A) java First.java
B) javac First
C) javac First.java
D) compile First.javac
C
4
In Java, the beginning of a comment is marked with:

A) //
B) ""
C) ;
D) #
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
5
What would be printed out as a result of the following code? System.out.println("The quick brown fox" +
"jumped over the \n"
"slow moving hen.");

A) The quick brown fox jumped over the \nslow moving hen.
B) The quick brown fox jumped over the
Slow moving hen.
C) The quick brown fox
Jumped over the
Slow moving hen.
D) Nothing. This is an error.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
6
What is the result of the following expression? 10 + 5 * 3 - 20

A) -5
B) 5
C) 25
D) -50
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
7
Which of the following cannot be used as identifiers in Java?

A) Variable names
B) Class names
C) Key words
D) All of the above
E) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
8
What is the result of the following expression? 25 / 4 + 4 * 10 % 3

A) 19
B) 5.25
C) 3
D) 7
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
9
When the + operator is used with strings, it is known as the:

A) Assignment operator
B) String concatenation operator
C) Addition operator
D) Combined assignment operator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
10
The term ___________ typically refers to the device that displays console output.

A) Standard output device
B) Central processing unit
C) Secondary storage device
D) Liquid crystal display
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
11
Which of the following is valid?

A) float y;
Y = 54.9;
B) float y;
Double z;
Z = 934.21;
Y = z;
C) float w;
W = 1.0f;
D) float v;
V = 1.0;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
12
This is a value that is written into the code of a program.

A) literal
B) assignment statement
C) variable
D) operator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
13
The boolean data type may contain values in the following range of values

A) true or false
B) -128 to + 127
C) - 2,147,483,648 to +2,147,483,647
D) - 32,768 to +32,767
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
14
Which of the following is not a rule that must be followed when naming identifiers?

A) The first character must be one of the letters a-z, A-Z, and underscore or a dollar sign.
B) Identifiers can contain spaces.
C) Uppercase and lowercase characters are distinct.
D) After the first character, you may use the letters a-z, A-Z, the underscore, a dollar sign, or digits 0-9.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
15
Character literals are enclosed in _____; string literals are enclosed in _____.

A) single quotes; single quotes
B) double quotes; double quotes
C) single quotes; double quotes
D) double quotes; single quotes
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
16
Which one of the following would contain the translated Java byte code for a program named Demo?

A) Demo.java
B) Demo.code
C) Demo.class
D) Demo.byte
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
17
A Java program must have at least one of these:

A) Class definition
B) Variable
C) Comment
D) System.out.println(); statement
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
18
In Java, it is standard practice to capitalize the first letter of:

A) Class names
B) Variable names
C) Key words
D) Literals
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
19
If the following Java statements are executed, what will be displayed? System.out.println("The top three winners are\n");
System.out.print("Jody, the Giant\n");
System.out.print("Buffy, the Barbarian");
System.out.println("Adelle, the Alligator");

A) The top three winners are
Jody, the Giant
Buffy, the Barbarian
Adelle, the Alligator
B) The top three winners are
Jody, the Giant\nBuffy, the BarbarianAdelle, the Alligator
C) The top three winners are Jody, the Giant\nBuffy, the BarbarianAdelle, and the Albino
D) The top three winners are
Jody, the Giant
Buffy, the BarbarianAdelle, the Alligator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
20
Which of the following is not a primitive data type?

A) short
B) long
C) float
D) String
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
21
Every Java application program must have

A) a class named MAIN
B) a method named main
C) comments
D) integer variables
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
22
What will be displayed as a result of executing the following code? int x = 6;
String msg = "I am enjoying this class.";
String msg1 = msg.toUpperCase();
String msg2 = msg.toLowerCase();
Char ltr = msg.charAt(x);
Int strSize = msg.length();
System.out.println(msg);
System.out.println(msg1);
System.out.println(msg2);
System.out.println("Character at index x = " +
Ltr);
System.out.println("msg has " + strSize +
"characters.");

A) I am enjoying this class.
I AM ENJOYING THIS CLASS.
I am enjoying this class.
Character at index x = e
Msg has 24 characters.
B) I am enjoying this class.
I AM ENJOYING THIS CLASS.
I am enjoying this class.
Character at index x = e
Msg has 25 characters.
C) I am enjoying this class.
I AM ENJOYING THIS CLASS.
I am enjoying this class.
Character at index x = n
Msg has 24 characters.
D) I am enjoying this class.
I AM ENJOYING THIS CLASS.
I am enjoying this class.
Character at index x = n
Msg has 25characters.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
23
What is the result of the following expression? 17 % 3 * 2 - 12 + 15

A) 7
B) 8
C) 12
D) 105
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
24
The primitive data types only allow a(n) _____ to hold a single value.

A) variable
B) object
C) class
D) literal
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
25
What will be displayed as a result of executing the following code? public class test
{
Public static void main(String[] args)
{
Int value1 = 9;
System.out.println(value1);
Int value2 = 45;
System.out.println(value2);
System.out.println(value3);
Value = 16;
}
}

A) 9
45
16
B) 94516
C) 9 45 16
D) Nothing, this is an error
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
26
What is the result of the following expression? 25 - 7 * 3 + 12 / 3

A) 6
B) 8
C) 10
D) 12
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
27
If x has been declared an int, which of the following statements is invalid?

A) x = 0;
B) x = -58932;
C) x = 1,000;
D) x = 592;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
28
Variables of the boolean data type are useful for

A) working with small integers
B) evaluating true/false conditions
C) working with very large integers
D) evaluating scientific notation
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
29
To display the output on the next line, you can use the println method or use this escape sequence in the print method.

A) \n
B) \r
C) \t
D) \b
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
30
What would be displayed as a result of the following code? int x = 578;
System.out.print("There are " +
X + 5 + "\n" +
"hens in the hen house.");

A) There are 583 hens in the hen house.
B) There are 5785 hens in the hen house.
C) There are x5\nhens in the hen house.
D) There are 5785
Hens in the hen house.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
31
What will be displayed after the following statements have been executed? int x = 15, y = 20, z = 32;
X += 12;
Y /= 6;
Z -= 14;
System.out.println("x = " + x +
", y = " + y +
", z = " +z);

A) x = 27, y = 3.333, z = 18
B) x = 27, y = 2, z = 18
C) x = 27, y = 3, z = 18
D) x = 37, y = 14, z = 4
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
32
This is a named storage location in the computer's memory.

A) Literal
B) Constant
C) Variable
D) Operator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
33
What will be the displayed when the following code is executed? final int x = 22, y = 4;
Y += x;
System.out.println("x = " + x +
", y = " + y);

A) x = 22, y = 4
B) x = 22, y = 26
C) x = 22, y = 88
D) Nothing, this is an error
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
34
Which of the following is not a valid comment statement?

A) // comment 1
B) /* comment 2 */
C) */ comment 3 /*
D) /** comment 4 */
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
35
Variables are classified according to their

A) value
B) data type
C) names
D) location in the program
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
36
In the following Java statement what value is stored in the variable name? String name = "John Doe";

A) John Doe
B) The memory address where "John Doe" is located
C) name
D) The memory address where name is located
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
37
What will be the value of z as a result of executing the following code? int x = 5, y = 28;
Float z;
Z = (float) (y / x);

A) 5.60
B) 5.6
C) 3.0
D) 5.0
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
38
What will be the value of z after the following statements have been executed? int x = 4, y = 33;
Double z;
Z = (double) (y / x);

A) 8.25
B) 4
C) 8
D) 8.0
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
39
To print "Hello, world" on the monitor, use the following Java statement

A) SystemOutPrintln("Hello, world");
B) System.out.println{"Hello, world"}
C) System.out.println("Hello, world");
D) Print "Hello, world";
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
40
Given the declaration double r;, which of the following statements is invalid?

A) r = 326.75;
B) r = 9.4632e15;
C) r = 9.4632E15;
D) r = 2.9X106;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
41
Both character literals and string literals can be assigned to a char variable.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
42
In Java the variable named total is the same as the variable named Total.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
43
Which of the following is a valid Java statement?

A) String str = 'John Doe';
B) string str = "John Doe";
C) string str = 'John Doe';
D) String str = "John Doe";
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
44
A variable's scope is the part of the program that has access to the variable.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
45
Which Scanner class method reads a String?

A) readString()
B) nextString()
C) getString()
D) nextLine()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
46
A Java program will not compile unless it contains the correct line numbers.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
47
Assuming that pay has been declared a double, the following statement is valid.
pay = 2,583.44;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
48
This is a variable whose content is read only and cannot be changed during the program's execution.

A) operator
B) literal
C) named constant
D) reserved word
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
49
Which of the following does not describe a valid comment in Java?

A) Single line comments, two forward slashes - //
B) Multi-line comments, start with /* and end with */
C) Multi-line comments, start with */ and end with /*
D) Documentation comments, any comments starting with /** and ending with */
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
50
Which one of the following methods would you use to convert a string to a double?

A) Byte.ParseByte
B) Long.ParseLong
C) Integer.ParseInt
D) Double.ParseDouble
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
51
If the compiler encounters a statement that uses a variable before the variable is declared, an error will result.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
52
Java is a case-insensitive language.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
53
Although the dollar sign is a legal identifier character, you should not use it because it is normally used for special purposes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
54
What will be displayed as a result of executing the following code? int x = 8;
String msg = "I am enjoying java.";
String msg1 = msg.toUpperCase();
String msg2 = msg.toLowerCase();
Char ltr = msg.charAt(x);
Int strSize = msg.length();
System.out.println(msg);
System.out.println(msg1);
System.out.println(msg2);
System.out.println("Character at index x = " +
Ltr);
System.out.println("msg has " + strSize +
" characters.");

A) I am enjoying java.
I AM ENJOYING JAVA.
I am enjoying java.
Character at index x = j
Msg has 20 characters.
B) I am enjoying java.
I AM ENJOYING JAVA.
I am enjoying java.
Character at index x = o
Msg has 20 characters.
C) I am enjoying java.
I AM ENJOYING JAVA.
I am enjoying java.
Character at index x = o
Msg has 19 characters.
D) I am enjoying java.
I AM ENJOYING JAVA.
I am enjoying java.
Character at index x = y
Msg has 19 characters.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
55
What will be displayed after the following statements have been executed? final double x = 99.0;
X = 54.3;
System.out.println("x = " + x );

A) x = 54.3
B) x = 99
C) x = 153.3
D) Nothing, this is an error.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
56
Which of the following statements correctly creates a Scanner object for keyboard input?

A) Scanner kbd = new Scanner(System.keyboard);
B) Scanner keyboard(System.in);
C) Scanner keyboard = new Scanner(System.in);
D) Keyboard scanner = new Keyboard(System.in);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
57
Class names and key words are examples of variables.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
58
All Java statements end with semicolons.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
59
Named constants are initialized with a value, that value cannot be changed during the execution of the program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
60
Which Scanner class method reads an int?

A) readInt()
B) nextInt()
C) getInt()
D) read_int()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
61
Programming style includes techniques for consistently putting spaces and indentation in a program so visual cues are created.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 61 في هذه المجموعة.