Friday, March 25, 2011

PHP Interview Question Part 5

1. Name and explain five of the PHP error constants?
  • E_ERROR: -This error is displayed when there is fatal error which halts the execution of the script immediately.
  • E_WARNING: -This warns the programmer about the error but the execution of the script is not stopped.
  • E_PARSE: -These errors occur during compile time and these errors should only be generated by the parser.
  • E_USER_WARNING: -This warning error is generated by the user and is non fatal. This is set by the programmer using trigger_error().
  • E_COMPILE_WARNING: -this error is generated by the Zend scripting engine. This is a compile time non fatal error.

PHP Interview Question Part 4

1. Describe about the security vulnerability of PHP?
According to the information obtained from the National vulnerability database, PHP has more than quarter of the software vulnerabilities discovered in 2008. Out of 33.33% software and scripts vulnerability PHP amounts to almost quarter of them. Register_globals a feature present in PHP is responsible for most of these vulnerabilities and now it is deprecated by PHP. Most of these security vulnerabilities occur due to poor programming techniques.
 
2. Explain about the data types in PHP?
PHP stores information numerical in a platform dependent range. Unsigned integers can be easily converted to signed integers. Decimal, octal, and hexadecimal notations can be easily assigned to integers. Floating point notation and two forms of scientific notation can be easily assigned to Real numbers. Zero is considered as false and all non zero numbers are considered as true.

3. What is a PHP accelerator?
PHP accelerator increases the speed of applications written in PHP. This boost of performance can be around 2-10 times. PHP accelerator increases the speed of the applications by decreasing parsing each and every time a PHP application runs. It depends upon factors such as time taken for execution of the PHP script and the actual percentage of the source code requested.
 
4. Explain about PHP cookies?
A Cookie is placed on the user desktop which uniquely identifies the user and every time a user views the webpage the same cookie is retrieved. With PHP a programmer can create and retrieve information simultaneously. The setcookie() function is used to create a cookie and PHP $_COOKIE variable helps the programmer to retrieve the cookie stored on the users computer. These both functions can function simultaneously.

5. Explain about Functions in PHP?
PHP has a large pool of functions and a huge number of them can be created by extensions. These functions can be defined at runtime by defining them inside the code. These functions have to be defined inside the parenthesis except for a class constructor function where there is no argument. Functions can be called or referenced by specifying their name.
 
6. Explain about objects in PHP?
In previous versions of PHP, object was fully copied before assigning a variable to a method. This problem was solved in new versions of PHP by the handle function. Many of the features present in PHP 5 are adopted from C++. Some of the features which are incorporated are restricted classes such as private and public, abstract and final classes, abstract and final methods, constructors and destructors with exception handling borrowed from C++.

7. Describe about PHP error and logging information?
Error handling function allows the user to detect the error and do necessary changes which paved the way for the error.
Logging functions pave the way for users to use log applications and send messages to system logs, email or for other specific purpose.
PHP has efficient error and logging constants to its credit. Some of them are E_ERROR, E_NOTICE, E_ALL, E_STRICT, etc.
 
 

ColdFusion Interview Question Part 4

1. How one can provide secured internet applications using adobe ColdFusion?
  • Memory leak during transmit of information
  • Impersonation which is like an exact clone which enters as legitimate
  • Unauthorized access
These mechanisms are handled by adobe by using Data encryption, User Authentication and Access control.

2. Explain the structure of Cold fusion?
ColdFusion is implemented on the J2EE. J2EE is a standard, it is not a programming language. J2EE is an implementation of the Java programming language, but includes a number of Application Programming Interfaces (APIs) for connecting to databases, queuing messages, connecting to registries and naming and directory services.
All of these APIs are used by coldfusion for many of its base services and other runtime services.

ColdFusion consists of following components:
  • cf script
  • CFML
  • ColdFusion Administrator
  • Verity Search Server
3. What is CFCHART engine?
This CFCHART provides more than 200 different attributes which can be altered and these attributes can be used to control animation, labels, and colors. This CFCHART engine is used to produce high quality graphs, charts, sketches, and these charts can also aid you in Business analysis. These charts aid you very much in developing a good business presentation as you can control every part of it.
 
