
Java Quiz-2
Authored by Techtorial Academy
Professional Development
Professional Development
Used 68+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following code?
40, 30
40, 40
30, 40
30, 30
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following code?
15, 25
15, 15
25, 15
25, 25
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following code?
12.0, 12.0
15.0, 12
Compile Error
15.0, 15.0
Answer explanation
We can not assign double into the int variable. It will give the compile-time error.
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which one will NOT compile?
byte b1; byte b2;
int K, int L;
short s1, s2, s3 = 5;
long L1 = 4, L2, L3 = 7;
Answer explanation
When we declare the variable with the data type, we don't need to provide the data type again. That's why --> int K, int L; <-- will give a compile-time error. We should do --> int K, L ; <--
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
If one value is int and the other is decimal, java will automatically promote int to the decimal point value's data type
True
False
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What will be the data type for x / y?
short
byte
int
long
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the data type of x / y * z?
long
double
float
short
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?