96). What will be the output of the following Python code snippet?
X=”hi”
print(“05d”%X)

[A]00000hi
[B]000hi
[C]hi000
[D]error

Show Answer

97). What will be the output of the following Python code snippet?
X=”san-foundry”
print(“%56s”,X)

[A]56 blank spaces before san-foundry
[B]56 blank spaces before san and foundry
[C]56 blank spaces after san-foundry
[D]no change

Show Answer

99). What will be the output of the following Python expression if X=345?
print(“%06d”%X)

[A]345000
[B]000345
[C]000000345
[D]345000000

Show Answer

100). Which of the following formatting options can be used in order to add ‘n’ blank spaces after a given string ‘S’?
print(“%06d”%X)

[A]print(“-ns”%S)
[B]print(“-ns”%S)
[C]print(“%ns”%S)
[D]print(“%-ns”%S)

Show Answer

101). What will be the output of the following Python expression if X = -122?
print("-%06d"%x)

[A]-000122
[B]000122
[C]–00122
[D]-00122

Show Answer

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

[A]34.00
[B]34.0000
[C]34.000000
[D]34.00000000

Show Answer

103). What will be the output of the following Python expression if x=56.236?
print("%.2f"%x)

[A]56.00
[B]56.24
[C]56.23
[D]0056.236

Show Answer

104). What will be the output of the following Python expression if x=22.19?
print("%5.2f"%x)

[A]22.1900
[B]22.00000
[C]22.19
[D]22.20

Show Answer

105). The expression shown below results in an error.
print("-%5d0",989)

[A]True
[B]False
[C]none
[D]1

Show Answer