4. What are the benefits of multiple server instances?
The benefits of multiple server instances are, a single server is enough to deploy a host of applications which makes it highly applicable this was not the case when MX7 was present. Applications running on a server need not be stopped for maintenance as the work and load is shared upon multiple servers. Security, optimized applications and clustering are some of the main benefits of Adobe cold fusion multiple server instances.
 
5. What are the two primary types of files in a cold fusion application?
There are two primary types of file systems in ColdFusion which are used extensively they are Coldfusion templates and coldfusion pages. Developers in addition to these use CFML. These can contain HTML and often CFML for Dynamic content.
 
6. Can we modify ColdFusion server code and what are the two open source CFML parsing engines?
Server code of ColdFusion cannot be viewed or modified. The language of ColdFusion itself is documented and subjected to rights laid down by adobe. The two open source engines which are parsing ColdFusion’s markup languages are Blue dragon and Smith project. Blue dragon is a J2EE version.
 
7. What is Web Server?
A computer that delivers (serves up) Web pages. Every Web server has an IP address and possibly a domain name. For example, if you enter the URL http://www.domainname.com/index.html in your browser, this sends a request to the server whose domain name is domainname.com. The server then fetches the page named index.html and sends it to your browser.

Any computer can be turned into a Web server by installing server software and connecting the machine to the Internet. There are many Web server software applications, including public domain software from NCSA and Apache, and commercial packages from Microsoft, Netscape and others.
 

PHP Interview Question Part 3

1. Explain about switch statement in PHP?
Switch statement is executed line by line. PHP executes the statement only when the case statement matches the value of the switch expression. It does execute the statement until the end of the block till it finds the break statement. When the expression and statement matches themselves the code is executed.
 
2. Define about declare construct?
Declare construct allows you to define execution directives for a block set of code. This actually describes the way the code should perform. These declare construct can be set in such a manner that all the code is affected. The way the code performs can be set by the directive part which directly leads the code to follow.

3. Explain about looping in PHP?
Looping is used to run the same script many number of times. Following statements are used in PHP for looping while, do...while, for each, and for statement.
 
4. Explain about require and include function?
Include function collects all the text in a defined specific file and copies the text information to the file which has the include function in it
Require function is similar to the include function except that it handles the error system in a different manner. Require function displays a fatal error and stops the execution of the script while the include function still executes the script.

5. What is the alternative structure for control structures?
The basic control structures are if, for, while, do while, for each and switch. If you are planning to use alternative structures then the closing braces should be changed to endif, endfor, endwhile, endswitch, and endforeach. Similarly the opening brace of the alternative syntax should be changed to (:) or colon. The alternative structure is applicable to else and elseif also.

6. What are the different filter functions used to filter a variable?
  • Filter_var()
  • Filter_var_array()
  • Filter_input
  • Filter_input_array
7. Explain about PHP filter and why it should be used?
A PHP filter validates, filters according to the predefined statements from the programmer. It is very important for every programmer to validate user defines information as it can potential harm; PHP eliminated this risk by using PHP filter extension. This forms a good security practice for programmers.
 

ColdFusion Interview Question Part 3

1. What is cold fusion component roles implementation?
Cold fusion component roles implementation allows users to log into their role based administrator support function and not any other function. If a user tries to enter into other functions an error is thrown. These roles and components are taken by the Cold fusion. These roles and functions are transmitted through action script which allows the users to work on their components.
 
2. How can you create dynamic query?
  • Dynamic SQL is a SQL code that your program generates using variables before the SQL is executed.
  • In coldfusion, CFQUERY give full provision to write all conditional logic & looping to derive the dynamic sql statement to execute.
  • You can use dynamic SQL to accomplish tasks such as adding WHERE clauses to a search based on the fields that the user filled out on a search criteria page.
3. State and explain about integrating Coldfusion applications with JSP.
A cold fusion page can contain JSP or a servlet and a JSP page can contain Coldfusion applications. This facilitates easy access to build hybrid functions and applications which can combine coldfusion components and servlets.

