Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

Which Tag Is Used To Escape Python Code Embedded In Html?

Answer»

Web2py USES {{...}} tag to escape python code EMBEDDED in HTML.

Web2py uses {{...}} tag to escape python code embedded in HTML.

2.

How Can We Delete The Records?

Answer»

We can delete the records by using FOLLOWING CODE:

crud.delete(db.table name, ID)

We can delete the records by using following code:

crud.delete(db.table name, id)

3.

What Is Nginx?

Answer»

Niginx is a FREE, open-source WEB server. It is USED to CONFIGURE file.

Niginx is a free, open-source web server. It is used to configure file.

4.

In Which Language Web2py Was Written?

Answer»

WEB2PY was WRITTEN in PYTHON LANGUAGE.

Web2py was written in Python language.

5.

What Is The Process To Send Sms?

Answer»

The FOLLOWING code is used to send SMS:

from gluon.contrib.sms utils

import SMS CODES, sms email

email = sms_email('1 (111) 111-1111','T-Mobile USA (abc)')

mail.send(to = email, subject = 'test', message = 'test')

The following code is used to send SMS:

from gluon.contrib.sms utils

import SMS CODES, sms email

email = sms_email('1 (111) 111-1111','T-Mobile USA (abc)')

mail.send(to = email, subject = 'test', message = 'test')

6.

Is It Possible To Skip The Gui And Start Web2py Directory?

Answer»

<P>Yes, by USING command LINE.

EXAMPLE: python web2py.py -a 'your password' -i 127.0.0.1 -p 8000

Yes, by using command line.

Example: python web2py.py -a 'your password' -i 127.0.0.1 -p 8000

7.

How Can We Disable All The Table In Web2py?

Answer»

In Web2py, Migration is USED to disable all the table.

Example: DB = DAL(..., migrate enabled=False)

In Web2py, Migration is used to disable all the table.

Example: db = DAL(..., migrate enabled=False)

8.

What Is The Use Of Dal Object?

Answer»

DAL OBJECT is USED to represents a database connection.

Example: DB = DAL('sqlite://storage.sqlite')

DAL object is used to represents a database connection.

Example: db = DAL('sqlite://storage.sqlite')

9.

Does Web2py Support Multiple Database?

Answer»

YES, WEB2PY SUPPORTS MULTIPLE DATABASE.

Yes, Web2py supports multiple database.

10.

What Are The Protocols Used In Web2py?

Answer»

There are VARIOUS protocols USED in Web2py:

XML

JSON

RSS

CVC

SOAP etc.

There are various protocols used in Web2py:

XML

JSON

RSS

CVC

SOAP etc.

11.

Which Method Is Used To Send An Email In Web2py?

Answer»

In WEB2PY, mail.SEND() METHOD is USED to send an EMAIL.

In Web2py, mail.send() method is used to send an email.

12.

What Is Rbac In Web2py?

Answer»

In Web2py, RBAC STANDS for Role Based Access Control. It is an approach to restricting system access to authorized USED.

In Web2py, RBAC stands for Role Based Access Control. It is an approach to restricting system access to authorized used.

13.

What Is Cron In Web2py?

Answer»

In Web2py, CRON GIVES the ability to RUN the task within the specified INTERVAL of the time.

In Web2py, CRON gives the ability to run the task within the specified interval of the time.

14.

What Is The I/o Functions In Web2py?

Answer»

There are various I/O functions in Web2py that are given below:

open(): It HELPS to open a FILE or document

WRITE(): It helps to write a string in file or document

read(): It helps to read the content in existing file

close(): This method CLOSES the file object.

There are various I/O functions in Web2py that are given below:

open(): It helps to open a file or document

write(): It helps to write a string in file or document

read(): It helps to read the content in existing file

close(): This method closes the file object.

15.

What Are The Features Of Web2py?

Answer»

WEB2PY features are:

Web2py features are:

16.

Describe The Workflow Of Web2py?

