Quiz Discussion

The expression shown below results in an error.

print("-%5d0",989)

 

Course Name: Python

  • 1]

    True

  • 2]

    False

Solution
No Solution Present Yet

Top 5 Similar Quiz - Based On AI&ML

Quiz Recommendation System API Link - https://fresherbell-quiz-api.herokuapp.com/fresherbell_quiz_api

# Quiz
1
Discuss

What will be the output of the following Python expression if X=345?

print(“%06d”%X)

 

  • 1]

    000000345

  • 2]

    000345

  • 3]

    345000

  • 4]

    345000000

Solution
2
Discuss

What will be the output of the following Python expression if X = -122?

print("-%06d"%x)

 

  • 1]

    -00122

  • 2]

    –00122

  • 3]

    000122

  • 4]

    -000122

Solution
3
Discuss

Which of the following formatting options can be used in order to add ‘n’ blank spaces after a given string ‘S’?

  • 1]

    print(“-ns”%S)

  • 2]

    print(“-ns”%S)

  • 3]

    print(“%ns”%S)

  • 4]

    print(“%-ns”%S)

Solution
4
Discuss

What will be the output of the following Python expression if the value of x is 34?

print(“%f”%x)

 

  • 1]

    34.00000000

  • 2]

    34.000000

  • 3]

    34.0000

  • 4]

    34.00

Solution
5
Discuss

What will be the output of the following Python expression if x=22.19?

print("%5.2f"%x)

 

  • 1]

    22.20

  • 2]

    22.19

  • 3]

    22.00000

  • 4]

    22.1900

Solution
6
Discuss

What will be the output of the following Python code snippet?

X=”hi”
print(“05d”%X)

 

  • 1]

    error

  • 2]

    hi000

  • 3]

    000hi

  • 4]

    00000hi

Solution
7
Discuss

What will be the output of the following Python expression if x=56.236?

print("%.2f"%x)

 

  • 1]

    0056.236

  • 2]

    56.23

  • 3]

    56.24

  • 4]

    56.00

Solution
8
Discuss

What will be the output of the following Python expression if x=456?

print("%-06d"%x)

 

  • 1]

    000456

  • 2]

    456

  • 3]

    456000

  • 4]

    error

Solution
# Quiz