Quiz Discussion

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

['hello', 'morning'][bool('')]

 

Course Name: Python

  • 1]

    morning

  • 2]

    hello

  • 3]

    no output

  • 4]

    error

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?

4^12

 

  • 1]

    2

  • 2]

    4

  • 3]

    8

  • 4]

    12

Solution
2
Discuss

Which of the following represents the bitwise XOR operator?

  • 1]

    !

  • 2]

    |

  • 3]

    ^

  • 4]

    &

Solution
3
Discuss

Which of the following expressions can be used to multiply a given number ‘a’ by 4?

  • 1]

    a>>4

  • 2]

    a>>2

  • 3]

    a<<4

  • 4]

    a<<2

Solution
4
Discuss

Any odd number on being AND-ed with ________ always gives 1. Hint: Any even number on being AND-ed with this value always gives 0.

  • 1]

    10

  • 2]

    2

  • 3]

    1

  • 4]

    0

Solution
5
Discuss

What will be the value of x in the following Python expression, if the result of that expression is 2?

x>>2

 

  • 1]

    1

  • 2]

    2

  • 3]

    4

  • 4]

    8

Solution
6
Discuss

The expression 2**2**3 is evaluates as: (2**2)**3.

  • 1]

    True

  • 2]

    False

Solution
7
Discuss

Which of the following expressions results in an error?

  • 1]

    int(’10.8’)

  • 2]

    float(’10.8’)

  • 3]

    int(‘10’)

  • 4]

    float(‘10’)

Solution
8
Discuss

Which among the following list of operators has the highest precedence?

 +, -, **, %, /, <<, >>, |

 

  • 1]

    %

  • 2]

    |

  • 3]

    **

  • 4]

    <<, >>

Solution
9
Discuss

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

bool(‘False’)
bool()

 

  • 1]
    True
    True
  • 2]

    False
    True

  • 3]

    True
    False

  • 4]

    False
    False

Solution
10
Discuss

What will be the output of the following Python code?

l=[1, 0, 2, 0, 'hello', '', []]
list(filter(bool, l))

 

  • 1]

    [1, 2, ‘hello’]

  • 2]

    [1, 0, 2, ‘hello’, ”, []]

  • 3]

    [1, 0, 2, 0, ‘hello’, ”, []]

  • 4]

    Error

Solution
# Quiz