Python QUIZ 2


Q:1. If list=['red','blue','green','yellow'], What will be the output of :   
           
list.pop('blue')
           print(list)
Answer : Error

Q:2. Which function will remove an item from a list?
Answer : All of the above

Q :3. If list=['suzuki','subaru','honda','maruti']

        what will be the output of : print(list[3]) after running the code :                                                                                 list.sort(reverse=True)?
Answer : honda

Q :4. Which statement is correct?
Answer : Both A and B

Q :5. Which method is used to arrange the items of a list in ascending order in Python?
Answer : sort()

Q :6. Which of the following is used for performing repetitive tasks in Python?
Answer : Loops

Q :7. How is a line, or a group of lines, related to the rest of the Python program?
Answer : Indentation

Q :8. If numbers=[1,2,3,4,5] then how to get the largest value of this list?
Answer: max(numbers)

Q :9.What should come in place of X if we want to print HI! 6 times?
          for i in range(X) :
                Print("HI!")

Answer : 1,7

Q :10. Which of the following is a valid singleton tuple?
Answer : single=1,



No comments:

Post a Comment