Python Quiz Answer week 2 | AKTU 2021

Python Quiz Answer week 2 | AKTU 2021


Python Quiz Answer week 2 | AKTU 2021



Q1) If list=[‘red’ , ‘blue’ , ‘green’ , ‘yellow’] , what will be the output of : list.pop() print (list) ?

  • yellow
  • red’, ‘blue’, ‘green’
  • blue’, ‘green’, ‘yellow’
  • error

Explain: the output of .list pop() print (list) is error because this code are wrong .



Q2) If you want to use an item after you remove from what, which function should you use ?

  • del()
  • not possible
  • remove()
  • pop()

Explain :- pop() function should you use.



Q3) If list=[‘suzuki’, ‘subaru’, ‘honda’, ‘maruti’] , what will be the output of print(list[3]), after running the function : list.sort(reverse=True) ?

  • suzuki
  • subaru
  • honda
  • maruti

Reason: the output of honda , Because it is number 3 on the list



Q4) Which statement is correct ?

  • sorted() method sorts the items in ascending order
  • sorted() method maintains the sorted order of the items in the list
  • Both A and B
  • Neither A nor B


Reason : sorted() method is the item of in ascending order .




Q5) Which method is used to arrange the items in a list in ascending order ?

  • sort()
  • arrange()
  • sort(reverse=True)
  • ascend()

Reason : sort() method is used to arrange the item in an ascending order .



Q6) What is used for performing a repetitive tasks in Python ?

  • Counters
  • Lists
  • Arrays
  • Loops

Reason : loops are used for performing a repetitive taska in python.



Q7) How is a line, or a group of lines related to the rest of the program ?

  • square brackets []
  • indentation
  • braces {}
  • parentheses ()

Answer: (b) indentation

Reason : Indentation line a group of lines related to the rest of the program.



Q8) If numbers=[1, 2, 3, 4, 5] , then how to get the largest value of this list ?

  • high(numbers)
  • max(numbers)
  • large(numbers)
  • sum(numbers)

Answer: (b)  max(numbers)

Reason: max (numbers) is used to find any the largest value of in this list.



Q 10) What should come in the blank if we want to print HI! 6 times? for i in range(_____): print(“HI!”)

  • 1,5
  • 1,6
  • 5
  • 1,7


Reason: the answer is 1, 7 time to print HI! .


Q 10) Which of the following is a valid singleton tuple ?

  • single=(1)
  • single=1,
  • single=()
  • single=1


Reason : Single=1 is a valid singleton tuple .




Post a Comment

0 Comments