Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Modulo operator (Bonus)

Total questions: 21

Worksheet time: 7mins

Name
Class
Date
1.
What is the purpose of the modulus operator (%) in Java?
a)
a) Calculates the quotient of integer division.
b)
b) Calculates the remainder of integer division.
c)
c) Multiplies two numbers.
d)
d) Adds two numbers.
2.
What is the role of the '%' modulus operator in Python?
a)
a) Calculates the sum of two numbers.
b)
b) Multiplies two numbers.
c)
c) Yields the quotient of integer division.
d)
d) Yields the remainder after integer division.
3.
How is modulus added in Java?
a)
a) Using the '*' operator to perform division.
b)
b) Using the '//' operator to calculate the remainder.
c)
c) Using the '%' operator to calculate the remainder.
d)
d) Using the '^' operator to perform addition.
4.
What is the value of 1 mod 10 in Java?
a)
a) 0
b)
b) 10
c)
c) 1
d)
d) 9
5.
What type of operator is the modulus (%) in Python?
a)
a) Logical operator
b)
b) Assignment operator
c)
c) Arithmetic operation
d)
d) Bitwise operator
6.
How is the modulus symbol (%) used in Java?
a)
a) To multiply two numbers.
b)
b) To divide two numbers.
c)
c) To find the absolute value of a number.
d)
d) To divide and obtain the remainder.
7.
How can the modulus value be printed in Java?
a)
a) Use the 'System.out.print()' method.
b)
b) Use the 'Math.abs()' function.
c)
c) Use the 'print()' function from the 'math' package.
d)
d) Use the 'printf()' method.
8.
Is the percent (%) symbol used as the modulus operator in various programming languages?
a)
a) Yes
b)
b) No
9.
What symbol represents the modulus?
a)
a) '| |'
b)
b) '[]'
c)
c) '()'
d)
d) '{}'
10.
What is the value of 0 mod 3 in Java?
a)
a) 3
b)
b) 0
c)
c) 1
d)
d) 2
11.
What is the value of 0 mod 2 in Java?
a)
a) 0
b)
b) 1
c)
c) 2
d)
d) 3
12.
Which data type does the modulo (%) work with in Java?
a)
a) Decimal datatype
b)
b) Integer datatype
c)
c) Float datatype
d)
d) Character datatype
13.
What does 1 / 2 return in Java?
a)
a) 0
b)
b) 0.5
c)
c) 1
d)
d) 2
14.
In Java, which operations are evaluated before addition and subtraction?
a)
a) Multiplication, division, and modulus
b)
b) Exponentiation, addition, and subtraction
c)
c) Modulus, multiplication, and subtraction
d)
d) Division, addition, and exponentiation
15.
How is 2 calculated in Java?
a)
a) Math. 2
b)
b) Math.pow(2, n)
c)
c) 2 * n
d)
d) 2 ** n
16.
How can the modulus of two numbers be obtained in Python?
a)
a) Use the 'mod()' method.
b)
b) Use the 'modulus()' function.
c)
c) Use the 'math.mod()' function.
d)
d) Use the 'fmod()' function from the 'math' package.
17.
What does the 'max(int a, int b)' function in Java return?
a)
a) The sum of two int values.
b)
b) The product of two int values.
c)
c) The greater of two int values.
d)
d) The smaller of two int values.
18.
What do modulus rules define?
a)
a) Rules for bitwise operations.
b)
b) Rules for conditional statements.
c)
c) Rules for modulus function with real numbers.
d)
d) Rules for division of large numbers.
19.
Can modulus be added in modular arithmetic?
a)
a) No, it is not allowed.
b)
b) Yes, various properties of addition with modulus are explained.
c)
c) It is only allowed in specific cases.
d)
d) Modulus cannot be used with addition.
20.
What does the modulus operator (%) in C do?
a)
a) Adds two numbers.
b)
b) Subtracts two numbers.
c)
c) Multiplies two numbers.
d)
d) Finds the remainder after division.
21.
What is modulus called?
a)
a) Constant
b)
b) Coefficient
c)
c) Modulus
d)
d) Elasticity