Answer»

Web2py workflow are given below :

  • The web server manages HTTP requests simultaneously in its own thread.
  • The HTTP request header is passed to the dispatcher.
  • The dispatcher manages the APPLICATION requests and map the PATH_INFO in the URL of the function call. EVERY function call is represented in the URL.
  • All the requests for files included in the STATIC folder are managed directly, and large file are streamed to the client.
  • Requests for anything but a static file are mapped into an action.
  • If the request header contains a session cookie for the app, the session object is retrieved; or else, a session id is created.
  • If the action returns a value as string, this is RETURNED to the client.
  • If the action returns an iterable, it is used to loop and stream the data to the client.

Web2py workflow are given below :

17.

How Can We Create A Model?

Answer»

We can create a model by using FOLLOWING CODE :

db.define_table('company', Field('NAME', notnull = True, unique = True), format = '%(name)s')

db.define_table(

'CONTACT',

Field('name', notnull = True),

Field('company', 'reference company'),

Field('picture', 'upload'),

Field('email', requires = IS_EMAIL()),

Field('phone_number', requires = IS_MATCH('[d-() ]+')),

Field('address'),

format = '%(name)s'

)

db.define_table(

'log',

Field('body', 'text', notnull = True),

Field('posted_on', 'datetime'),

Field('contact', 'reference contact')

We can create a model by using following code :

db.define_table('company', Field('name', notnull = True, unique = True), format = '%(name)s')

db.define_table(

'contact',

Field('name', notnull = True),

Field('company', 'reference company'),

Field('picture', 'upload'),

Field('email', requires = IS_EMAIL()),

Field('phone_number', requires = IS_MATCH('[d-() ]+')),

Field('address'),

format = '%(name)s'

)

db.define_table(

'log',

Field('body', 'text', notnull = True),

Field('posted_on', 'datetime'),

Field('contact', 'reference contact')

18.

What Is Postbacks?

Answer»

A better PATTERN in web2py is to submit forms to the same action, which generates them. This mechanism is called as "POSTBACK" which is the main FEATURE of web2py. In short, self-submission is achieved in postback.

A better pattern in web2py is to submit forms to the same action, which generates them. This mechanism is called as "postback" which is the main feature of web2py. In short, self-submission is achieved in postback.

19.

What Is The Default Port Of Web2py?

Answer»

WEB2PY DEFAULT PORT is 8000.

Web2py default port is 8000.

20.

Which Class Is Used To Send Email In Web2py Framework?

Answer»

In Web2fy FRAMEWORK, gluon.tools.Mail class is used to send EMAIL. The mailer can be defined with this class.

from gluon.tools import Mail

mail = Mail()

mail.settings.server = 'smtp.example.com:25'

mail.settings.sender = 'abc@example.com'

mail.settings.login = 'username:password'

In Web2fy Framework, gluon.tools.Mail class is used to send email. The mailer can be defined with this class.

from gluon.tools import Mail

mail = Mail()

mail.settings.server = 'smtp.example.com:25'

mail.settings.sender = 'abc@example.com'

mail.settings.login = 'username:password'

21.

What Are The Crud Methods Of Web2py?

Answer»

Web2fy crud methods are :

Methods  Description

crud.tables() It RETURNS a LIST of tables which is defined in the database.

crud.create(db.tablename) It returns a create form for the table tablename.

crud.read(db.tablename, ID) It returns a read-only form for tablename and record id.

crud.delete(db.tablename, id) It is USED to deletes the record

crud.select(db.tablename, query) It returns a list of records SELECTED from the table

crud.search(db.tablename) Returns a tuple (form, records) where form is a search form

Web2fy crud methods are :

Methods  Description

crud.tables() It returns a list of tables which is defined in the database.

crud.create(db.tablename) It returns a create form for the table tablename.

crud.read(db.tablename, id) It returns a read-only form for tablename and record id.

crud.delete(db.tablename, id) It is used to deletes the record

crud.select(db.tablename, query) It returns a list of records selected from the table

crud.search(db.tablename) Returns a tuple (form, records) where form is a search form

22.

What Are The Databases And Their Drivers Support By Web2py?

Answer»

WEB2PY SUPPORTS following DATABASES and their drivers:

Databases Drivers

SQLite sqlite3 or pysqlite2 or zxJDBC (on Jython)

PostgreSQL psycopg2 or pg8000 or zxJDBC (on Jython)

MySQL pymysql or MySQLdb

Oracle cx_Oracle

MSSQL pyodbc or pypyodbc

FireBird kinterbasdb or fdb or pyodbc

DB2 pyodbc

Informix informixdb

Ingres ingresdbi

Cubrid cubriddb

Web2py supports following databases and their drivers:

Databases Drivers

SQLite sqlite3 or pysqlite2 or zxJDBC (on Jython)

PostgreSQL psycopg2 or pg8000 or zxJDBC (on Jython)

MySQL pymysql or MySQLdb

Oracle cx_Oracle

MSSQL pyodbc or pypyodbc

FireBird kinterbasdb or fdb or pyodbc

DB2 pyodbc

Informix informixdb

Ingres ingresdbi

Cubrid cubriddb

23.

What Are The Application Components Of Web2py?

Answer»

Web2fy consists of the following components:

  • Models: It represents data and database tables.
  • VIEWS: It helps rendering the DISPLAY of the data.
  • Controllers: It describes the application logic and workflow.
  • Languages: describe how to translate strings in the application into various supported languages.
  • Static files: Do not require processing (e.g. images, CSS style sheets etc).
  • ABOUT and README: It provide DETAILS of the project.
  • Errors: It stores ERROR reports generated by the application.
  • Sessions: It stores information related to each particular user.
  • Databases: It store SQLite databases and additional table information.
  • Cache: It store cached application items.
  • Modules: Modules are other optional Python modules.
  • Private: It includes files are accessed by the controllers but not DIRECTLY by the developer.
  • Uploads: Files are accessed by the models but not directly by the developer.

Web2fy consists of the following components:

24.

What Is The Stable Version Of Web2py?

Answer»

Web2py STABLE version is 2.14.6 which is released on MAY 10, 2016.

Web2py stable version is 2.14.6 which is released on May 10, 2016.

25.

Who Is The Author Of Web2py?

Answer»

MASSIMO DI Pierro DEVELOPED the AUTHOR of WEB2PY.

Massimo Di Pierro developed the author of Web2py.

26.

How To Write A Hello World Program In Web2py?

Answer»

We can WRITE a hello world program by USING following CODE:

DEF hello():

return 'Hello World'

We can write a hello world program by using following code:

def hello():

return 'Hello World'

27.

What Are The Protocols Supports In Web2py?

Answer»

WEB2PY supports various PROTOCOLS LIKE: XML, JSON, RSS, CSV, XMLRPC, JSON RPC, AND RPC, and SOAP.

Web2py supports various protocols like: XML, JSON, RSS, CSV, XMLRPC, JSON RPC, AND RPC, and SOAP.

28.

How Can We Install Web2py In Different Operating System?

Answer»

We can INSTALL Web2fy in DIFFERENT operating SYSTEM by using following code:

Operation System : Unix and Linux,OS X,WINDOWS

Command : python web2py.py,OPEN web2py.app,web2py.exe

We can install Web2fy in different operating system by using following code:

Operation System : Unix and Linux,OS X,Windows

Command : python web2py.py,open web2py.app,web2py.exe

29.

What Is Web2py Framework?

Answer»

Web2py is an OPEN source web application FRAMEWORK. It is written in the PYTHON PROGRAMMING language. It allows web developers to DESIGN and develop dynamic web application.

Web2py is an open source web application framework. It is written in the Python programming language. It allows web developers to design and develop dynamic web application.