Quiz
Python 3 Quiz 3
Crie uma conta grátis para terminar este quiz
Salve seu progresso e veja sua nota final.
Já tem uma conta? Inicie sessão
Perguntas do quiz (12)
1What does the dictionary method items( ) return?
- AA list containing all of the key-value pairs as tuples.
- BA list containing all of the key-values as lists.
- CA tuple of all the keys.
- DA tuple of all the values.
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?
- Aprint (scores.get['Sam'] )
- Bprint (scores.get(Sam) )
- Cprint (scores.get('Sam') )
- Dprint (scores.get(90) )
3What does the dictionary method update( ) do?
- AIt allows the programmer to change the value stored at a particular key in the dictionary.
- BIt allows the programmer to combine two dictionaries.
- CIt allows the programmer to remove all values in the dictionary that don't have a key.
- DIt allows the programmer to remove all the keys in the dictionary that don't have a value.
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)- Acolors
blue
white - Bcolorsbluewhite
- Ccolors
bluewhite - Dcolors blue white
- Acolors
5Which of the following characters will move the output cursor to the next line?
- A\n
- B\r
- C\t
- D\a
6Which of the following lines of code will create an object named, myfile and open an output file named, data.txt?
- Amyfile = open('data.txt', 'r')
- Bdata.txt = myfile.open('w')
- Cmyfile = open('data.txt', 'w')
- Ddata.txt = open(myfile, 'w')
7What happens if the code in your try block doesn't generate an exception and there are two blocks that handle exceptions?
- ANone of the exception handling blocks will run.
- BOnly the code in the first set of exception handling code will run.
- CThe code in both exception handling blocks that will run.
- DThe program will crash.
8Which of the following statements will be part of the code that handles both an IOError and ValueError exception?
- Aexcept IOError, ValueError:
- Bexception (IOError, ValueError)
- Cexcept (IOError, ValueError):
- Dexcept (IOError, ValueError)
9What happens if your program generates an exception and there's no code written to handle it?
- ANothing happens, the exception is ignored and the program continues.
- BPython gives you an error when you try to attempt to save the source code file.
- CPython gives you a warning when the exception occurs during program execution, and the program continues running.
- DPython gives you an error message when the exception occurs during program execution, and the program stops running.
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?
- Aself.master.size("300x150")
- Bself.master.geometry("300x150")
- Cself.master.dimension(width = 300, height = 150)
- Dself.master.set(width = 300, height = 150)
11Which GUI component works best if you want the user to enter whether a light bulb was turned on or not?
- AButton
- BCheckbutton
- CRadiobutton
- DEntry
12Which of the following methods updates a Label's font during runtime?
- Aconfig( )
- Bfont( )
- Cupdate( )
- Dset_font( )
Informações
- Descrição
- 10th grade Computer Science Quiz sobre Python 3 Quiz 3, criado por Alexandra Brown em 30-10-2018.
- Autor
- Alexandra Brown
- Idioma
- English
- Visualizações
- 1
- Etiquetas
- Avaliação
- Ainda sem avaliações Avalie este quiz