Quiz

What is the result of 2 + 2 * 5 ** 2?

102 52 400 100 As per the order of operations, exponentiation is evaluated first, then multiplication, then addition.

What is the result of (2 + 2) * 5 ** 2?

102 52 400 100 As per the order of operations, parentheticals are evaluated first, then exponentiation, then multiplication.

What is the result of 102 / 10?

10 2 10.2 2.0 The division of two integers returns an integer.

What is the result of 102 / 10.0?

10 2 10.2 2.0 The division of one or more floats returns a float.

What is the result of 102 % 10?

10 2 10.2 2.0 The modulo operator returns the remainder of integer division.

What is the result of 4.5.ceil?

4 5 4.0 5.0 The ceil method rounds up to the nearest integer.

What is the result of 4.5.floor?

4 5 4.0 5.0 The floor method rounds down to the nearest integer.

What is the result of 4.5.round?

4 5 4.0 5.0 The round method rounds to the nearest integer and rounds up if the fractional part of the float is .5.

What is the result of 4.5.to_i?

4 5 4.0 5.0 The to_i method rounds down to the nearest integer.

What is the result of 4.to_f?

4 5 4.0 5.0 The to_f method type converts an integer to a float.

What is the result of 5.to_s?

5 5.0 "5.0" "5" The to_s method type converts an object to a string.

What is the result of false.to_s?

0 true "false" false The to_s method type converts an object to a string, regardless of that object's data type.

results matching ""

    No results matching ""