Python Programming 2nd Week Quiz Solution - 2021 / 2020

 


                                         Python Programming 2nd Week Quiz Solution


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


(a): yellow

(b): red’, ‘blue’, ‘green’

(c): blue’, ‘green’, ‘yellow’

(d): error


Answer:(d) error

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




[2] If you want to use an item after you remove from what, which function should you use?


(a): del()

(b): not possible

(c): remove()

(d): pop()

Answer: (d) pop()

Explain :- pop() function should you use.


Subscribe Our Youtube Channel Amit Tech ...



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


(a): suzuki

(b): subaru

(c): honda

(d): maruti

Answer(c) honda


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


                             




[4] Which statement is correct?


(a): sorted() method sorts the items in ascending order

(b): sorted() method maintains the sorted order of the items in the list

(c): Both A and B

(d): Neither A nor B

Answer: (a) sorted() method sorts the items in ascending order


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


TO More Information , So Please Join My Youtube Channel 


                           



[5] Which method is used to arrange the items in a list in ascending order?


(a): sort()

(b): arrange()

(c): sort(reverse=True)

(d): ascend()


Answer: (a) sort()


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


[6] What is used for performing a repetitive tasks in Python?


(a): Counters

(b): Lists

(c): Arrays

(d): Loops

Answer: (d) loops


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


[7] How is a line, or a group of lines related to the rest of the program?


(a): square brackets []

(b): indentation

(c): braces {}

(d): parentheses ()

Answer: (b) indentation


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




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


(a): high(numbers)

(b): max(numbers)

(c): large(numbers)

(d): sum(numbers)


Answer: (b)  max(numbers)


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


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


(a): 1,5

(b): 1,6

(c): 5

(d): 1,7

Answer: (d) 1,7

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



[10] Which of the following is a valid singleton tuple?


(a): single=(1)

(b): single=1,

(c): single=()

(d): single=1

Answer:(b) single=1


Explain :- single=1 is a valid singleton truple .

Post a Comment

16 Comments

  1. 2nd question me 2nd option 'not possible' nhi 'all of the above' hai prutor pe.....& all of the above is correct option

    ReplyDelete
  2. Replies
    1. ok but chek again the question ( answer is right )

      Delete