4. Explain about enterprise manager?
Enterprise manager helps you in admin functions. This will help you to create multiple cf server instances, through which you can experience advanced security, performance, and savings.

5. What are the different types of resources through which cold fusion can communicate?
  • Mobile phones that support SMS
  • XMPP or Lotus IM clients
  • Java sockets
  • Java messaging service
  • Content management systems and file systems
6. What is Application Server?
A server that exposes business logic to client applications through various protocols including HTTP, HTTPS, IIOS/SSL. Eg: Sun Java Application server, weblogic server
It takes care of important issues like Transaction Management, Security, Database Connection Pooling, Clustering, Scalability,session management,load balancing,thread management and Messaging etc. A web server cannot provide these.
 
7. What is the benefit of extensible gateway architecture?
Developers can benefit from extensible gateways by limitless variety of emerging protocols. Developers can benefit by the creation of event gateways.
 

ColdFusion Interview Question Part 2

1. Explain about ColdFusion administrator?
ColdFusion administrator is a web based application just like the Cpanel this has many sub options through which you can control many functions such as data sources, global server settings, debugging settings, and application security settings. If you are having multiple administrator services then password must be provided for all those services. Also multiple user instances are provided where by a server can be split into cluster of Coldfusion administrators where a specific work can be provided to a specific individual who cannot alter changes.
 
2. What is CFAbort?
  • Stops the processing of a ColdFusion page at the tag location.
  • ColdFusion returns to the user or calling tag everything that was processed before the cfabort tag.
  • You can optionally specify an error message to display using showError attribute. 
  • The tag is often used with conditional logic to stop processing a page when a condition occurs.
3. What is SaveContent?
  • Used to save the generated content to a variable, including the results of evaluating expressions and executing custom tags.
  •  This tag requires an end tag.
  • Main usage of savcontent is cache partial pages.
4. How can you connect with database from Coldfusion?
  • Database manipulation tags (cfquery, cfstoredproc, cfinsert, cfupdate) have an attribute called datasource which used to identify/connect to a database.
  • Data sources can be defined in CF administrator section.
5. What is Flash form?
  • Flash form is a form like ordinary HTML form, with flash format which run on flash player enabled browsers.
  • Using cfform tag CF automatically generates the swf format form's Flash binary from your CFML code.
  • Flash Forms can be used to create a better forms experience for your users. 
  • These features include accordion-style and multiple-tab form panes and automatic element positioning.
  • You can also display cftree, cfgrid, and cfcalendar form elements as Flash
6. Describe about string encryption?
CFML language provides a 32 bit encryption which is symmetric key based. This function is called as Encrypt. Cold fusion at present uses 32 bit encryption but if your application requires 1024 bit encryption you can happily use that function because cold fusion integrates with third party libraries. Cold fusion also uses Hash function which is very important in safeguarding passwords. They use MD5 and XOR based algorithm.
 
7. Is it possible to write cold fusion in cold fusion?
No it is not possible to write ColdFusion in ColdFusion. Actually ColdFusion was written in Java and to write programs we need to implement other kinds of programs such as Java, .NET etc. These programs are required because ColdFusion alone cannot survive.  

ColdFusion Interview Question Part 1

1. What exactly is ColdFusion?
Cold fusion is the only software which helps the programmer to develop dynamic websites with backend database. ColdFusion is the only website which helps in developing dynamic websites. This is useful in software development. This has an application server and software development framework which greatly aid in developing computer software.
 
 2. What is CFFlush?
The first occurrence of this tag on a page sends back the HTML headers and any other available HTML. Subsequent cfflush tags on the page send only the output that was generated after the previous flush.
When you flush data, ensure that enough information is available, as some browsers might not respond if you flush only a small amount. Similarly, set the interval attribute for a few hundred bytes or more, but not thousands of bytes.
Use the interval attribute only when a large amount of output will be sent to the client, such as in a cfloop or a cfoutput of a large query. Using this form globally (such as in the Application.cfm file) might cause unexpected errors when CFML tags that modify HTML headers are executed.
 
