You are on page 1of 20

1

1.Session and cookies


The main difference between cookies and sessions is that cookies are stored in the user's
browser, and sessions are not. This difference determines what each is best used for.
A cookie can keep information in the user's browser until deleted. If a person has a login and
password, this can be set as a cookie in their browser so they do not have to re-login to your
website every time they visit. You can store almost anything in a browser cookie. The trouble
is that a user can block cookies or delete them at any time. If, for example, your website's
shopping cart utilized cookies, and a person had their browser set to block them, then they
could not shop at your website.
Sessions are not reliant on the user allowing a cookie. They work instead like a token allowing
access and passing information while the user has their browser open. The problem with
sessions is that when you close your browser you also lose the session. So, if you had a site
requiring a login, this couldn't be saved as a session like it could as a cookie, and the user
would be forced to re-login every time they visit.
2.HTTP headers
Public

Content-Length
Content-Type
Content-Transfer-Encoding
Allowed
Date
Expires
Last-Modified
Message-Id
URI
Version
Derived-From
Content-Language
Cost
Link
Title

4.mysql join queries


5.include and require
All three are used to an include file into the current page. It is faster than include().
If the file is not present, require(), calls a fatal error, while in include() does not.
The include_once() statement includes and evaluates the specified file during the execution of
the script. This is a behavior similar to the include() statement, with the only difference being
that if the code from a file has already been included, it will not be included again. It des not
call a fatal error if file not exists. require_once() does the same as include_once(), but it calls
a fatal error if file not exists.
6.Associated arry.
Associate any key or index for tat array
7.Explain print_r
8.MYSQl,php,apache versions.
7.uploading in server
8.Oops concept
9.explain abt PHP .ini. File

2
Modifying PHP Configuration File ( php.ini )
PHP stores all kinds of configuration in a file called php.ini.You can find this file in the directory
where you installed PHP. Sometimes you will need to modify this file for example to use a PHP
extension. I won't explain each and every configuration available just the ones that often need
modification or special attention.
Some of the configurations are : register_globals
1.
2.
3.
4.

error_reporting and display_errors


extension and extension_path
session.save_path
max_execution_time

register_globals
Before PHP 4.2.0 the default value for this configuration is On and after 4.2.0 the default
value is Off. The reason for this change is because it is so easy to write insecure code with
this value on. So make sure that this value is Off in php.ini.
error_reporting and display_errors
Set the value to error_reporting = E_ALL during development but after production set the
value to error_reporting = E_NONE .
The reason to use E_ALL during development is so you can catch most of the nasty bugs in
your code. PHP will complain just about any errors you make and spit out all kinds of warning
( for example if you're trying to use an uninitialized variable ).
However, after production you should change the value to E_NONE so PHP will keep quiet even
if there's an error in your code. This way the user won't have to see all kinds of PHP error
message when running the script.
One important thing to note is that you will also need to set the value of display_erros to On.
Even if you set error_reporting = E_ALL you will not get any error message ( no matter how
buggy our script is ) unless display_errors is set to On.
extension and extension_path
PHP4 comes with about 51 extensions such as GD library ( for graphics creation and
manipulation ), CURL, PostgreSQL support etc. These extensions are not turned on
automatically. If you need to use the extension, first you need to specify the location of the
extensions and then uncomment the extension you want.
The value of extension_path must be set to the directory where the extension is installed
which is PHP_INSTALL_DIR/extensions, with PHP_INSTALL_DIR is the directory where you
install PHP. For example I installed PHP in C:\Program Files\Apache Group\Apache2\php so the
extensions path is :
extension_path = C:/Program Files/Apache Group/Apache2/php/extensions/
Don't forget to add that last slash or it won't work
After specifying the extension_path you will need to uncomment the extension you want to
use. In php.ini a comment is started using a semicolon (;). As an example if you want to use
GD library then you must remove the semicolon at the beginning of ;extension=php_gd2.dll to
extension=php_gd2.dll

3
session.save_path
This configuration tells PHP where to save the session data. You will need to set this value to
an existing directory or you will not be able to use session. In Windows you can set this value
as session.save_path = c:/windows/temp/
max_execution_time
The default value for max_execution_time is 30 ( seconds ). But for some scripts 30 seconds
is just not enough to complete it's task. For example a database backup script may need more
time to save a huge database.
If you think your script will need extra time to finish the job you can set this to a higher value.
For example to set the maximun script execution time to 15 minutes ( 900 seconds ) you can
modify the configuration as max_execution_time = 900
PHP have a convenient function to modify PHP configuration in runtime, ini_set(). Setting PHP
configuration using this function will not make the effect permanent. It last only until the
script ends.
11.cookie parameters ,size,maximum time limit.
1) name - cookie name
2) value - Optional parameter. Describes a value for cookie.
3) age - Optional parameter. Describes an age for cookie (in seconds). Default value
is -1 (not persistent cookie)
3) path - Optional parameter: cookie path.
3) domain - Optional parameter: cookie domain
2) According to the draft specification issued by Netscape Communications, the limits
regarding the size of cookie and space occupied by all cookies is:
4 KB per cookie maximum
300 total cookies, for a total of 1.2 Mbytes maximum
20 cookies accepted from a particular server or domain
12.to kill session,to kill variable
1.seesion_destroy,unset.
13.urlencode,explode,implode
return alphanumeric strings.
Split a array by string,split ,
Join array elements with a string ,
14.orderby,groupby.
15.truncate,drop,delete diff
16.types of errors.
E_PARSEThe script has a syntactic error and could not be parsed. This is a fatal
error.

