PROGRAMMING CORRECT 100%
The relational operators || and && (OR and AND) are called _____ operators
1.Empty
2.Divisional
3.Boolean
4.Binary - ANSWER Boolean
Explanation
They are called Boolean because they test for a true/false condition. However, all
relational operators are basically used to check if a condition is true. Is the pay rate less
than 50? If it is (true), then do some processing. Still, we call the AND and OR operators
Boolean to separate them from the other operators.
Which data type is 1-bit in size?
1.boolean
2.long
3.char
4.short - ANSWER 1. Boolean
Explanation
Data type boolean is 1-bit in size and it holds value true or false. The default is false.
What kind of data type will you use for an object 'Pen'?
1. int
2.char
3.long
4.class - ANSWER class class class class class class class class class class class
class class class class class class class
Explanation
A class is a user-defined data type. Hence 'class' is the correct answer.
Which of the following is a double in Java?
1. x = 0.123456789123456789123;
2. x = 5f;
3. x = 1.234567891234567;
4.x = 0. 0.12345f; - ANSWER 3. x = 1.234567891234567;
Explanation
A double in Java can store a maximum of 16 digits after the decimal. So if there are
more than 16 digits, Java will show an error. When f is appended to the decimal value
the data is stored as a float, not a double.
Which of the following is an example of a floating point data type in Java?
1. x = -4.56899f;
2. x = 2.3;
, 3. x = 4/0;
4. x = -0.1; - ANSWER x= -4.56899f;
Floating point data types in Java are represented by appending the letter f to the end of
the decimal. If the letter f is not appended, Java considers the number as a double.
Floating point data types in Java are represented by appending the letter f to the end of
the decimal. If the letter f is not appended, Java considers the number as a double.
Floating point data types in Java are represented by appending the letter f to the end of
the decimal. If the letter f is not appended, Java considers the number as a double.
Java constants are usually named with upper case letters with an underscore between
words. However, which of the following would also compile as the name for a constant?
1. Last Name
2. If Else
3. ifElse
4. If - ANSWER ifElse. ifElse. ifElse. ifElse. ifElse. ifElse. ifElse. ifElse. ifElse. ifElse.
int myNumber;
What is the value of myNumber in the following code?
0
NULL
Undefined
-1 - ANSWER zero. zero. zero. zero. zero. zero. zero. zero. zero. zero.
Explanation
Remember that the default value for short, int, or long is 0.
Which of the following is included in a Java API?
1. Encryption
2. JavaScript plug-ins
3 Classes and methods
4. USB Connector - ANSWER Classes and methods. Classes and methods. Classes
and methods. Classes and methods. Classes and methods. Classes and methods.
Classes and methods. Classes and methods. Classes and methods. Classes and
methods.
Explanation
An API is a package: Included within the package are interfaces and classes, each with
methods, fields and constructors.
Which of the following correctly imports only the FileFilter interface of the java.io API?
1. import java.FileFilter.*;
2. import java.io.*;
3. import java.*.FileFilter;
4. import java.io.FileFilter; - ANSWER 4. import java.io.FileFilter;
import java.io.FileFilter; import java.io.FileFilter; import java.io.FileFilter; import
java.io.FileFilter; import java.io.FileFilter; import java.io.FileFilter; import