Java
For the following, state whether the following statement is true or false, if false explain the reason briefly and state the complete, correct statement.
a) Data type boolean is compatible with, and can be converted to, any other data type.
b) Java automatically converts primitive types into their class wrapper objects.
c) In creating objects using default constructors, class instance variables are initialized to their default values.
a) False Except boolean, all the remaining 7 data types can be assigned to one another either implicitly or explicitly. boolean is incompatible for conversion. we can only assign a boolean value to another boolean. b) True c) True
Java For the following, state whether the following statement is true or false, if false explain...
Java For the following, state whether the following statement is true or false, if false explain the reason briefly and state the complete, correct statement. a) When an object has a reference to another serializable object, these objects must implement the Serializable interface separately b) Static fields in a class implementing the Serializable interface are serialized by default c) Classes ObjectInputStream and ObjectOutputStream in package java.io provide read/write of byte based representation of file information
Part Two: Fill in the Blanks and True/False (24 total points - 2 points each) For each of the following, fill in the most appropriate word(s)phrase/solution in each blank 1) Keywords, identifiers and literals are all kinds of are simply groups of characters that are used for various purposes in a program. , which 2) The Java expression: 11 - 2 + 3 evaluates to 3) List the Java boolean (logical) operators in order from highest priority to lowest priority...
Which four of the following statements are true? Generic code only works with values of reference types. Autoboxing is when a reference type is automatically converted into the corresponding primitive type. Java will always add a default constructor to any class that you define All exceptions in Java implement the Thwable interface Generic algorithms allow you to write code that can operate on arguments of multiple different types. The type wrapper for the int primitive type is called Int A...
Which of the four are true? a). Generic code only works with values of reference types. b). Autoboxing is when a reference type is automatically converted into the corresponding primitive type. c). Java will always add a default constructor to any class that you define. d). All exceptions in Java implement the Throwable interface. e). Generic algorithms allow you to write code that can operate on arguments of multiple different types f). The type wrapper for the int primitive type...
JAVA :The following are descriptions of classes that you will create. Think of these as service providers. They provide a service to who ever want to use them. You will also write a TestClass with a main() method that fully exercises the classes that you create. To exercise a class, make some instances of the class, and call the methods of the class using these objects. Paste in the output from the test program that demonstrates your classes’ functionality. Testing...
Question 2 [5 points) State if each of the below statements is True or False 1 2 3 The Compiler skips comments. A function can return a value of type array. An array index starts with 1. Pass by value is the default in CH, except when passing arrays as arguments to function The default storage class for local variables is static. A pointer provides an indirect means of accessing the value of a particular data item The logical operators...
Question 22 4 pts In the statement: Int'. p and q are pointer variables. True False D Question 23 4 pts If a user-defined class object that uses mathematical operators to pass to the template function, the class must contain code for the primitive data types the constructor the overloaded operators the try/catch blocks Question 24 4 pts Afriend function is a function that is not part of a class but has access to the class's private members as well...
Java - Object Oriented Programming
Declare a class named Customer that has two private fields? Write a set method to make sure that if age > 125 years or less than 0 then it is set to 0 (default value) What does it indicate when declaring a class's instance variables with private access modifier? What is the role of a constructor? The data part of by an object's instance variables is known as? Do all methods have to always return...
QUESTION 1 Each class must be declared in its own .java file True or False? QUESTION 2 The keyword this must always be explicitly used when referring to an object's instance variables and methods from within one of its non-static methods. True or False? QUESTION 3 When used in a class' main method the this keyword references the object representing the class itself. True or False? QUESTION 4 Accessor methods that test whether a condition is true or false are...
State whether the following statement is true or false, and explain why. If the statement is false, state the true change. If the national economy shrank at an annual rate of 9% per year for four consecutive years, then the economy shrank by 36% over the four-year period. Choose the correct answer below and, if necessary, fill in the answer box to complete your choice. The statement is false because each year there is a different reference value. The economy...