E_COMPILE_ERRORA fatal error occurred in the engine while compiling the script.

E_COMPILE_WARNINGA nonfatal error occurred in the engine while parsing the


script.

E_CORE_ERRORA fatal runtime error occurred in the engine.

E_CORE_WARNINGA nonfatal runtime error occurred in the engine.


E_ALL

4
17.post and get difference
18.subitting form without post,get
19.query for second largest no.
Select Age From age E1
Where 3=(Select Count(*) From age E2
Where E1.Age<=E2.Age)
20.diff str &stristr
string strstr ( string str1, string str2) this function search the string str1 for the first
occurrence of the string str2 and returns the part of the string str1 from the first occurrence of
the string str2. This function is case-sensitive and for case-insensitive search use stristr()
function.
Who is the father of PHP and explain the changes in PHP versions?
Rasmus Lerdorf is the father of PHP
How can we submit a form without a submit button?
I can submit a form in many ways, for e.g.
1. When user click on checkbox, or drop down
2. When user click on radio button
3. At the end of the form I will type Click here
to submit & link text to the processing file
What is the difference between mysql_fetch_object and mysql_fetch_array?
mysql_fetch_array Fetch a result row as an associative ARRAY, a numeric array, or both
mysql_fetch_object Fetch a result row as an OBJECT
What is the difference between $message and $$message?
A variable variable allows us to change the name of a variable dynamically.
How can we extract string abc.com from a string http://info@abc.com using regular
expression of PHP?
echo substr(http://info@abc.com,12,19);
How can we create a database using PHP and mysql?
Functions in IMAP, POP3 AND LDAP?
imap_body Read the message body
imap_check Check current mailbox
imap_delete Mark a message for deletion from current mailbox
imap_mail Send an email message
How can I execute a PHP script using command line?
Php -f <filename>
What is meant by nl2br()?
Returns string with after inserting HTML line breaks before all newlines in a string
How can we encrypt and decrypt a data present in a mysql table using mysql?
AES_ENCRYPT () and AES_DECRYPT ()
How can we encrypt the username and password using PHP?
You can encrypt a password with the following Mysql>SET
PASSWORD=PASSWORD("Password");
We can encode data using base64_encode($string) and can decode using
base64_decode($string);

5
What are the features and advantages of object-oriented programming?
ne of the main advantages of OO programming is its ease of modification; objects can easily
be modified and added to a system there by reducing maintenance costs. OO programming is
also considered to be better at modeling the real world than is procedural programming. It
allows for more complicated and flexible interactions. OO systems are also easier for nontechnical personnel to understand and easier for them to participate in the maintenance and
enhancement of a system because it appeals to natural human cognition patterns.
For some systems, an OO approach can speed development time since many objects are
standard across systems and can be reused. Components that manage dates, shipping,
shopping carts, etc. can be purchased and easily modified for a specific system.
What is the use of friend function?
Friend functions Sometimes a function is best shared among a number of different classes.
Such functions can be declared either as member functions of one class or as global functions.
In either case they can be set to be friends of other classes, by using a friend specifier in the
class that is admitting them. Such functions can use all attributes of the class whichnames
them as a friend, as if they were themselves members of that class.
A friend declaration is essentially a prototype for a member function, but instead of requiring
an implementation with the name of that class attached by the double colon syntax, a global
function or member function of another class provides the match.
What are the differences between public, private, protected, static, transient, final and
volatile?
Public: Public declared items can be accessed everywhere.
Protected: Protected limits access to inherited and parent classes (and to the class that
defines the item).
Private: Private limits visibility only to the class that defines the item.
Static: A static variable exists only in a local function scope, but it does not lose its value when
program execution leaves this scope.
Final: Final keyword prevents child classes from overriding a method by prefixing the definition
with final. If the class itself is being defined final then it cannot be extended.
What is the functionality of the function htmlentities?
This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all
characters which have HTML character entity equivalents are translated into these entities.
How can we get second of the current time using date function?
$second = date("s");
What is meant by urlencode and urldocode?
urlencode() returns the URL encoded version of the given string. URL coding converts special
characters into % signs followed by two hex digits. For example: urlencode("10.00%") will
return "10%2E00%25?. URL encoded strings are safe to be used as part of URLs.
urldecode() returns the URL decoded version of the given string.
What is the difference between the functions unlink and unset?
unlink() deletes the given file from the file system.
unset() makes a variable undefined.
How can we register the variables into a session?
We can use the session_register ($ur_session_var) function.
What is the maximum size of a file that can be uploaded using PHP and how can we change
this?

6
You can change maximum size of a file set upload_max_filesize variable in php.ini file
How can we increase the execution time of a PHP script?
Set max_execution_time variable in php.ini file to your desired time in second.
How many ways can we get the value of current session id?
session_id() returns the session id for the current session
How can we destroy the cookie?
Set the cookie in past
What is the difference between ereg_replace() and eregi_replace()?
eregi_replace() function is identical to ereg_replace() except that this ignores case distinction
when matching alphabetic characters.eregi_replace() function is identical to ereg_replace()
except that this ignores case distinction when matching alphabetic characters.
What are the different functions in sorting an array?
Asort,rsort,ksort
How can we know the count/number of elements of an array?
Size,count
What is the PHP predefined variable that tells the What types of images that PHP supports?
Directory
stdClass
__PHP_Incomplete_Class
exception
php_user_filter
How can we send mail using JavaScript?
llocation=mailto:mailid@domain.com?subject=+tdata+/MYFORM;
What are the advantages of stored procedures, triggers, indexes?
A stored procedure is a set of SQL commands that can be compiled and stored in the server.
Once this has been done, clients don't need to keep re-issuing the entire query but can refer
to the stored procedure. This provides better overall performance because the query has to be
parsed only once, and less information needs to be sent between the server and the client.
You can also raise the conceptual level by having libraries of functions in the server. However,
stored procedures of course do increase the load on the database server system, as more of
the work is done on the server side and less on the client (application) side.
Triggers will also be implemented. A trigger is effectively a type of stored procedure, one that
is invoked when a particular event occurs. For example, you can install a stored procedure that
is triggered each time a record is deleted from a transaction table and that stored procedure
automatically deletes the corresponding customer from a customer table when all his
transactions are deleted.
Indexes are used to find rows with specific column values quickly. Without an index, MySQL
must begin with the first row and then read through the entire table to find the relevant rows.
The larger the table, the more this costs. If the table has an index for the columns in question,
MySQL can quickly determine the position to seek to in the middle of the data file without
having to look at all the data. If a table has 1,000 rows, this is at least 100 times faster than
reading sequentially. If you need to access most of the rows, it is faster to read sequentially,
because this minimizes disk seeks.
What is the maximum length of a table name, database name, and fieldname in MySQL?

7
Database name- 64
Table name -64
Fieldname-64
What are the advantages/disadvantages of MySQL and PHP?
What is MIME?
Multipurpose Internet Mail Extensions.
WWW's ability to recognise and handle files of different types is largely dependent on the use
of the MIME (Multipurpose Internet Mail Extensions) standard. The standard provides for a
system of registration of file types with information about the applications needed to process
them. This information is incorporated into Web server and browser software, and enables the
automatic recognition and display of registered file types.
What is PEAR in PHP?
PEAR is short for "PHP Extension and Application Repository" and is pronounced just like the
fruit. The purpose of PEAR is to provide:
A structured library of open-sourced code for PHP users
A system for code distribution and package maintenance
A standard style for code written in PHP
The PHP Foundation Classes (PFC),
The PHP Extension Community Library (PECL),
A web site, mailing lists and download mirrors to support the PHP/PEAR community
PEAR is a community-driven project with the PEAR Group as the governing body. The project
has been founded by Stig S. Bakken in 1999 and quite a lot of people have joined the project
since then.
What is the default session time in PHP and how can I change it?
The default session time in php is until closing of browser
What changes I have to done in PHP.ini file for file uploading?
; Whether to allow HTTP file uploads.
file_uploads = On
; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
upload_tmp_dir = C:\apache2triad\temp
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
What are the differences between MySQL_fetch_array(), MySQL_fetch_object(),
MySQL_fetch_row()?
mysql_fetch_array Fetch a result row as an associative array, a numeric array, or both.
mysql_fetch_object ( resource result )
Returns an object with properties that correspond to the fetched row and moves the internal
data pointer ahead. Returns an object with properties that correspond to the fetched row, or
FALSE if there are no more rows
mysql_fetch_row() fetches one row of data from the result associated with the specified result
identifier. The row is returned as an array. Each result column is stored in an array offset,
starting at offset 0.
Steps for the payment gateway processing?
An online payment gateway is the interface between your merchant account and your Web
site. The online payment gateway allows you to immediately verify credit card transactions
and authorize funds on a customers credit card directly from your Web site. It then passes the
transaction off to your merchant bank for processing, commonly referred to as transaction
batching

8
List out different arguments in PHP header function?
void header ( string string [, bool replace [, int http_response_code]])
Explain MySQL optimization?
First, one thing that affects all queries: The more complex permission system setup you have,
the more overhead you get.
If you do not have any GRANT statements done, MySQL will optimise the permission checking
somewhat. So if you have a very high volume it may be worth the time to avoid grants.
Otherwise, more permission check results in a larger overhead.
How can I get the only name of the current executing file?
$file = $_SERVER["SCRIPT_NAME"];
echo $file;
Difference between Connect and Pconnect?
Which should be closed explicitly?
Difference between Session and Cookie?
What is Mysql_Ping?
Difference between set_cookie and Set_raw_cookie?
Versions Of PHP/Mysql/Apache?
Difference between PHP 4 and PHP 4?
Difference between Get and Post?
File Operations?
How do use Payment Gateway in Projects? (5 to 6 questions related to payment gateway)
n commons, header() being used for page redirection, whereby a specific location being
define. However header() can be use more than just that.

You can crate a virtual domain by using .htaccess file and you need to set some little things in
control panel.
by using .htaccess file you can crate like as a under mention example.
.htaccess files are configuration files of Apache Server which provide a way to make
configuration changes on a per-directory basis. A file, containing one or more configuration
directives, is placed in a particular document directory, and the directives apply to that
directory, and all subdirectories thereof.

1.

On a fresh install, why does Apache have three config files - srm.conf,
access.conf and httpd.conf? - The first two are remnants from the NCSA times, and
generally you should be ok if you delete the first two, and stick with httpd.conf.

2.

Whats the command to stop Apache? - kill the specific process that httpd is
running under, or killall httpd. If you have apachectl installed, use apachectl stop.

3.

What does apachectl graceful do? - It sends a SIGUSR1 for a restart, and starts
the apache server if its not running.

9
4.

How do you check for the httpd.conf consistency and any errors in it? apachectl configtest

5.

When I do ps -aux, why do I have one copy of httpd running as root and the
rest as nouser? - You need to be a root to attach yourself to any Unix port below
1024, and we need 80.

6.

But I thought that running apache as a root is a security risk? - That one root
process opens port 80, but never listens to it, so no user will actually enter the site
with root rights. If you kill the root process, you will see the other kids disappear as
well.

7.

Why do I get the message " no listening sockets available, shutting down"?
- In Apache 2 you need to have a listen directive. Just put Listen 80 in httpd.conf.

8.

How do you set up a virtual host in Apache?


<VirtualHost www.techinterviews.com>
ServerAdmin admin@techinterviews.com
DocumentRoot /home/apache/share/htdocs/hostedsites
ServerName www.techinterviews.com
ErrorLog /home/apache/logs/error/hostedsites/error_log
TransferLog /home/apache/logs/access/hostedsites/access_log
</VirtualHost>

9.

What is ServerType directive? - It defines whether Apache should spawn itself as a


child process (standalone) or keep everything in a single process (inetd). Keeping it
inetd conserves resources. This is deprecated, however.

10. What is mod_vhost_alias? - It allows hosting multiple sites on the same server via
simpler configurations.
11. What does htpasswd do? - It creates a new user in a specified group, and asks to
specify a password for that user.
12. If you specify both deny from all and allow from all, what will be the default
action of Apache? - In case of ambiguity deny always takes precedence over allow.
. List few features of object oriented programming.Object oriented programming
features:
Follows bottom up approach.
Emphasis is on data.
Programs are divided into objects.
Functions and data are bound together.
Communication is done through objects.
Data is hidden.
2. List features of procedure oriented programming.Procedure oriented programming
features:
Follows top down approach.
Emphasis is on procedure.
Programs are divided into functions.
Data moves around freely.
3. What are the basic concepts of OOPs?The following are the basic concepts of OOPs:
Classes, Objects, Data abstraction and encapsulation, Polymorphism, Inheritance, Message
Passing, and Dynamic Binding.

10
4. What is a class?
Class is an entity which consists of member data and member functions which operate on the
member data bound together.
5. What is an object?
Objects are instances of classes. Class is a collection of similar kind of objects. When a class is
created it doesnt occupy any memory, but when instances of class is created i.e., when
objects are created they occupy memory space.
6. What is data encapsulation?
Wrapping up of member data and member functions together in a class is called data
encapsulation.
7. What is data abstraction?
Data abstraction refers to the act of providing only required features and hiding all the nonessential details for usage.
8. What are ADTs?
ADTs stand for abstract data types. Classes which provide data abstraction are referred to as
ADTs.
9. What is inheritance?
The process of inheriting the properties of one object by another object is called inheritance.
10. What is polymorphism?
The feature of exhibiting many forms is called polymorphism.
11. What are the steps involved in message passing?The following are the steps involved
in message passing:
Creating classes, creating objects, and creating communication between objects.
12. What is dynamic binding?
The feature that the associated code of a given function is not known till run time is called
dynamic binding.
13. What are the advantages of OOP?Data hiding helps create secure programs.
Redundant code can be avoided by using inheritance.
Multiple instances of objects can be created.
Work can be divided easily based on objects.
Inheritance helps to save time and cost.
Easy upgrading of systems is possible using object oriented systems.
14. Give an example for object based programming language.
Ada is an example for object based programming language.
15. Write the features of object based programming language.
Data hiding, data encapsulation, operator overloading and automatic initialization and clear up
of objects are the important features exhibited by object based programming languages.

What is the difference between Information Hiding and Encapsulation?


Generally Encapsulation is often referred to as information hiding. Though the two terms are
often used interchangeably, Information Hiding is really the result of Encapsulation, not a
synonym for it. Both are distinct concepts.

11
Encapsulation makes it possible to separate an objects implementation from its behavior - to
restrict access to its internal data. This restriction allows certain details of an objects behavior
to be hidden. It allows us to create a black box and protects an objects internal state from
corruption by its user.
What is an Interface?
An interface is a contract & defines the requisite behavior of generalization of types.
An interface mandates a set of behavior, but not the implementation. Interface must be
inherited. We can't create an instance of an interface.
An interface is an array of related function that must be implemented in derived type.
Members of an interface are implicitly public & abstract.
An interface can inherit from another interface.
What is Sealed modifiers?
Sealed types cannot be inherited & are concrete.
Sealed modifiers can also be applied to instance methods, properties, events & indexes. It
can't be applied to static members.
Sealed members are allowed in sealed and non-sealed classes.
What is Abstract Class?
Abstract class exists extensively for inheritance. We can't create an instance of an abstract
class. Abstract type must be inherited.
Static, Value Types & interface doesn't support abstract modifiers.
Static members cannot be abstract. Classes with abstract member must also be abstract.
What is New modifiers?
The new modifiers hides a member of the base class. C# supports only hide by signature.
What is Virtual keyword?
This keyword indicates that a member can be overridden in a child class. It can be applied to
methods, properties, indexes and events.
What is Inheritance?
It provides a convenient way to reuse existing fully tested code in different context thereby
saving lot of coding.
Inheritance of classes in C# is always implementation Inheritance.
What is Static Method?
It is possible to declare a method as Static provided that they don't attempt to access any
instance data or other instance methods.
What is Static field?

12
To indicate that a field should only be stored once no matter how many instance of the class
we create.
What is Class?
A Class is the generic definition of what an object is a template.
The keyword class in C# indicates that we are going to define a new class (type of object)
What is Object?
Object is anything that is identifiable as a single material item.
Can Struct be inherited?
No, Struct can't be inherited as this is implicitly sealed.
What is Virtual method?
Virtual Method has implementation & provide the derived class with the option to override it.
What is Abstract method?
Abstract method doesn't provide the implementation & forces the derived class to override the
method.
What is Polymorphisms?
Polymorphism means one interface and many forms. Polymorphism is a characteristics of
being able to assign a different meaning or usage to something in different contexts
specifically to allow an entity such as a variable, a function or an object to have more than one
form.
What's AJAX?
AJAX (Asynchronous JavaScript and XML) is a newly coined term for two powerful browser
features that have been around for years, but were overlooked by many web developers until
recently when applications such as Gmail, Google Suggest, and Google Maps hit the streets.
Asynchronous JavaScript and XML, or Ajax (pronounced "Aye-Jacks"), is a web development
technique for creating interactive web applications using a combination of XHTML (or HTML)
and CSS for marking up and styling information.
(XML is commonly used, although any format will work, including preformatted HTML, plain
text, JSON and even EBML).
The Document Object Model manipulated through JavaScript to dynamically display and
interact with the information presented
The XMLHttpRequest object to exchange data asynchronously with the web server.
In some Ajax frameworks and in some situations, an IFrame object is used instead of the
XMLHttpRequest object to exchange data with the web server.
Like DHTML, LAMP, or SPA, Ajax is not a technology in itself, but a term that refers to the use
of a group of technologies together. In fact, derivative/composite technologies based

13
substantially upon Ajax, such as AFLAX, are already appearing.
Ajax applications are mostly executed on the user's computer; they can perform a number of
tasks without their performance being limited by the network.
This permits the development of interactive applications, in particular reactive and rich graphic
user interfaces.
Ajax applications target a well-documented platform, implemented by all major browsers on
most existing platforms.
While it is uncertain that this compatibility will resist the advent of the next generations of
browsers (in particular, Firefox), at the moment, Ajax applications are effectively crossplatform.
While the Ajax platform is more restricted than the Java platform, current Ajax applications
effectively fill part of the one-time niche of
Java applets: extending the browser with portable, lightweight mini-applications.
Ajax isnt a technology. Its really several technologies, each flourishing in its own right,
coming together in powerful new ways. Ajax incorporates:
* standards-based presentation using XHTML and CSS;
* dynamic display and interaction using the Document Object Model;
* data interchange and manipulation using XML and XSLT; * asynchronous data retrieval using
XMLHttpRequest;
* and JavaScript binding everything together.
Whos Using Ajax ?
Google is making a huge investment in developing the Ajax approach.
All of the major products Google has introduced over the last year Orkut, Gmail, the latest
beta version of Google Groups, Google Suggest, and Google Maps are Ajax applications.
(For more on the technical nuts and bolts of these Ajax implementations, check out these
excellent analyses of Gmail, Google Suggest, and Google Maps.) Others are following suit:
many of the features that people love in Flickr depend on Ajax, and Amazons A9.com search
engine applies similar techniques.
These projects demonstrate that Ajax is not only technically sound, but also practical for realworld applications. This isnt another technology that only works in a laboratory. And Ajax
applications can be any size, from the very simple, single-function Google Suggest to the very
complex and sophisticated Google Maps.
Whos Using Ajax ?
Google is making a huge investment in developing the Ajax approach.
All of the major products Google has introduced over the last year Orkut, Gmail, the latest
beta version of Google Groups, Google Suggest, and Google Maps are Ajax applications.
(For more on the technical nuts and bolts of these Ajax implementations, check out these

14
excellent analyses of Gmail, Google Suggest, and Google Maps.)
Others are following suit: many of the features that people love in Flickr depend on Ajax, and
Amazons A9.com search engine applies similar techniques.
These projects demonstrate that Ajax is not only technically sound, but also practical for realworld applications. This isnt another technology that only works in a laboratory. And Ajax
applications can be any size, from the very simple, single-function Google Suggest to the very
complex and sophisticated Google Maps.
At Adaptive Path, weve been doing our own work with Ajax over the last several months, and
were realizing weve only scratched the surface of the rich interaction and responsiveness that
Ajax applications can provide.
Ajax is an important development for Web applications, and its importance is only going to
grow. And because there are so many developers out there who already know how to use
these technologies, we expect to see many more organizations following Googles lead in
reaping the competitive advantage Ajax provides.
The biggest challenges in creating Ajax applications are not technical.
The core Ajax technologies are mature, stable, and well understood. Instead, the challenges
are for the designers of these applications: to forget what we think we know about the
limitations of the Web, and begin to imagine a wider, richer range of possibilities
Should I consider AJAX?
AJAX definitely has the buzz right now, but it might not be the right thing for you. AJAX is
limited to the latest browsers, exposes browser compatibility issues, and requires new skillsets for many.
There is a good blog entry by Alex Bosworth on AJAX Mistakes which is a good read before you
jump full force into AJAX.
On the other hand you can achieve highly interactive rich web applications that are responsive
and appear really fast.
While it is debatable as to whether an AJAX based application is really faster, the user feels a
sense of immediacy because they are given active feedback while data is exchanged in the
background.
If you are an early adopter and can handle the browser compatibility issues, and are willing to
learn some more skills, then AJAX is for you.
It may be prudent to start off AJAX-ifying a small portion or component of your application
first. We all love technology, but just remember the purpose of AJAX is to enhance your user's
experience and not hinder it.
Does AJAX work with Java?
Absolutely. Java is a great fit for AJAX! You can use Java Enterprise Edition servers to generate
AJAX client pages and to serve incoming AJAX requests, manage server side state for AJAX
clients, and connect AJAX clients to your enterprise resources.
The JavaServer Faces component model is a great fit for defining and using AJAX components.

15
Won't my server-side framework provide me with AJAX?
You may be benefiting from AJAX already. Many existing Java based frameworks already have
some level of AJAX interactions and new frameworks and component libraries are being
developed to provide better AJAX support.
I won't list all the Java frameworks that use AJAX here, out of fear of missing someone, but
you can find a good list at www.ajaxpatterns.org/Java_Ajax_Frameworks.
If you have not chosen a framework yet it is recommended you consider using JavaServer
Faces or a JavaServer Faces based framework.
JavaServer Faces components can be created and used to abstract many of the details of
generating JavaScript, AJAX interactions, and DHTML processing and thus enable simple AJAX
used by JSF application developer and as plug-ins in JSF compatible IDE's, such as Sun Java
Studio Creator.
1. Why so
A.
B.
C.
D.
2.

JavaScript and Java have similar name?


JavaScript is a stripped-down version of Java
JavaScript's syntax is loosely based on Java's
They both originated on the island of Java
None of the above

When a user views a page containing a JavaScript program, which machine actually
executes the script?
A. The User's machine running a Web browser
B. The Web server
C. A central machine deep within Netscape's corporate offices
D. None of the above

3. ______ JavaScript is also called client-side JavaScript.


A. Microsoft
B. Navigator
C. LiveWire
D. Native
4. __________ JavaScript is also called server-side JavaScript.
A. Microsoft
B. Navigator
C. LiveWire
D. Native
5. What are variables used for in JavaScript Programs?
A. Storing numbers, dates, or other values
B. Varying randomly
C. Causing high-school algebra flashbacks
D. None of the above
6. _____ JavaScript statements embedded in an HTML page can respond to user events such
as mouse-clicks, form input, and page navigation.
A. Client-side
B. Server-side
C. Local
D. Native
7. What should appear at the very end of your JavaScript?

16
The <script LANGUAGE="JavaScript">tag
A. The </script>
B. The <script>
C. The END statement
D. None of the above

8. Which of the following can't be done with client-side JavaScript?


A. Validating a form
B. Sending a form's contents by email
C. Storing the form's contents to a database file on the server
D. None of the above
9. Which of the following are capabilities of functions in JavaScript?
A. Return a value
B. Accept parameters and Return a value
C. Accept parameters
D. None of the above
10. Which of the following is not a valid JavaScript variable name?
A. 2names
B. _first_and_last_names
C. FirstAndLast
D. None of the above
11.

______ tag is an extension to HTML that can enclose any number of JavaScript
statements.
A. <SCRIPT>
B. <BODY>
C. <HEAD>
D. <TITLE>

12. How does JavaScript store dates in a date object?


A. The number of milliseconds since January 1st, 1970
B. The number of days since January 1st, 1900
C. The number of seconds since Netscape's public stock offering.
D. None of the above
13. Which
A.
B.
C.
D.

of the following attribute can hold the JavaScript version?


LANGUAGE
SCRIPT
VERSION
None of the above

14. What is the correct JavaScript syntax to write "Hello World"?


A. System.out.println("Hello World")
B. println ("Hello World")
C. document.write("Hello World")
D. response.write("Hello World")
15. Which of the following way can be used to indicate the LANGUAGE attribute?
A. <LANGUAGE="JavaScriptVersion">
B. <SCRIPT LANGUAGE="JavaScriptVersion">

17
C. <SCRIPT LANGUAGE="JavaScriptVersion"> JavaScript statements
</SCRIPT>
D. <SCRIPT LANGUAGE="JavaScriptVersion"!> JavaScript statements</SCRIPT>
16. Inside
A.
B.
C.
D.

which HTML element do we put the JavaScript?


<js>
<scripting>
<script>
<javascript>

17. What is the correct syntax for referring to an external script called " abc.js"?
A. <script href=" abc.js">
B. <script name=" abc.js">
C. <script src=" abc.js">
D. None of the above
18. Which
A.
B.
C.
D.

types of image maps can be used with JavaScript?


Server-side image maps
Client-side image maps
Server-side image maps and Client-side image maps
None of the above

19. Which
A.
B.
C.
D.

of the following navigator object properties is the same in both


navigator.appCodeName
navigator.appName
navigator.appVersion
None of the above

20. Which
A.
B.
C.
D.

is the correct way to write a JavaScript array?


var txt = new Array(1:"tim",2:"kim",3:"jim")
var txt = new Array:1=("tim")2=("kim")3=("jim")
var txt = new Array("tim","kim","jim")
var txt = new Array="tim","kim","jim"

Netscape and IE?

21. What does the <noscript> tag do?


A. Enclose text to be displayed by non-JavaScript browsers.
B. Prevents scripts on the page from executing.
C. Describes certain low-budget movies.
D. None of the above
22. If para1 is the DOM object for a paragraph, what is the correct syntax to change the text
within the paragraph?
A. "New Text"?
B. para1.value="New Text";
C. para1.firstChild.nodeValue= "New Text";
D. para1.nodeValue="New Text";
23. JavaScript entities start with _______ and end with _________.
A. Semicolon, colon
B. Semicolon, Ampersand
C. Ampersand, colon
D. Ampersand, semicolon
24. Which of the following best describes JavaScript?
A. a low-level programming language.
B. a scripting language precompiled in the browser.

18
C. a compiled scripting language.
D. an object-oriented scripting language.
25. Choose the server-side JavaScript object?
A. FileUpLoad
B. Function
C. File
D. Date
26. Choose the client-side JavaScript object?
A. Database
B. Cursor
C. Client
D. FileUpLoad
27. Which
A.
B.
C.
D.

of the following is not considered a JavaScript operator?


new
this
delete
typeof

28. ______method evaluates a string of JavaScript code in the context of the specified object.
A. Eval
B. ParseInt
C. ParseFloat
D. Efloat
29. Which of the following event fires when the form element loses the focus: <button>,
<input>, <label>, <select>, <textarea>?
A. onfocus
B. onblur
C. onclick
D. ondblclick
30. The syntax of Eval is ________________
A. [objectName.]eval(numeric)
B. [objectName.]eval(string)
C. [EvalName.]eval(string)
D. [EvalName.]eval(numeric)
31. JavaScript is interpreted by _________
A. Client
B. Server
C. Object
D. None of the above
32. Using
A.
B.
C.
D.

_______ statement is how you test for a specific condition.


Select
If
Switch
For

33. Which
A.
B.
C.

of the following is the structure of an if statement?


if (conditional expression is true) thenexecute this codeend if
if (conditional expression is true)execute this codeend if
if (conditional expression is true) {then execute this code>->}

19
D. if (conditional expression is true) then {execute this code}
34. How to create a Date object in JavaScript?
A. dateObjectName = new Date([parameters])
B. dateObjectName.new Date([parameters])
C. dateObjectName := new Date([parameters])
D. dateObjectName Date([parameters])
35. The _______ method of an Array object adds and/or removes elements from an array.
A. Reverse
B. Shift
C. Slice
D. Splice
36. To set
A.
B.
C.
D.

up the window to capture all Click events, we use which of the following statement?
window.captureEvents(Event.CLICK);
window.handleEvents (Event.CLICK);
window.routeEvents(Event.CLICK );
window.raiseEvents(Event.CLICK );

37. Which
A.
B.
C.
D.

tag(s) can handle mouse events in Netscape?


<IMG>
<A>
<BR>
None of the above

38. ____________ is the tainted property of a window object.


A. Pathname
B. Protocol
C. Defaultstatus
D. Host
39. To enable data tainting, the end user sets the _________ environment variable.
A. ENABLE_TAINT
B. MS_ENABLE_TAINT
C. NS_ENABLE_TAINT
D. ENABLE_TAINT_NS
40. In JavaScript, _________ is an object of the target language data type that encloses an
object of the source language.
A. a wrapper
B. a link
C. a cursor
D. a form

41. When a JavaScript object is sent to Java, the runtime engine creates a Java wrapper of
type ___________
A. ScriptObject
B. JSObject
C. JavaObject
D. Jobject
42.

_______ class provides an interface for invoking JavaScript methods and examining
JavaScript properties.

20
A.
B.
C.
D.

ScriptObject
JSObject
JavaObject
Jobject

43. _________ is a wrapped Java array, accessed from within JavaScript code.
A. JavaArray
B. JavaClass
C. JavaObject
D. JavaPackage
44. A ________ object is a reference to one of the classes in a Java package, such as
netscape.javascript .
A. JavaArray
B. JavaClass
C. JavaObject
D. JavaPackage
45. The JavaScript exception is available to the Java code as an instance of __________
A. netscape.javascript.JSObject
B. netscape.javascript.JSException
C. netscape.plugin.JSException
D. None of the above
46. To automatically open the console when a JavaScript error occurs which of the following is
added to prefs.js?
A. user_pref(" javascript.console.open_on_error", false);
B. user_pref("javascript.console.open_error ", true);
C. user_pref("javascript.console.open_error ", false);
D. user_pref("javascript.console.open_on_error", true);
47. To open a dialog box each time an error occurs, which of the following is added to
prefs.js?
A. user_pref("javascript.classic.error_alerts", true);
B. user_pref("javascript.classic.error_alerts ", false);
C. user_pref("javascript.console.open_on_error ", true);
D. user_pref("javascript.console.open_on_error ", false);
48. The syntax of a blur method in a button object is ______________
A. Blur()
B. Blur(contrast)
C. Blur(value)
D. Blur(depth)
49. The syntax of capture events method for document object is ______________
A. captureEvents()
B. captureEvents(args eventType)
C. captureEvents(eventType)
D. captureEvents(eventVal)
50. The syntax of close method for document object is ______________
A. Close(doc)
B. Close(object)
C. Close(val)
D. Close()

You might also like