Exam 2: Using Data
Exam 1: Creating Java Programs61 Questions
Exam 2: Using Data67 Questions
Exam 3: Using Methods Classes and Objects66 Questions
Exam 4: More Object Concepts66 Questions
Exam 5: Making Decisions66 Questions
Exam 6: Looping66 Questions
Exam 7: Characters Strings and the Stringbuilder68 Questions
Exam 8: Arrays66 Questions
Exam 9: Advanced Array Concepts66 Questions
Exam 10: Introduction to Inheritance66 Questions
Exam 11: Advanced Inheritance Concepts66 Questions
Exam 12: Exception Handling66 Questions
Exam 13: File Input and Output66 Questions
Exam 14: Introduction to Swing Components66 Questions
Exam 15: Advanced Gui Topics66 Questions
Exam 16: Graphics66 Questions
Select questions type
Explain how you can override a unifying type imposed by Java. Show an example.
Free
(Essay)
4.9/5
(43)
Correct Answer:
You can purposely override the unifying type imposed by Java by performing a type cast. Type casting forces a value of one data type to be used as a value of another type. To perform a type cast, you use a cast operator, which is created by placing the desired result type in parentheses. Using a cast operator is an explicit conversion. The cast operator is followed by the variable or constant to be cast.
Example:
double bankBalance = 189.66;
float weeklyBudget = (float) (bankBalance / 4);
You can create a confirm dialog box with five arguments.
Free
(True/False)
4.9/5
(38)
Correct Answer:
True
Write the statement to declare an uninitialized integer value for salesAmt . Then write the statement to declare a constant named SALESAMT with a value of 20.99.
Free
(Essay)
4.9/5
(37)
Correct Answer:
int salesAmt ;
final double SALESAMT = 20.99;
A(n) ____ dialog box typically displays the options Yes, No, and Cancel.
(Multiple Choice)
4.8/5
(29)
Describe how to use the boolean data type. Show two examples of a boolean variable assignment; one that uses true or false and one that uses a relational operator.
(Essay)
4.9/5
(38)
In Java, ____ is a built-in class that provides you with the means for storing and manipulating character strings.
(Multiple Choice)
4.8/5
(37)
Match each term with the correct statement below.
Correct Answer:
Premises:
Responses:
(Matching)
4.9/5
(36)
A data item is ____ when it cannot be changed while a program is running.
(Multiple Choice)
4.8/5
(43)
Which of the following is NOT a component of a variable declaration statement?
(Multiple Choice)
5.0/5
(32)
You can store any character, including nonprinting characters such as a backspace or a tab, in a(n) ____ variable.
(Multiple Choice)
4.7/5
(29)
Primitive types serve as the building blocks for more complex data types, called ____ types.
(Multiple Choice)
4.9/5
(42)
What is an escape sequence and why would a Java programmer use it to store a character?
(Essay)
4.8/5
(42)
____ refers to the order in which values are used with operators.
(Multiple Choice)
4.8/5
(29)
Describe the error message that will be produced when the following code is compiled.
public class SalesOct
{
public static void main(String[] args)
{
int salesAmt;
System.out.print("October sales are $");
System.out.println(salesAmt);
}
}
(Essay)
5.0/5
(39)
public class EndValue
{
public static void main(String[] args)
{
int aByte = 940;
System.out.print("The ending value is "+ aByte);
}
}
When the above code is compiled, what error message will be generated and why?
(Essay)
4.9/5
(34)
Describe how the Scanner class works with the System.in object in order to provide flexibility. Provide an example of using the Scanner class with System.in.
(Essay)
4.8/5
(33)
When you write programs that accept ____________________, there is a risk that the user will enter the wrong type of data.
(Short Answer)
4.8/5
(38)
Showing 1 - 20 of 67
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)