Deck 2: Console Input and Output
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/29
العب
ملء الشاشة (f)
Deck 2: Console Input and Output
1
The printf method can be used to output multiple formatted values.
True
2
Write ONE Java statement to display your first and last name on two separate lines.
System.out.print"Wally\nWonders");
3
Which statement or group of statements produces the output: Java programming is fun!
A)System.out.printJava programming); System.out.printis fun!);
B)System.out.printlnJava programming is fun!);
C)System.out.println"Java programming"); System.out.println" is fun!");
D)System.out.print"Java programming") System.out.println" is fun!");
A)System.out.printJava programming); System.out.printis fun!);
B)System.out.printlnJava programming is fun!);
C)System.out.println"Java programming"); System.out.println" is fun!");
D)System.out.print"Java programming") System.out.println" is fun!");
D
4
What does the following code output? DecimalFormat percent = new DecimalFormat"0.00%");
System.out.printlnpercent.format0.308));
A)3.080%
B)30.80%
C).0308%
D)308.0%
System.out.printlnpercent.format0.308));
A)3.080%
B)30.80%
C).0308%
D)308.0%
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
5
Efficiency is lost in importing the entire package instead of importing the classes you use.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
6
The statement: System.out.printf"%6.2f",597.7231);displays:
A)597.723
B)597.72
C)000597.72
D)None of the above
A)597.723
B)597.72
C)000597.72
D)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
7
The Java method printf is based on the ________ language.
A)Pascal
B)C++
C)C
D)ADA
A)Pascal
B)C++
C)C
D)ADA
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
8
If a hyphen is added after the % in a format specifier,the output will be _________.
A)Left justified
B)Right justified
C)Centered
D)None of the above
A)Left justified
B)Right justified
C)Centered
D)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
9
The new line character is represented as '\n'.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
10
Echoing input is good programming practice because it can reveal problems in the input.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
11
The class NumberFormat allows you to specify a constant representing which country's currency format should be used.To use this constant you must import:
A)java.util.Locale
B)java.util.Currency
C)java.util.Properties
D)None of the above.
A)java.util.Locale
B)java.util.Currency
C)java.util.Properties
D)None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
12
Write Java statements to apply currency formatting to the number 100.Indicate the package you need to import.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
13
The method printf is used the same way as the method println but has the added feature that allows you to add formatting instructions.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
14
Valid arguments to the System.out object's println method include:
A)"Anything with double quotes"
B)String variables
C)Variables of type int
D)All of the above
A)"Anything with double quotes"
B)String variables
C)Variables of type int
D)All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
15
What Java package includes the class Scanner?
A)awt
B)swing
C)io
D)util
A)awt
B)swing
C)io
D)util
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
16
Standard code libraries in Java are called:
A)Methods
B)Classes
C)Packages
D)Statements
A)Methods
B)Classes
C)Packages
D)Statements
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
17
What does the following code output? DecimalFormat dfQuestion = new DecimalFormat"#0.##E0");
System.out.printlndfQuestion.format12.7896987));
A)12.79E0
B)12.8E0
C)1.28E1
D).13E2
System.out.printlndfQuestion.format12.7896987));
A)12.79E0
B)12.8E0
C)1.28E1
D).13E2
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
18
The Scanner class has a method next that allows an entire line of string text to be read.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
19
Write a Java statement to display your name in the console window.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
20
Every Java program automatically imports the java.util package.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
21
Explain the significance of the pattern string used by the DecimalFormat object,and give an example of a valid pattern.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
22
What do the format specifiers d,f,e,g,s and c represent?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
23
If there is no loss of efficiency in importing an entire Java package instead of importing only classes you use into your program,why would you not just import the entire package?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
24
Why is echoing user input a good programming practice?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
25
Write a complete Java console application that prompts the user for two numbers,multiplies the numbers,and then displays the result to the user.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
26
Write a Java program to create and display 57.32% using the DecimalFormat class.Include the necessary import statement to use the DecimalFormat class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
27
Write a Java statement to create and initialize a Scanner object named input.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
28
What does it mean to prompt the user?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck
29
What is whitespace and why is it import when reading input from the keyboard using the Scanner class?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 29 في هذه المجموعة.
فتح الحزمة
k this deck