using databases with python week 1 assignment

Using Encoded Data in Python 3

1. What is the most common Unicode encoding when moving data between systems?

  • UTF-64
  • UTF-8
  • UTF-128
  • UTF-32
  • UTF-16

2. What is the ASCII character that is associated with the decimal value 42?

  • W
  • Newline
  • w
  • 0
  • (Answer)

3. What word does the following sequence of numbers represent in ASCII :108, 105, 115, 116

  • mist
  • list
  • dict
  • webs
  • first

4. How are strings stored internally in Python 3?

  • bubble memory
  • UTF-16
  • Unicode
  • inverted

5. When reading data across the network (i.e. from a URL) in Python 3, what method must be used to convert it to the internal format used by strings?

  • decode()
  • encode()
  • split()
  • rstrip()
  • internal()

Object Oriented Programming

6. Which came first, the instance or the class?

  • class
  • instance
  • method
  • function

7. In Object Oriented Programming, what is another name for the "attributes" of an object?

  • fields
  • methods
  • forms
  • messages
  • portions

8. At the moment of creation of a new object, Python looks at the _________ definition to define the structure and capabilities of the newly created object.

  • constructor
  • instance
  • cache
  • method
  • class

9. Which of the following is NOT a good synonym for "class" in Python?

  • direction
  • pattern
  • blueprint
  • template

10. What does this Python statement do if PartyAnimal is a class?

zap = PartyAnimal()
  • Subtract the value of the zap variable from the value in the PartyAnimal variable and put the difference in zap
  • Use the PartyAnimal template to make a new object and assign it to zap
  • Clear out all the data in the PartyAnimal variable and put the old values for the data in zap
  • Copy the value from the PartyAnimal variable to the variable zap

11. What is the syntax to look up the fullname attribute in an object stored in the variable colleen?

  • colleen.fullname
  • colleen->fullname
  • colleen::fullname
  • colleen[‘fullname’]

12. Which of these statements is used to indicate that class A will inherit all the features of class B?

  • class A(B) :
  • A=B++;
  • class A inherits B :
  • class A instanceOf B :
  • class A extends B :

13. What keyword is used to indicate the start of a method in a Python class?

  • continue
  • break
  • function
  • def

14. What is "self" typically used for in a Python method within a class?

  • To set the residual value in an expression where the method is used
  • The number of parameters to the method
  • To terminate a loop
  • To refer to the instance in which the method is being called

15. What does the Python dir() function show when we pass an object into it as a parameter?

  • It shows the methods and attributes of the object
  • It shows the number of parameters to the constructor
  • It shows the type of the object
  • It shows the parent class

16. Which of the following is rarely used in Object Oriented Programming?

  • Attribute
  • Method
  • Destructor
  • Constructor

Leave a Reply