Python Quiz 4


 Q:1. How do you declare a dictionary in Python>

Answer : 2. dict={"key":"value"}

Q:2. What will be the output of the following code:

         dict={x:x for x in range(1,2)}

         print(dict)

Answer : 4. {1:1}

Q:3. In Python 3.x, which of the following statement is true for following code:

        age=input("please enter your age")

Answer : 4. None of the above

Q:4. What will be the output of the following program?

         int=5

         while(int<=-1):

                   print(int)

                   int=int-1

Answer : 2. blank(nothing will be printed)

Q:5. What will be the output of the following program?

        int=3

        while(int>=2):

                 print(int)

                 int=1

Answer : 1. 3


No comments:

Post a Comment