# What will be the output of the following Python code '{0:.2f}'.format(1.234)

1.  ‘1’

2.  ‘1.234’

3.  ‘1.23’

4.  ‘1.2’

4

‘1.23’

Explanation :
No Explanation available for this question

# What will be the output of the following Python code '%x %d' %(255, 255)

1.  ‘ff, 255’

2.  ‘255, 255’

3.  ‘15f, 15f’

4.  Error

4

‘ff, 255’

Explanation :
No Explanation available for this question

# The output of the two codes shown below is the same. i. '{0:.2f}'.format(1/3.0) ii. '%.2f'%(1/3.0)

1.  True

2.  False

2

True

Explanation :
No Explanation available for this question

# What will be the output of the following Python code l=list('HELLO') 'first={0[0]}, third={0[2]}'.format(l)

1.  ‘first=H, third=L’

2.  ‘first=0, third=2’

3.  Error

4.  ‘first=0, third=L’

4

‘first=H, third=L’

Explanation :
No Explanation available for this question

# What will be the output of the following Python code l=list('HELLO') p=l[0], l[-1], l[1:3] 'a={0}, b={1}, c={2}'.format(*p)

1.  Error

2.  “a=’H’, b=’O’, c=(E, L)”

3.  “a=H, b=O, c=[‘E’, ‘L’]”

4.  Junk value

4

“a=H, b=O, c=[‘E’, ‘L’]”

Explanation :
No Explanation available for this question

# The formatting method {1:

1.  first, right

2.  second, left

3.  first, left

4.  second, right

4

second, left

Explanation :
No Explanation available for this question

# What will be the output of the following Python code hex(255), int('FF', 16), 0xFF

1.  [0xFF, 255, 16, 255]

2.  (‘0xff’, 155, 16, 255)

3.  Error

4.  (‘0xff’, 255, 255)

4

(‘0xff’, 255, 255)

Explanation :
No Explanation available for this question

# The output of the two codes shown below is the same. i. bin((2**16)-1) ii. '{}'.format(bin((2**16)-1))

1.  True

2.  False

2

True

Explanation :
No Explanation available for this question

# What will be the output of the following Python code '{a}{b}{a}'.format(a='hello', b='world')

1.  ‘hello world’

2.  ‘hello’ ‘world’ ‘hello’

3.  ‘helloworldhello’

4.  ‘hello’ ‘hello’ ‘world’

4

‘helloworldhello’

Explanation :
No Explanation available for this question

# What will be the output of the following Python code D=dict(p='san', q='foundry') '{p}{q}'.format(**D)

1.  Error

2.  sanfoundry

3.  san foundry

4.  {‘san’, ‘foundry’}

4