What is the answer to this expression, 22 % 3 is?
a) 7
b) 1
c) 0
d) 5
Explanation: Modulus operator gives the remainder. So, 22%3 gives the remainder, that is, 1.
Mathematical operations can be performed on a string.
a) True
b) False
Explanation: You can’t perform mathematical operation on string even if the string is in the form: ‘1234…’.
Operators with the same precedence are evaluated in which manner?
a) Left to Right
b) Right to Left
c) Can’t say
d) None of these
What is the output of this expression, 3*1**3?
a) 27
b) 9
c) 3
d) 1
Explanation: First this expression will solve 1**3 because exponential has higher precedence than multiplication, so 1**3 = 1 and 3*1 = 3. Final answer is 3.
Which one of the following has the same precedence level?
a) Addition and Subtraction
b) Multiplication, Division and Addition
c) Multiplication, Division, Addition and Subtraction
d) Addition and Multiplication
Explanation: “Addition and Subtraction” are at the same precedence level. Similarly, “Multiplication and Division” are at the same precedence level. However, Multiplication and Division operators are at a higher precedence level than Addition and Subtraction operators.
The expression Int(x) implies that the variable x is converted to integer.
a) True
b) False
Explanation: Int(x) converts the datatype of the variable to integer and is the example of explicit data conversion.