Deck 2: Programming Building Blocks- Java Basics

ملء الشاشة (f)
exit full mode
سؤال
There are __________ bytes in a long integer data type.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
User-defined words in Java:

A) are used as identifiers.
B) consist of keywords used in Java instruction.
C) are not case-sensitive.
D) include two special data values, true and false.
سؤال
Blocks are required for class and concrete method definitions. They consist of 0, 1, or more statements, start with a left curly brace, and end with a right curly brace.
سؤال
Any of Java's reserved words can be used as identifiers.
سؤال
Which of the following is a primitive data type in Java?

A) Byte
B) Float
C) Char
D) All of these are correct.
سؤال
Which of the following is not true about assigning values?

A) Assigning a value is optional when the constant is defined.
B) You must assign a value before the constant is used in a program.
C) A constant's value can be reassigned three times or fewer in a program.
D) Attempting to change the value of a constant will generate a compiler error.
سؤال
Variables need to be declared twice so they can be used in your program: once at the beginning and then at the end of the program.
سؤال
Because Unicode characters are encoded as unsigned numbers using 16 bits, a char variable is stored in two bytes of memory.
سؤال
What is operator precedence?

A) A set of rules to determine the order in which the operations should be performed
B) Operands used to perform a function
C) A variable or a constant having a data type compatible with the value of the expression
D) A system that recognizes the importance of the programmer in designing the operands
سؤال
Division with two integer operands is performed in the Arithmetic Logic Unit (ALU), which can only calculate an integer result.
سؤال
It is legal to assign a float value to a double. Which of these statement pairs is not valid?

A) float salesTax = .05f;
B) double taxRate = .05;
C) float salesTax = taxRate;
D) double taxRate = salesTax;
سؤال
How can you create a String literal that includes a newline character?

