Quiz
Python 3 Quiz 2
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (12)
1Which Python keyword is used to return a value from a function back to the statement that called the function?
- Aresult
- Breturn
- Cdef
- DNone
2What is the purpose of the documentation string?
- AA documentation string is a comment used to state the general purpose of a function.
- BA documentation string prints all of the details of a function on the output string.
- CA documentation string is used by the interpreter to determine the number of parameters required.
- DA documentation string is needed to register the function with the Python interpreter.
3Which of the following is a valid first line in the definition of a Python function?
- Adef myFunction( ):
- BmyFunction( ):
- Cdef myFunction( )
- DmyFunction( )
4Which of the following lines of code will create a Car object named, myCar?
- AmyCar = Car
- BmyCar = Car()
- CCar myCar
- DCar(myCar)
5Which of the following statements is correct regarding the relationship between classes and objects?
- AA class and an object both describe the exact same thing.
- BAn object is a blueprint that is used to create individual classes.
- CA class is a blueprint that is used to create individual objects.
- DObjects refer to blueprints created for real worlds things, while classes refer to blueprints created for programming concepts.
6Which of the following could be the first line of code for the class called, Employee?
- Aclass Employee:
- Bdef class Employee:
- Cclass Employee(self):
- Ddef class Employee(self):
7Which of the following lines of code will create a Canvas widget that is 100 pixels wide, 300 pixels tall, and has red as the background color?
- AmyCanvas = Canvas(width=100, height=300, bg="red")
- BmyCanvas = Canvas(width=100, height=300, bg=red)
- CmyCanvas = Canvas(100, 300, bg="red")
- DmyCanvas = Canvas(100 300 "red")
8Which of the following lines of code starts a class named Car that inherits from the class Vehicle?
- Aclass Car() inherits from Vehicle:
- Bclass Car( ): Vehicle( ):
- Cclass Car(Vehicle):
- Dclass Vehicle(Car):
9Which of the following lines of code creates a square staring at (10, 10), where each side has length15?
- AmyCanvas.create_rectangle(10, 10, 25, 25)
- BmyCanvas.create_rectangle(10, 10, 15, 15)
- CmyCanvas.create_rectangle(10, 10, 15)
- DmyCanvas.create_square(10, 10, 15)
10Which of the following characters encloses the values of a tuple?
- A( )
- B[ ]
- C{ }
- D< >
11Which of the following lines of code will print the number of items in the list my_list?
- Acount(my_list)
- Blen(my_list)
- Clength(my_list)
- Dmy_list_length
12Which of the following methods adds the individual elements of one list to another list?
- Aappend( )
- Bextend( )
- Cadd( )
- Dinsert ( )
Information
- Description
- 10th grade Computer Science Quiz on Python 3 Quiz 2, created by Alexandra Brown on 30/10/2018.
- Author
- Alexandra Brown
- Language
- English
- Views
- 1
- Tags
- Rating
- No ratings yet Rate this quiz