Question
QUESTION 16 Of the following types, which one cannot store the value 2? A. Int B. Byte C. Float D. Char E. all of these
QUESTION 16
-
Of the following types, which one cannot store the value 2?
A. Int
B. Byte
C. Float
D. Char
E. all of these can store this value
2 points
QUESTION 17
-
A typecast is required in which of the following situations?
A. storing an int in a double
B. storing an int in a float
C. storing a float in a double
D. storing a double in an int
E. all of the above require casts
2 points
QUESTION 18
-
If x is an int and y is a float, all of the following are legal except which assignment statement?
A. y = x;
B. x = y;
C. y = (float) x;
D. x = (int) y;
E. all of the above are legal
2 points
QUESTION 19
-
In order to create a constant, you would use which of the following Java reserved words?
A. private
B. static
C. const
D. final
E. class
2 points
QUESTION 20
-
The relationship between a class and an object is best described as:
A. classes are instances of objects
B. objects are instances of classes
C. objects and classes are the same thing
D. classes are programs while objects are variables
E. objects are the instance data of classes
2 points
QUESTION 21
-
The following statement will output ___ lines of text:
System.out.print("1 big bad wolf"); System.out.println(" 8 the 3 little pigs"); System.out.println(" 4 dinner 2 night");
A. 1
B. 2
C. 3
D. 4
E. 5
2 points
QUESTION 22
-
What will be the result of the following assignment statement? All variables are integers.
Assume b = 5 and c = 10.
a = b * (-c + 2) / 2;
A. 30
B. 30
C. 20
D. 20
E. 6
2 points
QUESTION 23
-
System.out.println(x+y);
What is output of the above statement if x and y are int values where x=10 and y=5?
A. 10 5
B. 105
C. 15
D. x+y
E. xy
2 points
QUESTION 24
-
Assume the following code is correct and will execute. How many times will the following loop iterate?
int x = 10; while (x > 0) { System.out.println(x); x - -; }
A. 0 times
B. 1 time
C. 9 times
D. 10 times
E. 11 times
2 points
QUESTION 25
-
Consider the following class definition. Assume it is correct and will execute..
public class NextThreeQuestions
{
public static void main(String[ ] args)
{
System.out.print("Here");
System.out.println("There " + "Everywhere");
System.out.println("But not" + "in Paris Texas");
}
}
The program will print the word "Here" and then print:
A. "There Everywhere" on the line after "Here"
B. "There" on the line after "Here" and "Everywhere" on the line after "There"
C. "There Everywhere" on the same line as "Here"
D. "ThereEverywhere" on the same line as "Here"
E. "ThereEverywhere" on the line after "Here"
2 points
QUESTION 26
-
Consider the following class definition. Assume it is correct and will execute..
public class NextThreeQuestions
{
public static void main(String[ ] args)
{
System.out.print("Here");
System.out.println("There " + "Everywhere");
System.out.println("But not" + "in Paris Texas");
}
}
The final println command will output:
A. "But not in Paris Texas"
B. "But notin Paris Texas"
C. "But not" on one line and "in Paris Texas" on the next line
D. "But not+in Paris Texas"
E. "But not + in Paris Texas"
2 points
QUESTION 27
-
Consider the following class definition. Assume it is correct and will execute..
public class NextThreeQuestions
{
public static void main(String[ ] args)
{
System.out.print("Here");
System.out.println("There " + "Everywhere");
System.out.println("But not" + "in Paris Texas");
}
}
How many lines of output are provided by this program?
A. 1
B. 2
C. 3
D. 4
E. 5
2 points
QUESTION 28
-
Java is an object-oriented programming language.
True
False
2 points
QUESTION 29
-
System.out.print is used in a program to denote that a comment follows.
True
False
2 points
QUESTION 30
-
The word public is a reserved word.
True
False
2 points
QUESTION 31
-
Reserved words in Java can be redefined by the programmer to mean something other than their original intentions.
True
False
2 points
QUESTION 32
-
A double has more precision than a float and a float has more precision than an int.
True
False
2 points
QUESTION 33
-
In Java, a and A are considered to be different values.
True
False
2 points
QUESTION 34
-
Only difficult programming problems require a pseudocode solution before the programmer creates the implementation (code) itself.
True
False
2 points
QUESTION 35
-
In Java, the symbol = and the symbol == are used synonymously (interchangeably).
True
False
2 points
QUESTION 36
-
The statement { } is a legal block.
True
False
2 points
QUESTION 37
-
An IF statement may or may not have an ELSE clause, but an ELSE clause must be part of an IF statement.
True
False
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started