13. When referencing a substring such as str[mon) if m n then the value will be a. the character at index m b. the character

13. When referencing a substring such as str[mon) if m n then the value will be a. the character at index m b. the character at indexn c. a Traceback error message IndexError will occur d. none of the above 14. Comments are useful for a. specifying how the interpreter should handle non-standard Python statements b. specifying which Python libraries the interpreter should use c. specifying the intent of the program d. making a bunch of meaningless remarks that confuse programmers 15. Which mode specifier will erase the contents of a file if it already exists and create the file if it does not already exist? b. d. ” 16. Given that the customer file references a file object, and the file was opened using the ‘w’ mode specifier. how would you write the string ‘Mary Smith’ to the file? a customer file.write(‘Mary Smith’) d. customer.write(‘Mary Smith) b. customer.write(‘w’, ‘Mary Smith’) e. None of the above c. customer.input(Mary Smith’) 17. If a file that already exists is opened for writing: a. the contents of the file will be erased b. the new data to be written will be appended to the end of the rile c. a Throwback error will occur d. the user will be prompted for the action they wish to take 18. After the code fhand-open(‘romeo.txt’), the opened file is ready for a. reading c. both a and b e. all of the above b. writing d. appending 19. store related data items and are often called arrays in other languages. a) Dictionaries c) Mappings. b) Sequences. d) None of the above. 20. The number in square brackets after a sequence name is the of a particular element in the sequence. a) subscript c) value b) size d) None of the above. 21. Dictionaries are denoted by the symbol. a)) b) {} . d) None of the above. c) 22. A key-value pair is in the form a) value : key. c) key (value) b) key : value. d) None of the above.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *