Python Programming Quiz 9th Week Quiz Solution 2020 | python quiz 9 solution 2020

 python quiz 9 solution 2020




 1. if we have a file object as fileobj, then what does the attribute 'closed' will tell this file obj?


(a) tell (true of false ) whether the file is closed or not 

(b)read and return 'something'

(c)Read a single line from the file including the new line character.

(d) Modify the file object for the file so that the next read will be form


Answer:- (a) tell (true of false ) whether the file is closed or not .

Reason:-It has no return value. close() automatically flushes the data but if you want to flush the data before closing the file then you can use this metho


2.In Python___________ method get the position of file handle while________ method change the position of filehandle to the specific position.

(a)Seek,tell   tell change

(b)tell, seek

(c)read ,tell

(d)tell ,change


Answer:- (c)read ,tell


Reason:-seek() method. In Python, seek() function is used to change the position of the File ... File handle is like a cursor, which defines from where the data has to be ... position / end of file cannot be set in text mode except when offset is equal to 


3.What will the output of following given code.


(A)['Hello'] 

(B)['Hello' 'World' 'Python' 'Programming']

(c)['Hello', 'World', 'Python', 'Programming']

(D)Runtime Error


Answer:- (c)['Hello', 'World', 'Python', 'Programming']

Reason:- the output is ['Hello', 'World', 'Python', 'Programming'] because this is right code .


4.In the readlines method-

(a)It return a string

(b) It return a list of line 

(c)an optional parameter size hint can be used to limit the number of bytes to read from a file

(d)both 2 and 3


Answer();- (d)both 2 and 3

Reason:- The readlines() method returns a list containing each line in the file as a list item. Use the hint parameter to limit the number of lines returned. If the total number of bytes returned exceeds the specified number, no more lines are returned.


5.In Python try except has an optional is clause which will execute-

(a) always.

(b) went try clause does not rise exception .

(c)when OSError happens.

(d) all of the above


Answer:- (d) all of the above

Reason:-

  • Some code will be tried to be executed.
  • If an exception is raised, the `except` block is executed, if not, it isn't.
  • Regardless of an exception being raised or not, the code in the `finally` block will be executed.

Post a Comment

17 Comments

  1. Week 10 upload kar do bhai python ki

    ReplyDelete
  2. Please upload answers of 10th week quiz of python programming

    ReplyDelete
  3. Please upload answers of 10th week quiz of python programming

    ReplyDelete
  4. Please upload answers of 10th week quiz of python programming

    ReplyDelete
  5. Please upload answers of 10th week quiz of python programming

    ReplyDelete
  6. Please upload answers of 10th week quiz of python programming

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. Brother,upload the answers of 10th quiz of python programming as soon as possible.

    ReplyDelete
  9. Please upload answers of 10th week quiz of python programming

    ReplyDelete
  10. Please upload answers of 10th week quiz of python programming

    ReplyDelete
  11. Please upload answers of 10th week quiz of python programming

    ReplyDelete
  12. Please upload answers of 10th week quiz of python programming

    ReplyDelete
  13. Please upload answers of 10th week quiz of python programming

    ReplyDelete
  14. Please upload answers of 10th week quiz of python programming

    ReplyDelete