Answer the following questions
1. What is serialization ?
Ans : Serializing an object means converting it to a bytestream representation that can be stored in a file. This is useful for persistent data; for example, PHP sessions automatically save and restore objects. Serialization in PHP is mostly automatic—it requires little extra work from you, beyond calling the serialize( ) and unserialize( ) functions: $encoded = serialize(something); $something = unserialize(encoded); Serialization is most commonly used with PHP's sessions, which handle the serialization for you. All you need to do is tell PHP which variables to keep track of, and they're automatically preserved between visits to pages on your site. However, sessions are not the only use of serialization—if you want to implement your own form of persistent objects, the serialize( ) and unserialize( ) functions are a natural choice.
2. Enlist the Http Request Methods.
Ans :
1 GET
2 HEAD
3 POST
4 PUT
5 DELETE
6 CONNECT
7 OPTIONS
8 TRACE
3. Name any two variables. of Global
Array?
Ans :
$GLOBALS.
$_SERVER.
$_REQUEST.
$_POST.
$_GET.
$_FILES.
$_ENV.
$_COOKIE.
4. Name any two variables of $-SERVER
array .
Ans :
$_SERVER['PHP_SELF'] Returns the filename of the currently executing
script
$_SERVER['GATEWAY_INTERFACE'] Returns the version of the Common Gateway
Interface (CGI) the server is using
$_SERVER['SERVER_ADDR'] Returns the IP address of the host server
5. Explain the purpose of this
variable? .
Ans :
$this is a pseudo-variable (also a
reserved keyword) which is only available inside methods. And, it refers to the
object of the current method.
$this is mostly used in object oriented
code.
$this variable is used to call
non-static method, if you are trying to call static method then it will throw
the error that means $this variable is not available inside the static method
6. How to check whether a Variable is
set with the Session?
Ans :
You can check whether a variable has
been set in a user's session using the function isset(), as you would a normal
variable. Because the $_SESSION superglobal is only initialised once
session_start() has been called, you need to call session_start() before using
isset() on a session variable.
7. What is introspection ?
Ans :
Introspection is the ability of a
program to examine an object’s characteristics, such as its name, parent class
(if any), properties, and methods. With introspection, you can write code that
operates on any class or object. You don’t need to know which methods or
properties are defined when you write your code; instead, you can discover that
information at runtime, which makes it possible for you to write generic
debuggers, serializers, profilers, etc. In this section, we look at the introspective
functions provided by PHP.
8. What is $-SERVER ?
Ans :
$_SERVER is a PHP super global variable
which holds information about headers, paths, and script locations.
9. Enlist the name of functions to
extract basic information about classes in PHP ?.
Ans :
class_exists() – checks whether a class
has been defined
get_class() – returns the class name of
an object
get_parent_class() – returns the class
name of an object’s parent class
is_subclass_of() – checks whether an
object has a given parent class
10. methods of PEAR DB ?
Ans :
The following descriptions discuss each
of the PEAR DB module methods. Certain object and parameter names recur
throughout the method descriptions in this appendix and have the following
conventional meanings:
Connection object methods are called
using a $conn object. The object is obtained by calling DB::connect().
Result object methods are called using
a $result object. The object is obtained by calling a connection object method
such as query() that generates a query result.
The method descriptions indicate data
types for return values and parameters. A type of mixed indicates that a value
might have different data types depending on how the value is used.
Square brackets ([]) in syntax
descriptions indicate optional parameters. When an optional parameter is
followed by = value, it indicates that if the parameter is omitted, value is
its default value.
The examples print messages and query
results as plain text for the most part. This is done to make the code easier
to read. However, for scripts intended for execution in a Web environment, you
generally should encode output with htmlspecialchars() if it may contain
characters that are special in HTML, such as '<', '>', or '&'.
In the descriptions that follow, the
term "SELECT statement" should be taken to mean a SELECT statement or
any other statement that returns rows, such as DESCRIBE, EXPLAIN, or SHOW.
11. What is XML ?
Ans :
XML stands for eXtensible Markup
Language
XML is a markup language much like HTML
XML was designed to store and transport
data
XML was designed to be self-descriptive
XML is a W3C Recommendation
12. What is WSDL ?
Ans :
WSDL stands for Web Services
Description Language
WSDL is used to describe web services
WSDL is written in XML
13. Name any two parameters of
mysql_connect().
Ans :
server
The MySQL server. It can also include a
port number. e.g. "hostname:port" or a path to a local socket e.g.
":/path/to/socket" for the localhost.
If the PHP directive mysql.default_host
is undefined (default), then the default value is 'localhost:3306'. In SQL safe
mode, this parameter is ignored and value 'localhost:3306' is always used.
username
The username. Default value is defined
by mysql.default_user. In SQL safe mode, this parameter is ignored and the name
of the user that owns the server process is used.
password
The password. Default value is defined
by mysql.default_password. In SQL safe mode, this parameter is ignored and
empty password is used.
new_link
If a second call is made to
mysql_connect() with the same arguments, no new link will be established, but
instead, the link identifier of the already opened link will be returned. The
new_link parameter modifies this behavior and makes mysql_connect() always open
a new link, even if mysql_connect() was called before with the same parameters.
In SQL safe mode, this parameter is ignored.
14. Name any two elements of xml
document structure ?
Ans :
An element can contain:
text
attributes
other elements
or a mix of the above
<title>, <author>,
<year>, and <price> have text content because they contain text
(like 29.99).
<bookstore> and <book> have
element contents, because they contain elements.
<book> has an attribute
(category="children").
15. Enlist PHP Dom's functions?
Ans :
DOMAttr
PHP DOMAttr __construct() Function
PHP DOMAttr isId() Function
DOMCdataSection
PHP DOMCdataSection __construct()
Function
DOMCharacterData
PHP DOMCharacterData appendData()
Function
PHP DOMCharacterData deleteData()
Function
PHP DOMCharacterData insertData()
Function
PHP DOMCharacterData replaceData()
Function
PHP DOMCharacterData substringData()
Function
DOMComment
PHP DOMComment __construct() Function
16. Give any two applications of AJAX
ANS :
Ajax is used in any web application in
which a small amount of data needs to be saved without posting back to an
entire page.
One major application of AJAX is in
login forms where users can enter their login details directly on the original
page.
Another major application can be for
voting on social bookmarking sites so that they can vote for something easily
and quickly.
17. Enlist the methods of XML
HTTPREQUEST object?
Ans :
abort() Cancels
the current request
getAllResponseHeaders() Returns header information
getResponseHeader() Returns specific header information
open(method,url,async,uname,pswd) Specifies the type of request, the URL, if
the request should be handled asynchronously or not, and other optional
attributes of a request
method: the type of request: GET or
POST
url: the location of the file on the
server
async: true (asynchronous) or false
(synchronous)
send(string) send(string) Sends the request off to the server.
string: Only used for POST requests
18. Types of parser in XML &
Ans :
To read and update, create and
manipulate an XML document, you will need an XML parser.
In PHP there are two major types of XML
parsers:
Tree-Based Parsers
Event-Based Parsers
Tree-Based Parsers
Tree-based parsers holds the entire
document in Memory and transforms the XML document into a Tree structure. It
analyzes the whole document, and provides access to the Tree elements (DOM).
This type of parser is a better option
for smaller XML documents, but not for large XML document as it causes major
performance issues.
Example of tree-based parsers:
SimpleXML
DOM
Event-Based Parsers
Event-based parsers do not hold the
entire document in Memory, instead, they read in one node at a time and allow
you to interact with in real time. Once you move onto the next node, the old
one is thrown away.
This type of parser is well suited for
large XML documents. It parses faster and consumes less memory.
Example of event-based parsers:
XMLReader
XML Expat Parser
19. What is SOAP ?
Ans :
SOAP is an acronym for Simple Object
Access Protocol. It is an XML-based messaging protocol for exchanging
information among computers. SOAP is an application of the XML specification.
Points to Note
SOAP is a communication protocol
designed to communicate via Internet.
SOAP can extend HTTP for XML messaging.
SOAP provides data transport for Web
services.
SOAP can exchange complete documents or
call a remote procedure.
SOAP can be used for broadcasting a
message.
SOAP is platform- and
language-independent.
SOAP is the XML way of defining what
information is sent and how.
SOAP enables client applications to
easily connect to remote services and invoke remote methods.
20. What is Web serives ?
Ans :
A Web Service is can be defined by
following ways:
It is a client-server application or
application component for communication.
The method of communication between two
devices over the network.
It is a software system for the
interoperable machine to machine communication.
21. What is setcookie () function?
Ans :
The setcookie() function defines a
cookie to be sent along with the rest of the HTTP headers.
A cookie is often used to identify a
user. A cookie is a small file that the server embeds on the user's computer.
Each time the same computer requests a page with a browser, it will send the
cookie too.
22. What is UDDI ?.
Ans :
UDDI is an XML-based standard for
describing, publishing, and finding web services.
UDDI stands for Universal Description,
Discovery, and Integration.
UDDI is a specification for a
distributed registry of web services.
UDDI is a platform-independent, open
framework.
UDDI can communicate via SOAP, CORBA,
Java RMI Protocol.
23. Enlist functions in php to connect
to the mysql.
Ans :
Connect using mysqli extension
(Recommended)
Connect using PDO (Recommended)
Connect using traditional legacy mysql_
functions (Deprecated)
mysqli_connect function
mysqli_select_db function
mysqli_query function
mysqli_num_rows function
mysqli_fetch_array function
mysqli_close function
0 Comments