# Welcome to the Formatting and Decorators MCQs Page

Dive deep into the fascinating world of Formatting and Decorators with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Formatting and Decorators, a crucial aspect of Python. In this section, you will encounter a diverse range of MCQs that cover various aspects of Formatting and Decorators, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Python.

Check out the MCQs below to embark on an enriching journey through Formatting and Decorators. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Python.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Formatting and Decorators. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

### Formatting and Decorators MCQs | Page 1 of 6

Q1.
What is the output of the code snippet shown below?
X=”hi”
print(“05d”%X)

Q2.
Consider the snippet of code shown below and predict the output.
X=”compsci-bits”
print(“%56s”,X)

Answer: (a).56 blank spaces before compsci-bits
Q3.
What is the output of the following expression if x=456?
print("%-06d"%x)

Q4.
What is the output of the following expression if X=345?
print(“%06d”%X)

Q5.
Which of the following formatting options can be used in order to add ‘n’ blank spaces after a given string ‘S’?
Q6.
What is the output of this expression if X= -122?
print("-%06d"%x)

Q7.
What is the output of the following expression if the value of x is 34?
print(“%f”%x)

Q8.
What is the result of the expression shown below if x=56.236?
print("%.2f"%x)

Q9.
What is the output of this expression if x=22.19?
print("%5.2f"%x)

print("-%5d0",989)