A) Java provides a set of escape sequences that can be used to include a special character within String and char literals.
B) Declare the variables before you use them.
C) Use the + operator.
D) Use /*.
سؤال
If you specify that a data item is a double (a double-precision floating-point number), then the compiler will allocate 16 bytes of memory and store its value as an IEEE 754 floating-point number.
سؤال
The arithmetic operation 7x + 2y can be written without using parentheses.
سؤال
A boolean data type can hold only one value: true.
سؤال
Java is case-sensitive, so although True is a reserved word, true is not.
سؤال
Java identifiers must start with a(n) _________ and may contain any combination of letters and digits, but no spaces.
سؤال
______ is reserved as a special code for "not a character."
سؤال
The mod operator % returns the __________ of the division between two numbers.
سؤال
In addition to having the same name as the class name, each Java source code file must have a(n) _________extension.
سؤال
Which one of these is not a primitive data type?

A) int
B) double
C) bool
D) long
E) char
سؤال
The result of 3 / 2 is:

A) 1.
B) 1.5.
C) 3.
D) 2.
E) 0.
سؤال
The result of 9 % 2 is:

A) 1.
B) 4.5.
C) 4.
D) 2.
E) 0.
سؤال
The result of 3.0 / 2 is:

A) 1.
B) 1.5.
C) 3.
D) 2.
E) 0.
سؤال
The result of (double) ( 3 / 2 ) is:

A) 1.0.
B) 1.5.
C) 3.0.
D) 2.0.
E) 0.0.
سؤال
The result of (double) 3 / 2 is:

A) 1.0.
B) 1.5.
C) 3.0.
D) 2.0.
E) 0.0.
سؤال
helloWorld is a valid identifier.
سؤال
int9 is a valid identifier.
سؤال
char is a valid identifier.
سؤال
2008taxRate is a valid identifier.
سؤال
tax Rate is a valid identifier.
سؤال
A double is more precise than a float.
سؤال
* is a unary operator.
سؤال
The Java keyword for a constant is __________.
سؤال
The two floating point data types are __________ and float.
سؤال
char values are surrounded by __________ quotes.
سؤال
String literals are surrounded by __________ quotes.
سؤال
A Java escape sequence starts with a(n) __________.
سؤال
The division operator / returns the __________ of the division between two numbers.
سؤال
Describe two ways to introduce a comment.
سؤال
Compare and contrast single-precision and double-precision floating-point data types.
سؤال
When you declare a variable, with an assignment operator (=) with the following syntax:
dataType variableName = initialValue;
How would you read the sentence?
سؤال
Would it be better to use doubles or floats for calculations to scale up recipes to feed three times as many people as the recipes are written to serve?
سؤال
What are three ways to add 1 to an int variable named number?
سؤال
Assuming number is an int variable, write a statement using a shortcut operator equivalent to this one:
number = number * 5;
سؤال
Rewrite the following into one statement:
int age;
age = 32;
سؤال
You want to insert the comment "Java is better than ice cream." Identify two ways to include this comment in your code.
سؤال
What are some advantages of using variables?
سؤال
Compare the variable identifiers numberOfStudentsPassing and winners. Describe which would be preferable in a program that evaluates success of a teaching program.
سؤال
Sam wants to calculate whether his students simply passed or failed. He uses a char variable, because student grades are A through F. Is this the best data type to use? Why or why not?
سؤال
One way to specify an initial value for a variable (variable 1) is to assign the variable the value of another variable (variable 2). Explain why it is not valid to assign variable 1 as a double and variable 2 as a float.
سؤال
What will happen if your String literal is longer than one line?
سؤال
List two errors in the following statement:
System.out.println( "Remember the slogan "Click It or Ticket" and buckle
your seatbelt before driving your car." );
سؤال
How would you create an indented poem in a String literal statement?
سؤال
Would it be better to write PI or 3.14159 in an arithmetic expression?
سؤال
In which order should the computer do the following calculation? Solve the expression.
int dimes = 2 * 20 + 5 * 10 + 3 * 5;
سؤال
What does the shortcut ++ do?
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/57
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 2: Programming Building Blocks- Java Basics
1
There are __________ bytes in a long integer data type.
8
2
User-defined words in Java:

A) are used as identifiers.
B) consist of keywords used in Java instruction.
C) are not case-sensitive.
D) include two special data values, true and false.
A
3
Blocks are required for class and concrete method definitions. They consist of 0, 1, or more statements, start with a left curly brace, and end with a right curly brace.
True
4
Any of Java's reserved words can be used as identifiers.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
5
Which of the following is a primitive data type in Java?

A) Byte
B) Float
C) Char
D) All of these are correct.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
6
Which of the following is not true about assigning values?

A) Assigning a value is optional when the constant is defined.
B) You must assign a value before the constant is used in a program.
C) A constant's value can be reassigned three times or fewer in a program.
D) Attempting to change the value of a constant will generate a compiler error.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
7
Variables need to be declared twice so they can be used in your program: once at the beginning and then at the end of the program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
8
Because Unicode characters are encoded as unsigned numbers using 16 bits, a char variable is stored in two bytes of memory.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
9
What is operator precedence?

A) A set of rules to determine the order in which the operations should be performed
B) Operands used to perform a function
C) A variable or a constant having a data type compatible with the value of the expression
D) A system that recognizes the importance of the programmer in designing the operands
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
10
Division with two integer operands is performed in the Arithmetic Logic Unit (ALU), which can only calculate an integer result.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
11
It is legal to assign a float value to a double. Which of these statement pairs is not valid?

A) float salesTax = .05f;
B) double taxRate = .05;
C) float salesTax = taxRate;
D) double taxRate = salesTax;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
12
How can you create a String literal that includes a newline character?

A) Java provides a set of escape sequences that can be used to include a special character within String and char literals.
B) Declare the variables before you use them.
C) Use the + operator.
D) Use /*.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
13
If you specify that a data item is a double (a double-precision floating-point number), then the compiler will allocate 16 bytes of memory and store its value as an IEEE 754 floating-point number.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
14
The arithmetic operation 7x + 2y can be written without using parentheses.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
15
A boolean data type can hold only one value: true.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
16
Java is case-sensitive, so although True is a reserved word, true is not.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
17
Java identifiers must start with a(n) _________ and may contain any combination of letters and digits, but no spaces.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
18
______ is reserved as a special code for "not a character."
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
19
The mod operator % returns the __________ of the division between two numbers.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
20
In addition to having the same name as the class name, each Java source code file must have a(n) _________extension.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
21
Which one of these is not a primitive data type?

A) int
B) double
C) bool
D) long
E) char
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
22
The result of 3 / 2 is:

A) 1.
B) 1.5.
C) 3.
D) 2.
E) 0.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
23
The result of 9 % 2 is:

A) 1.
B) 4.5.
C) 4.
D) 2.
E) 0.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
24
The result of 3.0 / 2 is:

A) 1.
B) 1.5.
C) 3.
D) 2.
E) 0.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
25
The result of (double) ( 3 / 2 ) is:

A) 1.0.
B) 1.5.
C) 3.0.
D) 2.0.
E) 0.0.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
26
The result of (double) 3 / 2 is:

A) 1.0.
B) 1.5.
C) 3.0.
D) 2.0.
E) 0.0.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
27
helloWorld is a valid identifier.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
28
int9 is a valid identifier.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
29
char is a valid identifier.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
30
2008taxRate is a valid identifier.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
31
tax Rate is a valid identifier.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
32
A double is more precise than a float.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
33
* is a unary operator.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
34
The Java keyword for a constant is __________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
35
The two floating point data types are __________ and float.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
36
char values are surrounded by __________ quotes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
37
String literals are surrounded by __________ quotes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
38
A Java escape sequence starts with a(n) __________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
39
The division operator / returns the __________ of the division between two numbers.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
40
Describe two ways to introduce a comment.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
41
Compare and contrast single-precision and double-precision floating-point data types.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
42
When you declare a variable, with an assignment operator (=) with the following syntax:
dataType variableName = initialValue;
How would you read the sentence?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
43
Would it be better to use doubles or floats for calculations to scale up recipes to feed three times as many people as the recipes are written to serve?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
44
What are three ways to add 1 to an int variable named number?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
45
Assuming number is an int variable, write a statement using a shortcut operator equivalent to this one:
number = number * 5;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
46
Rewrite the following into one statement:
int age;
age = 32;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
47
You want to insert the comment "Java is better than ice cream." Identify two ways to include this comment in your code.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
48
What are some advantages of using variables?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
49
Compare the variable identifiers numberOfStudentsPassing and winners. Describe which would be preferable in a program that evaluates success of a teaching program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
50
Sam wants to calculate whether his students simply passed or failed. He uses a char variable, because student grades are A through F. Is this the best data type to use? Why or why not?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
51
One way to specify an initial value for a variable (variable 1) is to assign the variable the value of another variable (variable 2). Explain why it is not valid to assign variable 1 as a double and variable 2 as a float.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
52
What will happen if your String literal is longer than one line?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
53
List two errors in the following statement:
System.out.println( "Remember the slogan "Click It or Ticket" and buckle
your seatbelt before driving your car." );
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
54
How would you create an indented poem in a String literal statement?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
55
Would it be better to write PI or 3.14159 in an arithmetic expression?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
56
In which order should the computer do the following calculation? Solve the expression.
int dimes = 2 * 20 + 5 * 10 + 3 * 5;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
57
What does the shortcut ++ do?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 57 في هذه المجموعة.