python

¡Supera tus tareas y exámenes ahora con Quizwiz!

Define "docstring"?

"Docstring" is a Python documentation string. It is the means to document Python "functions", "modules" and "classes".

Define "slicing"?

"Slicing" is a mechanism to select a range of items from sequence types like list, tuple, strings etc.

What Is The Difference Between "xrange" And "range"?

"Xrange" returns the "Xrange" object while range returns the "list" irrespective of the size of the "range".

What are Python decorators?

A Python decorator is a specific change that we make in Python syntax to alter functions easily. decorator is a function that takes another function and extends the behavior of the latter function without explicitly modifying it.

How Do You Convert A Number Into A String?

By using the inbuilt function str().

What are the built-in type does python provides?

There are mutable and Immutable types of Pythons built in types Mutable built-in types List Sets Dictionaries Immutable built-in types Strings Tuples Numbers

What Does The Expression Len(") Evaluate To?

0

How are arguments passed by value or by reference?

Everything in Python is an object and all variables hold references to the objects. The references values are according to the functions; as a result you cannot change the value of the references. However, you can change the objects if it is mutable.

Mention what are the rules for local and global variables in Python?

Local variables: If a variable is assigned a new value anywhere within the function's body, it's assumed to be local. Global variables: Those variables that are only referenced inside a function are implicitly global

Does The Functions Help() And Dir() List The Names Of All The Built_in Functions And Variables? If No, How Would You List Them?

No. Built-in functions such as max(), min(), filter(), map(), would not be listed because it is not a part of the standard module. To view them, we can pass the module " builtins " as an argument to "dir()". It will display the built-in functions, exceptions, and other objects as a list.>>>dir(__builtins ) ['ArithmeticError', 'AssertionError', 'AttributeError', ......... ]

What Tools That Helps Python Development Do You Know?

Notepad+ and Eclipse with python plugins

What Is Pep 8?

PEP 8 is a coding convention, a set of recommendation, about how to write your Python code more readable.

What Is Pickling And Unpickling?

Pickle module accepts any Python object and converts it into a string representation and dumps it into a file by using dump function, this process is called pickling. While the process of retrieving original Python objects from the stored string representation is called unpickling.

What Is Python? What Are The Benefits Of Using Python?

Programming language with objects, modules and automatic memory management. Benefits = easy to use, portable, simple

What are the tools that help to find bugs or perform static analysis?

PyChecker is a static analysis tool that detects the bugs in Python source code and warns about the style and complexity of the bug. Pylint is another tool that verifies whether the module meets the coding standard.

How Python Is Interpreted?

Python language is an interpreted language. Python runs directly from the source code. It converts the source code that is written by the programmer into an intermediate language, which is again translated into machine language that has to be executed

How Memory Is Managed In Python?

Python memory is managed by Python private heap space. All Python objects and data structures are located in a private heap. The programmer does not have an access to this private heap and interpreter takes care of this Python private heap. The allocation of Python heap space for Python objects is done by Python memory manager. The core API gives access to some tools for the programmer to code. Python also have an inbuilt garbage collector, which recycle all the unused memory and frees the memory and makes it available to the heap space.

Explain How Python Does Compile-time And Run-time Code Checking?

Python performs some amount of compile-time checking, but most of the checks such as type, name, etc are postponed until code execution. Consequently, if the Python code references a user -defined function that does not exist, the code will compile successfully. In fact, the code will fail with an exception only when the code execution path references the function which does not exists.

What Is A "negative Index"?

Python sequences can be indexed as positive and negative numbers. For ac positive index, 0 is the first number, 1 is the second etc. For a negative index, (-1) is the last index and (-2) is the second etc.

What Is A "unittest" In Python?

The unit testing framework of Python is known as "unittest". It supports the sharing of setups, automation testing, shutdown code for tests, aggregation of tests into collections, among others.

What is Dict and List comprehensions are?

They are syntax constructions to ease the creation of a Dictionary or List based on existing iterable.

What Python Frameworks Do You Know?

Web2py, PAMIE

dictionary

associative array

How Do You Copy An Object In Python?

copy.copy () or copy.deepcopy() You cannot copy all objects but most of them

How Python Can Be Used In Software Testing?

generate test data, extract requirements from a document, testing tasks

Write An Expression That Evaluate To True?

len('aaddgg') == 6

What Are "tuples"?

lists that cannot be modified, uses parenthesis instead of square brackets ('test', 5, -0.2)

What Are Generators In Python?

means to implement iterators. It is a normal function except that it yields "expression" in the "function".

Please Write An Example Of A Print Function?

print('hello' + '-' + 'how' + '-' + 'are' + '-' + 'you')

The Following Is Displayed By A Print Function Call: Yesterday Today Tomorrow Please Write An Example Of A Print Function?

print('yesterdayntodayntomorrow')

Define "module" And "package"?

program = modules package = folder of modules/programs

Which Command Do You Use To Exit Help Window Or Help Command Prompt?

quit type quit at the help's command prompt, python shell prompt will appear by closing the help window automatically

functions

return a value based on the given arguments

Considering The Following Code: S = 'catandapple' Write An Expression That Evaluate To 'apple'?

s[-5:]


Conjuntos de estudio relacionados

Assessing Risk - SBE, CITI Questions

View Set

Driving School Unit One (Finished)

View Set

Combo with "Combo with "Honors World History Final" and 27 others" and 19 others

View Set

Chapter 5. The Court System in Texas

View Set

Anatomy Honors - Unit 3 Tissues Test

View Set

MED SURG NUR 440 Final Comp Exam

View Set