Question: QUESTION 1 In a mixed - type arithmetic calculation involving one operand with a data type of byte and another operand with a data type

QUESTION 1
In a mixed-type arithmetic calculation involving one operand with a data type of byte and another operand with a data type of char, the operand with the data type char will be promoted to which (if any) data type:
byte
int
char
double
10 points
QUESTION 2
What is the output of the following code:
int b =7;
System.out.println(++b);
8
6
The code above will result in an error.
7
10 points
QUESTION 3
What is the output of the following code:
int x =7;
int y =4;
System.out.println(x / y);
1
1.75
3
10 points
QUESTION 4
What is the output of the following code:
double x =7.0;
double y =0.0;
System.out.println(x / y);
Infinity
This will generate a run-time exception and not actually produce any output.
NaN (Not a Number)
0.0
10 points
QUESTION 5
What is the output of the following code:
int x =9;
int y =5;
double z = x / y;
System.out.println(z);
4
1.0
1.8
1
10 points
QUESTION 6
What is the output of the following code:
char c ='7';
int x =14;
System.out.println(x / c);
0
This code will not compile or will produce an error.
2
2.0
10 points
QUESTION 7
What is the output of the following code:
int x =7;
int y =4;
System.out.println(x % y);
3
1
175%
1.75
10 points
QUESTION 8
What is the output of the following code:
int x =7;
int y =4;
System.out.println((double) x / y);
1
3
1.75
.75
10 points
QUESTION 9
When using floating-point division, dividing by zero (0) results in an exception (i.e., a runtime error).
True
False
4 points
QUESTION 10
An expression is a combination of operators and operands that evaluate to a single value.
True
False
4 points
QUESTION 11
Specifically instructing to compiler to convert the type of variable is known as implicit type casting.
True
False
4 points
QUESTION 12
The modulus (%) operator will calculate the remainder of division.
True
False
4 points
QUESTION 13
Operators which take only one operand are referred to as binary operators.
True
False
4 points
QUESTION 14
Identify all (there may be more than one correct answer) of the following code examples that will increase the value of an int variable (with the identifier x) by 1:
x +=1;
++x;
x =1+ x;
x = x +1;
x++;
10 points
QUESTION 15
Which (select all correct answers) of the following operators has/have the least precedence:
*
%
-
+
=

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!