3. Describe in detail about programming details in ColdFusion?
ColdFusion differs from major languages such as JSP, ASP.NET or PHP due to its associated scripting language and ColdFusion markup language. The syntax closely resembles to HTML. This language supports server side Action script and embedded scripts which can be written in ColdFusion script. This script is used for data driven websites. This technology also supports languages such as Flex which is used for client side scripting. This has many interfaces embedded in it which allows for services such as SMS and instant messaging.
 
4. What is the difference between HTMLEditFormat and HTMLCodeFormat?
Difference between HTMLCodeFormat function and HTMLEditFormat is that HTMLEditFormat does not surround the text in an HTML pre tag

5. What is CFQueryparam? What is the use?
  • It separates parameters from the surrounding SQL.
  • It allows the database’s SQL analyzer to more efficiently handle the SQL statement
  • It validates data for the parameters which used to avoid SQL injection attacks.
6. Explain about some of the features present in ColdFusion MX7?
This edition from adobe was named as Macromedia ColdFusion MX7. Some of the features which are present are web forms, Xforms, adobe acrobat friendly report builder, flash, excel and rich text format style. This edition of cold fusion provided Gateways which helped in connecting various services such as IM, SMS, etc.
 
7. Describe about Clustering.
In previous installations of Adobe cold fusion multiple servers were required to run the application but adobe cold fusion 8 mitigated the problem by clustering Coldfusion into multiple physical installations which take over the load if any application fails during its course of time. This also allows in easy maintenance and possible reduction in maintaining multiple servers. This was made possible by J2EE server.
 
 

Friday, March 18, 2011

PHP Interview Question Part 1

1. What is PHP?

PHP stands for: PHP Hyper Text Preprocessor.

2. Why PHP?

PHP runs on different platforms (Windows, Linux, Unix, etc.).
PHP is compatible with almost all servers used today (Apache, IIS, etc.).
PHP is FREE to download from the official PHP resource: www.php.net.
PHP is easy to learn and runs efficiently on the server side.

3.What is a PHP File?

PHP files may contain text, HTML tags and scripts.
PHP files are returned to the browser as plain HTML.
PHP files have a file extension of  “.php”, “.php3?, or “.phtml”.

4. What is caching?

“Meta tags are easy to use, but aren’t very effective. That’s because they’re usually only honored by browser caches (which actually read the HTML), not proxy caches (which almost never read the HTML in the document).”

If a page is changed “nearly every day”, it will hardly be a problem in practical terms.

And in any case, it’s something to be handled at the server level, by making the server send some useful expiration information, using whatever needs to be done on a specific

