CS 1101 Final Quiz.docx - Question 1 Answer saved Marked out of 1.00 Flag question Question text After the Python code below has run what happens

CS 1101 Final Quiz.docx - Question 1 Answer saved Marked...

This preview shows page 1 - 5 out of 15 pages.

Question 1 Answer saved Marked out of 1.00 Flag question Question text After the Python code below has run, what happens if 'the_file' does not already exist? try: fin = open('the_file', 'r') except: fin = open('the_file', 'w') fin.close() Select one: a. A run-time error is printed out b. An exception is printed out c. Nothing d. An empty file is created e. Syntax error Question 2 Answer saved Marked out of 1.00 Flag question Question text The Python code below is an example of recursion: def fa(): fb() def fb():
Image of page 1
fa() fa() Select one: True False Question 3 Answer saved Marked out of 1.00 Flag question Question text Assume that d is a Python dictionary. What does the following Python code produce? d.items() Select one: a. a histogram b. an inverted dictionary c. a list of tuples d. a lookup e. a reverse lookup Question 4 Answer saved Marked out of 1.00 Flag question Question text
Image of page 2
Generally speaking, filter list operations produce a different number of list elements compared to map operations. Select one: True False Question 5 Answer saved Marked out of 1.00 Flag question Question text What is the output of the Python method call below? "bib".find('b', 1, 2) Select one: a. 0 b. 2 c. -1 d. syntax error e. 3 Question 6 Answer saved Marked out of 1.00 Flag question Question text To examine a program’s source code and analyze its syntactic structure is to:
Image of page 3
Select one: a. compile the program. b. debug the program. c. parse the program. d. comment the program. e. interpret the program. Question 7 Answer saved Marked out of 1.00 Flag question Question text The Python line below causes “5 dollars” to be printed.
Image of page 4
Image of page 5

You've reached the end of your free preview.

Want to read all 15 pages?

  • Spring '18
  • Jane

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors