
maths + java-visual
Authored by ANIL KUMAR
Education
Professional Development

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
79 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Which of the following methods is used to return the smallest possible value (mathematical integer) which is either greater or equal to the argument passed?
ceil()
atan()
copySign()
cosh()
Answer explanation
The answer is A. ceil(). The ceil() method returns the smallest possible value (mathematical integer) which is either greater or equal to the argument passed. This can be seen in the image, where the description for the ceil() method says: "Smallest possible value (mathematical integer) which is ether greater or equal to the argument passed".
2.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What is the output of the following Java program?
0.0, 0.0
NaN, NaN
Infinity, Infinity
-Infinity, -Infinity
Answer explanation
The reason for this is that the first expression, Math.pow(x, y), evaluates to NaN because the first operand, x, is equal to -0.0, which is a non-zero number that is less than zero. The second expression, Math.pow(a, b), also evaluates to NaN because the first operand, a, is equal to Double.NEGATIVE_INFINITY, which is a non-finite number.
3.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What is the output of the following code snippet?
-4, -6, -4, -5, -4, 0
-6, -4, -5, -4, -4, 0
-4, -4, -5, -5, -4, 0
-6, -6, -5, -5, -4, 0
Answer explanation
The reason for this is that the Math.max() method returns the greater of two values, and the Math.min() method returns the smaller of two values. In the code snippet, the values of a, b, and c are all negative. Therefore, the Math.max() method will always return a, and the Math.min() method will always return c. The value of d is 0, so it will be greater than a and less than c.
4.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What is the output of the following code snippet?
10, 10
10, 10.0
10, 10f
10, 10.0f
Answer explanation
The reason for this is that the Math.abs() method returns the absolute value of a number. In the code snippet, the value of Valuel is 10, which is positive. Therefore, the Math.abs() method will return the same value, which is 10. The value of Valuef is 10f, which is a float. The Math.abs() method will return the absolute value of Valuef, which is 10.0f.
5.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What is the output of the following code snippet?
-8.3048106211022167, -0.9524129884151565, 0.320048383379563
0.320048383379563, -0.9524129884151565, -8.3048106211022167
-0.9524129884151565, -8.3048106211022167, 0.320048383379563
-8.3048106211022167, 0.320048383379563, -0.9524129884151565
Answer explanation
The reason for this is that the Math.sin() method returns the sine of the angle, the Math.cos() method returns the cosine of the angle, and the Math.tan() method returns the tangent of the angle. In the code snippet, the value of a is -68, which is a negative number. Therefore, the sine of a is -8.3048106211022167, the cosine of a is -0.9524129884151565, and the tangent of a is 0.320048383379563.
6.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What is the output of the following code snippet?
10.0, 5.0
5.0, 10.0
15.0, 0.0
0.0, 15.0
Answer explanation
The reason for this is that the Math.max() method returns the greater of two values, and the Math.min() method returns the smaller of two values. In the code snippet, the values of a and b are both positive. Therefore, the Math.max() method will return a, which is 10.0, and the Math.min() method will return b, which is 5.0.
7.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What is the output of the following code snippet?
Java
int a = 10;
int b = 5;
int c = 0;
System.out.println(Math.gcd(a, b));
System.out.println(Math.gcd(a, c));
Use code with caution. Learn more
5, 0
10, 0
5, 10
0, 10
Answer explanation
The reason for this is that the Math.gcd() method returns the greatest common divisor of two numbers. In the code snippet, the greatest common divisor of a and b is 5, and the greatest common divisor of a and c is 0.
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?
Similar Resources on Wayground
74 questions
LONG QUIZ ST-DIMENSION
Quiz
•
Professional Development
77 questions
UJIAN NASIONAL TECHNOPLAST
Quiz
•
Professional Development
77 questions
PGCC
Quiz
•
Professional Development
75 questions
Rita4,5 PM
Quiz
•
University - Professi...
77 questions
KTMT - CH01 - Biểu diễn thông tin
Quiz
•
Professional Development
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Education
10 questions
How to Email your Teacher
Quiz
•
Professional Development
6 questions
3RD GRADE DECLARATION OF INDEPENDENCE EXIT TICKET
Quiz
•
Professional Development
19 questions
Black History Month Trivia
Quiz
•
6th Grade - Professio...
22 questions
Multiplying Exponents with the Same Base
Quiz
•
9th Grade - Professio...
40 questions
Flags of the World
Quiz
•
KG - Professional Dev...