server. Telling that a page expired twenty years ago is hardly a good idea if you can expect its lifetime to be a day or more, or at least several hours. Defeating proxy caching brutally wouldn’t be a good idea (and meta tags won’t do that, so the errors in a sense cancel out each other, so to say This has to be at the beginning of the file, with nothing before (e.g. no blank). This is a brute force variation, some adjustments are useful. (Server supporting PHP is recommended)Meta-tags wont work with proxies.

Proxies don’t work on the ‘HTML-layer’ but HTTP. Things depend on proxy settings also.”The Pragma header is generally ineffective because its meaning is not standardized and few caches honor it. Using <meta http-equiv=…> elements in HTML documents is also generally ineffective; some browsers may honor such markup, but other caches ignore it completely.” – Web Design Group That’s because the no-cache pragma is supposed to be part of a HTTP *request*. And *this* has been standardized since way back.

5. Are the PHP variable names case sensitive?
Yes. The php variable names cases sensitive. 

6. Are the PHP function names case sensitive?
No, Its not case sensitve functions.

7. What are the differences between PHP 3 and PHP 4?
Here’s a list of some of the more important new features:
  • Extended API module.
  • Generalized build process under Unix.
  • Generic web server interface that also supports multi-threaded web servers
  • Improved syntax highlighter.
  • Native HTTP session support.
  • Output buffering support.
  • More powerful configuration system.
  • Reference counting.

 

PHP Interview Question Part 2


1. What is the difference between echo and print statement?
There is a slight difference between print and echo which would depend on how you
want to use the outcome. Using the print method can return a true/false value. This may
be helpful during a script execution of somesort. Echo does not return a value, but has
been considered as a faster executed command. All this can get into a rather
complicated discussion, so for now, you can just use whichever one you prefer.

2.How to make a download page in own site, which i can know that how many file has
been loaded by particular user or particular ipaddress?

We can use hyperlink having URL where file are kept. and we only allow regisetered
user to download. from session of user we can get the user detail

3. What is the difference between mysql_connect and mysql_pconnect?
 mysql_pconnect establishes a persistent connection. If you don't need one (such as a
website that is mostly HTML files or PHP files that don't call the db) then you don't
need to use it. mysql_connect establishes a connection for the duration of the script
that access the db. Once the script has finished executing it closes the connection. The
Templateshut.com
only time you need to close the connection manually is if you jump out of the script for
any reason.
If you do use mysql_pconnect. You only need to call it once for the session. That's the
beauty of it. It will hold open a connection to the db that you can use over and over
again simply by calling the resource ID whenever you need to interact with the db.

4. How can I get IP Address?
We can use SERVER var $_SERVER['SERVER_ADDR'] and getenv("REMOTE_ADDR")
functions to get the IP address.

5. How we know the browser properties?
get_browser() attempts to determine the capabilities of the user's browser. This is done
by looking up the browser's information in the browscap.ini file.
echo $_SERVER['HTTP_USER_AGENT'] . "

6. What is the difference between require_once(), require(), include().
Difference between require() and require_once(): require() includes and evaluates a
specific file, while require_once() does that only if it has not been included before (on
the same page). So, require_once() is recommended to use when you want to include a
file where you have a lot of functions for example. This way you make sure you don't
include the file more times and you will not get the "function re-declared" error.
Difference between require() and include() is that require() produces a FATAL ERROR
if the file you want to include is not found, while include() only produces a WARNING.
There is also include_once() which is the same as include(), but the difference between
them is the same as the difference between require() and require_once().

7. What is CAPTCHA?
CAPTCHA stands for Completely Automated Public Turing Test to tell Computers and
Humans Apart. To prevent spammers from using bots to automatically fill out forms,
CAPTCHA programmers will generate an image containing distorted images of a string
of numbers and letters. Computers cannot determine what the numbers and letters are
from the image but humans have great pattern recognition abilities and will be able to
fairly accurately determine the string of numbers and letters. By entering the numbers
and letters from the image in the validation field, the application can be fairly assured
that there is a human client using it.

Tuesday, March 15, 2011

CSS Interview Question Part I

1. Explain in brief about the term CSS.
A stylesheet language used to describe the presentation of a document written in a markup language. Cascading Style Sheets are a big breakthrough in Web design because they allow developers to control the style and layout of multiple Web pages all at once.

2. What are the various style sheets?
Inline, external, imported and embedded are the different types of style sheets.

3. List various font attributes used in style sheet.

font-style
font-variant
font-weight
font-size/line-height
font-family
caption
icon
menu
message-box
small-caption
status-bar

4. Explain inline, embedded and external style sheets.

Inline
If only a small piece of code has to be styled then inline style sheets can be used.

Embedded
Embedded style sheets are put between the <head> </head> tags.

External
If you want to apply a style to all the pages within your website by changing just one style sheet, then external style sheets can be used.

5. Are Style Sheets case sensitive?
No. Style sheets are case insensitive. Whatever is case insensitive in HTML is also case insensitive in CSS. However, parts that are not under control of CSS like font family names and URLs can be case sensitive - IMAGE.gif and image.gif is not the same file.

6. What is selector?
CSS selector is equivalent of HTML element(s). It is a string identifying to which element(s) the corresponding declaration(s) will apply and as such the link between the HTML document and the style sheet.
For example in P {text-indent: 10pt} the selector is P and is called type selector as it matches all instances of this element type in the document.
in P, UL {text-indent: 10pt} the selector is P and UL (see grouping); in .class {text-indent: 10pt} the selector is .class (see class selector).

7. Can I include comments in my Style Sheet?
Yes. Comments can be written anywhere where whitespace is allowed and are treated as white space themselves. Anything written between /* and */ is treated as a comment (white space). NOTE: Comments cannot be nested.