Question 10.05 pts What will the value of x be after the following statements ar
ID: 3911883 • Letter: Q
Question
Question 10.05 pts
What will the value of x be after the following statements are executed?
double a, b, c, x;
a = 5;
b = 3;
c = 6;
if ( a <= c ){
x = 1;
} else if ( c > b ) {
x = 2;
} else {
x = 3;
}
Flag this Question
Question 20.05 pts
What will the value of x be after the following statements are executed?
double a, b, c, x;
a = 5;
b = 3;
c = 6;
if ( a <= c ) {
x = 1;
}
if ( c > b ) {
x = 2;
}
if ( x > b ) {
x = 3;
}
Flag this Question
Question 30.05 pts
Which of the following is NOT a Java relational operator?
Flag this Question
Question 40.05 pts
Which of the following is true?
When using == to compare reference variables, you are testing for "identity equality" -- that the two variables refer to the same object.
The .equals() method tests for "content equality" -- that the objects are considered equivalent to each other.
Flag this Question
Question 50.05 pts
What symbols does Java use to create block statements (a 'block' of code)?
Flag this Question
Question 60.05 pts
Which of the following operators may NOT be used with operands of type boolean?
Flag this Question
Question 70.05 pts
What is a common use for a variable of type boolean?
Flag this Question
Question 80.05 pts
What is a common name for a method that returns type boolean?
Flag this Question
Question 90.05 pts
Which of the following data types is NOT valid for the switch expression in a switch instruction?
Flag this Question
Question 100.05 pts
If a break statement is not included at the end of each action (alternative) in a switch instruction, what is the result?
Flag this Question
Question 110.05 pts
The switch instruction is a more general-purpose (more versatile) tool than the if instruction.
Flag this Question
Question 120.05 pts
You are writing a program that will allow a user to enter a single word identifying her 'sign' in the Chinese zodiac (e.g. "Dog") and then show some information about that sign. Obviously a decision must be made in this program. Which selection structure(s) could you use?
Flag this Question
Question 130.05 pts
What numerical value for x will cause the following expression to evaluate to true.
x > 5 || x < 9
Flag this Question
Question 140.05 pts
Which of the following is a legal Java expression?
Flag this Question
Question 150.05 pts
Which of the following operators has the highest precedence?
Flag this Question
Question 160.05 pts
Which of the following is true in Java?
I. Every else must have a preceding if.
II. Every if must have a following else.
Flag this Question
Question 170.05 pts
What kind of loop is a data validation loop?
Flag this Question
Question 180.05 pts
Which loop control structure can NOT be used if there are conditions under which the body of the loop should be executed zero times?
Flag this Question
Question 190.05 pts
You know that a for loop is usually the best choice for a counting loop, but which other loop control structure(s) could possibly be used to create a counting loop?
Flag this Question
Question 200.05 pts
Consider the following class definition:
public class Woog{
public static void main (String[] a){
Fiddle f = new Fiddle();
...
}
}
How would you describe the relationship between Fiddle and Woog?
0Explanation / Answer
As per the chegg guidelines answered first 4 questions
10. answer: 1
Explanation:
a=5,b=3,c=6
if(a<=c) condition satisfied so following block of code will execute
s0 x=1 will be set
so x vales will be 1
20.answer: 2
Explanation:
if(a<=c) condition failed because (5<=6) failed
if(c>b) i.e (6>3) satisfied so x=2 will be set
30.answer: =
Explanation:
Java has six relational operators that compare two numbers and return a boolean value. The relational operators are <, >, <=, >=, ==, and !=.
40.answer: I and II both are true
Explanation:
We can use == operators for reference comparison and .equals() method for content comparison. In simple words, == checks if both objects point to the same memory location whereas .equals() evaluates to the comparison of values in the objects.
50.answer: { }
Explanation: block of code will be written in { and }
60.answer:
90.answer: double
Explanation: A switch works with the byte, short, char, and int primitive data types ,Floating point numbers are not a good candiates for switch
100.Answer: more than one action may execute
110.Answer:True
120.Answer:a switch statement should be used
130.x=7
140.2 <= n && n < 5
150.%
160.I
190.a while loop
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.