GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Quiz

Python 3 Quiz 3

Alexandra Brown 12 Fragen

Quiz starten

Fragen in diesem Quiz (12)

  1. 1What does the dictionary method items( ) return?
    1. AA list containing all of the key-value pairs as tuples.
    2. BA list containing all of the key-values as lists.
    3. CA tuple of all the keys.
    4. DA tuple of all the values.
  2. 2If you had a dictionary used to associate students' names with their test scores, which of the following lines of code would print the test score for a student named Sam?
    1. Aprint (scores.get['Sam'] )
    2. Bprint (scores.get(Sam) )
    3. Cprint (scores.get('Sam') )
    4. Dprint (scores.get(90) )
  3. 3What does the dictionary method update( ) do?
    1. AIt allows the programmer to change the value stored at a particular key in the dictionary.
    2. BIt allows the programmer to combine two dictionaries.
    3. CIt allows the programmer to remove all values in the dictionary that don't have a key.
    4. DIt allows the programmer to remove all the keys in the dictionary that don't have a value.
  4. 4If you open an empty data file for writing and execute the following lines of code, what would the contents of the file look like?

    colors = ['blue', 'white'] ...(etc)
    1. Acolors
      blue
      white
    2. Bcolorsbluewhite
    3. Ccolors
      bluewhite
    4. Dcolors blue white
  5. 5Which of the following characters will move the output cursor to the next line?
    1. A\n
    2. B\r
    3. C\t
    4. D\a
  6. 6Which of the following lines of code will create an object named, myfile and open an output file named, data.txt?
    1. Amyfile = open('data.txt', 'r')
    2. Bdata.txt = myfile.open('w')
    3. Cmyfile = open('data.txt', 'w')
    4. Ddata.txt = open(myfile, 'w')
  7. 7What happens if the code in your try block doesn't generate an exception and there are two blocks that handle exceptions?
    1. ANone of the exception handling blocks will run.
    2. BOnly the code in the first set of exception handling code will run.
    3. CThe code in both exception handling blocks that will run.
    4. DThe program will crash.
  8. 8Which of the following statements will be part of the code that handles both an IOError and ValueError exception?
    1. Aexcept IOError, ValueError:
    2. Bexception (IOError, ValueError)
    3. Cexcept (IOError, ValueError):
    4. Dexcept (IOError, ValueError)
  9. 9What happens if your program generates an exception and there's no code written to handle it?
    1. ANothing happens, the exception is ignored and the program continues.
    2. BPython gives you an error when you try to attempt to save the source code file.
    3. CPython gives you a warning when the exception occurs during program execution, and the program continues running.
    4. DPython gives you an error message when the exception occurs during program execution, and the program stops running.
  10. 10Which of the following lines of code can be placed inside the __init__method to set the size of the Frame to a width of 300 and a height of 150?
    1. Aself.master.size("300x150")
    2. Bself.master.geometry("300x150")
    3. Cself.master.dimension(width = 300, height = 150)
    4. Dself.master.set(width = 300, height = 150)

Informationen

Beschreibung
10th grade Computer Science Quiz am Python 3 Quiz 3, erstellt von Alexandra Brown am 30/10/2018.
Sprache
English
Aufrufe
1
Bewertung
Noch keine Bewertungen
Bewerte dieses Quiz
Bewerte dieses Quiz

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck