Test
python beyond basics quiz
Crea una cuenta gratis para terminar este test
Guarda tu progreso y consulta tu resultado final.
¿Ya tienes cuenta? Inicia sesión
Preguntas del test (32)
1a package is a special type of:
- Afile
- Bprogram
- Calgorithm
- Dmodule
2can a package contain other package?
- AVerdadero
- BFalso
3what is a sequence specifying the directories from which a package are loaded?
- A_path
- B['path']
- Cpackage_path
- D__path__
- Eimport FILE as _path
4*args are pass as what type?
- Aset
- Blist
- Cdictionary
- Dtuple
5properties must have both setter and getter?
- AVerdadero
- BFalso
6what does function abs() do?
- Areturns absolute value of number
- Breturns the distance of argument from zero
- Creturns the argument but with positive value
7what does BaseException arg attribute contain?
- Aempty tuple
- Bempty set
- Csingle element tuple with diagnostic string
- Dtuple with diagnostic string and error message
- ENone
8what is a template method?
- Aa way to create copies of functions
- Blanguage independent design pattern
- Cpython specific design pattern
- Da python language feature
9what do context-managers assist with?
- Aresource management
- BONLY open file functions
- Corganizing source code calls
- Dlocalizing error message contexts
10issubclass() ?
- Adetermines if any class has base classes
- Bdetermines if first argument is subclass of second
- Cdetermines if first argument is second of first
- Ddetermines if class can be used as base class
11complexity of binary search
- AO(log n)
- BO(n)
- CO(n log n)
- DO(n^2)
12how do you create sub packages?
- ANest package directories inside other package directories.
- BSymbolic links in the file system.
- CInclude parent-package paths in the package init file.
- DPython does not support nested packages
13what does map() do?
- ACalculate the average value in a sequence.
- BApply a function to each element in a sequence.
- CFlatten a nested sequence into a simple list.
- DRemove values from a sequence which evaluate to False.
14when do static methods behave polymorphically?
- Awhen run on an instance
- Bwhen run on the class
15the @staticmethod decorator is used for:
- ATo associate module-scope (global) functions with a class.
- BTo make methods within a class which act on both the class and the instance.
- CTo make methods within a class which act on the instance, but not the class
- DTo make methods within a class which act on the class, but not the instance.
- ETo make methods within a class which act on neither the instance nor the class.
16precision of python integers?
- A17 decimal digits.
- B53 bits.
- CUser configurable.
- D64 bits.
- ELimited only by memory.
17iterators are also iterables?
- AVerdadero
- BFalso
18The reduce() function converts an input sequence into what?
- AA byte representation suitable for serialization.
- BA single value.
- CA head and tail sequence of approximately equal sizes.
- DA sequence of boolean values.
19The @classmethod decorator is used for which purpose?
- ATo make methods within a class which act on the class, but not an instance.
- BTo make methods within a class which act on both the class and an instance.
- CTo make methods within a class which act on neither an instance nor the class.
- DTo associate module-scope (global) functions with a class.
- ETo make methods within a class which act on an instance, but not the class.
20What role does __all__ play in a package __init__.py file?
- AIt controls which names may ever be accessed in the package.
- BIt controls which names are imported by "import *".
- CIt lists the dependencies of the package.
- DIt limits which names are allowed to be defined in the module.
21How many input sequences must you supply to map()?
- AExactly one.
- BExactly two.
- CAs few or as many as you want.
- DThe number of input parameters to the callable argument.
22The year, month, and day values for the date type start at which value?
- AOne.
- BZero.
- CMinus one.
23To support sequence concatenation we override which special method
- A__add__()
- B__concat__()
- C__concatenate__()
- D__plus__()
24True or False: Both the @property and @setter decorators are global built in decorators.
- AVerdadero
- BFalso
25The Decimal type uses what kind of arithmetic?
- AFloating point in base two.
- BFloating point in base ten.
- CFixed point in base ten.
- DFixed point in base two.
26True or false: Between them, int, float, Decimal, and Fraction can represent all real numbers exactly.
- AVerdadero
- BFalso
27Which decorator is most appropriate for implementing the named constructor idiom?
- A@property
- B@staticmethod
- C@classmethod
28Fractions enforce which invariant?
- AThe denominator must be an odd number.
- BThe denominator cannot be zero.
- CThe numerator cannot be zero.
29How does an iterator indicate when it has no more values?
- ARaise StopIteration from __next__().
- BRaise ValueError from __next__().
- CReturn self from __next__().
- DReturn None from __next__().
30Which of the following statements is false?
- AClass attributes can be assigned through the self reference.
- BExisting instance attributes can be accessed through the self reference.
- CExisting class attributes can be accessed through the self reference.
- DInstance attributes can be assigned through the self reference.
31What do we mean by 'lazy evaluation'?
- APython delays module importing until objects from the module are
- BReturn values are cached between function calls.
- COutput values are only calculated as they're needed.
32For integer modulus, the sign of the result has which sign?
- AAlways negative.
- BThe same sign as the dividend (the left-hand-side operand)
- CAlways positive.
- DThe same sign as the divisor (the right-hand-side operand).
Información
- Descripción
- (quizes) python Test sobre python beyond basics quiz, creado por Andrew Sperazza el 09/01/2017.
- Autor
- Andrew Sperazza
- Idioma
- English
- Visitas
- 0
- Etiquetas
- Valoración
- Aún sin valoraciones Valora este test