Python Numbers

Last Updated :
Discuss
Comments

Question 1

What is the output of print(type(5))?

  • A

    <class 'int'>

  • B

    <class 'float'>

  • C

    <class 'str'>

  • D

    <class 'num'>

Question 2

What type of number is 3.14 in Python?

  • A

    Integer

  • B

    Complex

  • C

    Float

  • D

    String

Question 3

How to express the number 5 raised to the power 2 in Python?

  • A

    5 * 5

  • B

    5 ** 2

  • C

    5 ^ 2

  • D

    2**5

Question 4

What will be the result of the operation (1 + 2j) * (3 + 4j)?

  • A

    -5 + 10j

  • B

    11 + 10j

  • C

    10 + 11j

  • D

    -10 + 11j

Question 5

Which function in Python can convert the string '123' to the integer 123?

  • A

    str(123)

  • B

    int('123')

  • C

    float('123')

  • D

    convert('123')

Question 6

What is the result of 10 % 3?

  • A

    3.33

  • B

    1

  • C

    0.33

  • D

    3

Question 7

How can you express one million as a literal in Python?

  • A

    1,000,000

  • B

    1000000

  • C

    1_000_000

  • D

    B and C

Question 8

Which function will you use to find the absolute value of a number in Python?

  • A

    abs()

  • B

    fabs()

  • C

    absolute()

  • D

    all()

Question 9

Which of the following is used to represent infinity in Python?

  • A

    inf

  • B

    infinity

  • C

    float('inf')

  • D

    None of the above

Question 10

How to find the base-2 logarithm of 16 in Python?

  • A

    math.log2(16)

  • B

    math.log(16, 2)

  • C

    math.ln(16)

  • D

    Both A and B

There are 10 questions to complete.

Take a part in the ongoing discussion