NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

1) Explain what is Django?

Django is a web framework in python to develop a web application in python.
----------------------------------------------------------------------------------
2) Mention what are the features available in Django?

Features available in Django are

Admin Interface (CRUD)
Templating
Form handling
Internationalization
Session, user management, role-based permissions
Object-relational mapping (ORM)
Testing Framework
Fantastic Documentation
----------------------------------------------------------------------------------
3) Mention the architecture of Django architecture?

Django architecture consists of

Models: It describes your database schema and your data structure
Views: It controls what a user sees, the view retrieves data from appropriate models and execute any calculation made to the data and pass it to the template
Templates: It determines how the user sees it. It describes how the data received from the views should be changed or formatted for display on the page
Controller: The Django framework and URL parsing
----------------------------------------------------------------------------------
4) Why Django should be used for web-development?

It allows you to divide code modules into logical groups to make it flexible to change
To ease the website administration, it provides auto-generated web admin
It provides pre-packaged API for common user tasks
It gives you template system to define HTML template for your web page to avoid code duplication
It enables you to define what URL be for a given function
It enables you to separate business logic from the HTML
Everything is in python
----------------------------------------------------------------------------------
9) Mention what does the Django templates consists of?

The template is a simple text file. It can create any text-based format like XML, CSV, HTML, etc. A template contains variables that get replaced with values when the template is evaluated and tags (% tag %) that controls the logic of the template.
----------------------------------------------------------------------------------
12) Explain the migration in Django and how you can do in SQL?

Migration in Django is to make changes to your models like deleting a model, adding a field, etc. into your database schema. There are several commands you use to interact with migrations.

Migrate
Makemigrations
Sqlmigrate
To do the migration in SQL, you have to print the SQL statement for resetting sequences for a given app name.
----------------------------------------------------------------------------------
16) Mention what does the Django field class types?

Field class types determines

The database column type
The default HTML widget to avail while rendering a form field
The minimal validation requirements used in Django admin and in automatically generated forms
----------------------------------------------------------------------------------

Q: What is Python?

Python is a high-level, interpreted, general-purpose programming language. Being a general-purpose language, it can be used to build almost any type of application with the right tools/libraries.

----------------------------------------------------------------------------------
Q: What is the lambda function in Python? Why does it exist in Python?

The lambda keyword in Python provides a shortcut for declaring small anonymous functions. Lambda functions behave just like regular functions declared with the def keyword. They can be used whenever function objects are required.

----------------------------------------------------------------------------------
Q: What is pass in Python?

In Python, pass is a null statement. The interpreter does not ignore a pass statement, but nothing happens and the statement results into no operation. The pass statement is useful when you don't write the implementation of a function but you want to implement it in the future.

----------------------------------------------------------------------------------
Q: What is *args, **kwargs in function definition?

*args and **kwargs are special keyword which allows function to take variable length argument. ... **kwargs passes variable number of keyword arguments dictionary to function on which operation of a dictionary can be performed. *args and **kwargs make the function flexible.

----------------------------------------------------------------------------------
Q: What is docstring in Python? How to write them? Are they required?

----------------------------------------------------------------------------------
Q: What are the built-in data types that Python provides? Which of them are mutable, which are immutable?


----------------------------------------------------------------------------------
Q: What is the difference between list and tuple types in Python?
The main difference between lists and tuples is the fact that lists are mutable whereas tuples are immutable. ... A mutable data type means that a python object of this type can be

----------------------------------------------------------------------------------
Q: What keywords can be used in conjunction with the for keyword?

exception
----------------------------------------------------------------------------------
Q: What could be the key in dict?

dictionary key must be of a type that is immutable. For example, you can use an integer, float, string, or Boolean as a dictionary key. However, neither a list nor another dictionary can serve as a dictionary key, because lists and dictionaries are mutable.
----------------------------------------------------------------------------------
Q: What's the difference between globals(), locals(), and vars()?

Each of these return a dictionary:

globals() always returns the dictionary of the module namespace
locals() always returns a dictionary of the current namespace
vars() returns either a dictionary of the current namespace (if called with no argument) or the dictionary of the argument.
locals and vars could use some more explanation. If locals() is called inside a function, it updates a dict with the values of the current local variable namespace (plus any closure variables) as of that moment and returns it. Multiple calls to locals() in the same stack frame return the same dict each time - it's attached to the stack frame object as its f_locals attribute. The dict's contents are updated on each locals() call and each f_locals attribute access, but only on such calls or attribute accesses. It does not automatically update when variables are assigned, and assigning entries in the dict will not assign the corresponding local variables:
----------------------------------------------------------------------------------
Q: What is PEP8?

PEP 8, sometimes spelled PEP8 or PEP-8, is a document that provides guidelines and best practices on how to write Python code. ... A PEP is a document that describes new features proposed for Python and documents aspects of Python, like design and style, for the community.

----------------------------------------------------------------------------------
Q: What is slicing in Python?

Slicing in python means taking elements from one given index to another given index. We pass slice instead of index like this: [start:end] . We can also define the step, like this: [start:end:step] . If we don't pass start its considered 0. If we don't pass end its considered length of array in that dimension

----------------------------------------------------------------------------------
Q: Is it possible to have a negative index in iterative types in Python?

yes coz -1 index mean the last index in the list
----------------------------------------------------------------------------------
Q: What is the __init__.py module? What it's for?

The __init__.py file makes Python treat directories containing it as modules. Furthermore, this is the first file to be loaded in a module, so you can use it to execute code that you want to run each time a module is loaded, or specify the submodules to be exported.٠٧‏
----------------------------------------------------------------------------------
Q: How can I swap values of variables in Python?

a,b=b,a

----------------------------------------------------------------------------------
Q: How do I view object methods?
dir(),help()

----------------------------------------------------------------------------------
Q: How do you get documentation on objects' methods in Python?

__doc__
----------------------------------------------------------------------------------
Q: What is a module in python? What is a package? What is the difference between packages and modules in Python?

A package is a collection of Python modules: while a module is a single Python file, a package is a directory of Python modules containing an additional __init__.py file, to distinguish a package from a directory that just happens to contain a bunch of Python scripts.٣١‏/١٠‏/٢٠١١


----------------------------------------------------------------------------------
Q: What is a decorator? How to create a custom decorator?

A decorator is a design pattern in Python that allows a user to add new functionality to an existing object without modifying its structure. Decorators are usually called before the definition of a function you want to decorate

----------------------------------------------------------------------------------
Q: What is @classmethod, @staticmethod, @property?

The classmethod() is an inbuilt function in Python, which returns a class method for a given function. Syntax: classmethod(function) Parameter :This function accepts the function name as a parameter. Return Type:This function returns the converted class method.

The @staticmethod is a built-in decorator that defines a static method in the class in Python. A static method doesn't receive any reference argument whether it is called by an instance of a class or by the class itself.

@property decorator is a built-in decorator in Python which is helpful in defining the properties effortlessly without manually calling the inbuilt function property(). Which is used to return the property attributes of a class from the stated getter, setter and deleter as parameters.

----------------------------------------------------------------------------------
Q: What is the difference between @classmethod and @staticmethod?


----------------------------------------------------------------------------------
Q: Does Python fully support OOP?

Python supports all the concept of "object oriented programming" but it is NOT fully object oriented because - The code in Python can also be written without creating classes.

----------------------------------------------------------------------------------
Q: What is the __dict__ attribute of an object in Python?
Every object in Python has an attribute denoted by __dict__ . This dictionary/dictionary-like (I will explain this shortly) object contains all the attributes defined for the object itself. It maps the attribute name to its value.


----------------------------------------------------------------------------------
Q: What the `self' keyword is used for in Python?

The self is used to represent the instance of the class. With this keyword, you can access the attributes and methods of the class in python. It binds the attributes with the given arguments. ... In Python, we have methods that make the instance to be passed automatically, but not received automatically.
----------------------------------------------------------------------------------
Q: What is the __init__ function used for?

__init__ is basically a function which will "initialize"/"activate" the properties of the class for a specific object, once created and matched to the corresponding class.. self represents that object which will inherit those properties.

----------------------------------------------------------------------------------
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.