NEW
Font size
Worksheetsmaths + java-visual
Total questions: 79
Worksheet time: 26mins
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()
What is the output of the following Java program?
0.0, 0.0
NaN, NaN
Infinity, Infinity
-Infinity, -Infinity
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
What is the output of the following code snippet?
10, 10
10, 10.0
10, 10f
10, 10.0f
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
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
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
What is the maximum value that can be generated by the rand() method in the code snippet shown in the image?
10
18
20
25
What is the purpose of the scanner variable in the code snippet shown in the image?
To scan a document.
To scan a barcode.
To get input from the user.
To print output to the console.
What is the result of the Math.pow(2, 10) function in the image?
1024
1000
10
2
What is the output of the code snippet shown in the image?
16
25
36
49
What is the value of the variable result after the code snippet is executed?
3
4
5
6
What is the return type of the pow() method?
int
long
double
float
What is the purpose of the abs() method?
To calculate the absolute value of a number.
To calculate the square root of a number.
To calculate the logarithm of a number.
To calculate the trigonometric value of a number.
What is the output of the code snippet shown in the image?
1
0
-1
NaN
What is the value of the variable intValAbs after the code snippet is executed?
123
-123
0
NaN
What is the output of the code snippet shown in the image?
Error
0
1
5
Which of the following methods returns the smallest integer that is greater than or equal to the argument?
Math.ceil()
Math.floor()
Math.max()
Math.min()
What is the output of the code snippet shown in the image?
10
11
12
13
What is the purpose of the sqrt() method?
To calculate the square root of a number.
To calculate the absolute value of a number.
To calculate the logarithm of a number.
To calculate the trigonometric value of a number.
Which of the following variables are static?
a
b
c
a and c
Which of the following methods is not a method of the Math class?
pow()
ceil()
floor()
sqrt()
Which of the following methods returns the absolute value of a number?
abs()
ceil()
floor()
round()
What is the output of the code snippet shown in the image?
5
10
15
20
What is the purpose of the random() method?
To generate a random integer.
To generate a random floating-point number.
To generate a random number between 0 and 1.
To generate a random number between 0 and the specified maximum value.
What is the output of the code snippet shown in the image?
3
5
7
9
What is the purpose of the ceil() method?
To return the ceiling of a number.
To return the floor of a number.
To return the round of a number.
To return the absolute value of a number.
Which of the following methods returns the smallest integer that is greater than or equal to the specified number?
ceil()
floor()
round()
max()
What is the range of numbers that can be generated by the Math.random() method?
0 to 1
0 to 100
-100 to 100
-10000 to 10000
Which of the following methods is used to calculate the square root of a number?
sqrt()
pow()
abs()
ceil()
Which of the following methods is used to calculate the maximum of two numbers?
max()
min()
abs()
ceil()
Which of the following methods is used to calculate the absolute value of a number?
abs()
round()
ceil()
floor()
Which of the following methods returns the smallest integer that is greater than or equal to the specified number?
ceil()
floor()
round()
max()
Which of the following methods returns the largest integer that is less than or equal to the specified number?
ceil()
floor()
round()
max()
What is the output of the code snippet shown in the image?
3
3.5
4
5
What is the output of the code snippet shown in the image?
4
5
6
7
What is the output of the code snippet shown in the image?
10
11
12
13
Which method in the Java Math class returns the square root of a number?
abs()
ceil()
floor()
sqrt()
Which of the following methods in the Java Math class is used to calculate the absolute value of a number?
abs()
ceil()
floor()
max()
Which of the following methods returns the smallest integer that is greater than or equal to the specified number?
ceil()
floor()
round()
max()
What is the output of the code snippet shown in the image?
3
3.5
4
5
Which of the following methods returns the smallest integer that is greater than or equal to the specified number?
ceil()
floor()
round()
max()
Which of the following methods returns the largest integer that is less than or equal to the specified number?
ceil()
floor()
round()
max()
What is the output of the code snippet shown in the image?
3
6
9
12
What is the output of the code snippet shown in the image?
3.14
6.28
9.42
12.56
What is the expected value of the random variable shown in the image?
0
5
10
15
What is the maximum value of the random variable shown in the image?
0
5
15
10
What is the output of the code snippet shown in the image?
4
NaN
0
1
Which method in the Java Math class returns the smallest integer that is greater than or equal to the specified number?
ceil()
floor()
round()
max()
Which of the following methods in the Java Math class returns the rounded value of the specified number?
ceil()
floor()
round()
max()
What is the output of the code snippet shown in the image?
4
5
6
7
What is the output of the code snippet shown in the image?
3
4
5
6
What is the quadrant of the point (-4, 2)?
Quadrant I
Quadrant II
Quadrant III
Quadrant IV
What is the value of "2+" in Java?
2
4
22
Error
What is the output of the Java program shown in the image?
1
2
3
4
What is the name of the method that is being used to multiply two numbers in the Java code in the image?
multiply()
multiplyExact()
multiplyLong()
multiplyDouble()
Which of the following rounding methods is used by the isPowerOfTwo() method in the image?
Rounding towards zero
Rounding towards positive infinity
Rounding towards negative infinity
Rounding to the nearest even integer
What is the purpose of the program in the image?
To calculate the total number of people in a class.
To calculate the average number of girls and boys in a class.
To calculate the difference between the number of girls and boys in a class.
To print the number of girls and boys in a class.
What is the output of the following code?
23.7
0
-23.7
NaN
What is the trend of the time taken by the Math.exp() function as the input value increases?
The time taken increases linearly.
The time taken increases exponentially.
The time taken decreases linearly.
The time taken decreases exponentially.
Which of the following functions is represented by the graph in the image?
y = log(x)
y = log10(x)
y = loge(x)
y = x
What is the circumference of the circle in the image?
10π
20π
30π
40π
What is the name of the class that is being used to represent a number shape in the image?
Number
Shape
Rectangle
Circle
What is the output of the following Java code?
1.0, -1.0, 0.0
1.0, 1.0, 0.0
-1.0, -1.0, 0.0
0.0, 0.0, 0.0
Which of the following methods is used to round a number to the nearest integer?
Math.round()
Math.ceil()
Math.floor()
Math.trunc()
What is the purpose of the Calculator.java program in the image?
To calculate the natural logarithm (base e) of a number.
To calculate the base 10 logarithm of a number.
To calculate the greater value of two numbers.
To raise a number to the power of another number.
What is the output of the following Java code?
3.141592653589793, 2.718281828459045
2.718281828459045, 3.141592653589793
1.0, 2.0
NaN, Infinity
What is the output of the following Java code?
int x = 10;
int y = 20;
System.out.println(Math.max(x, y));
10
20
30
NaN
What is the output of the following Java code?
1.5625
-1.5625
4.21E-16
NaN
What is the output of the following Java code?
Javaint x = 10;
int y = 10;
System.out.println(Math.max(x, y) == Math.min(x, y));
TRUE
FALSE
NaN
Infinity
What is the output of the following Java code?
double x = 10.0;
double y = 10.0;
System.out.println(Math.abs(x - y));
0
10
0.0
NaN
Which of the following functions is faster?
Math.mean()
FastMath.mean()
Both are equally fast
It depends on the input data
What is the output of the following Java code?
int[] data = {1, 2, 3, 4, 5};
int maxValue = Arrays.stream(data).max().getAsInt();
System.out.println(maxValue);
5
4
3
2
What is the return type of the Integer.parseInt() method?
int
double
float
long
What is the name of the Java math library that focuses on number theory and integer factorization?
Tilman Neumann/java-math-library
Java Math Library
Math library
Number theory library
The exponential and logarithmic methods are used to perform different operations on numbers. Which of the following operations is performed by the exponential method?
Reduce the value of the first argument to zero to the power of the second argument.
Reduce the value of the second argument to zero to the power of the first argument.
Increase the value of the first argument to the power of the second argument.
Decrease the value of the first argument to the power of the second argument.
Which of the following programming languages is best suited for image processing?
Java
Python
C++
MATLAB
What is the value of y after the code is executed?
-4
-2
0
2
What is the maximum x-value of the graph in the image?
0
5
10
20
