Monday, October 20, 2008

Javascript FAQs

1.) What Boolean operators are not supported by JavaScript?
A) && (AND)
B) (OR)
C)! (NOT)
D) All the above.
E) None of the above.
Ans: E)

2.) What is a number in JavaScript, derived by dividing negative number by zero called?
A) Negative finite.
B) Negative imperfect.
C) Negative infinity.
D) None of the above.
Ans: c)

3.) What does is Nan function do?
A) Return true if the argument is not a number.
B) Return true if the argument is a number.
C) Return true if the argument is divided by zero.
D) Return true if the argument is a perfect square.
Ans: A)

4.) How to declare the methods in Javascript?
Methods are the actions that can be performed on objects.
Example:
script type=”text/javascript”>var str=”Hello world!”
document.write(str.toUpperCase())
In the above example UpperCase() method is used to print the string in Uppercases.

5.) What is variable typing in javascript?
It is perfectly legal to assign a number to a variable and then assign a string to the same variable as follows
Example: i = 10;i = “string”;

6.) What is JavaScript?
Mention its various types.JavaScript is a platform-independent, event-driven, interpreted client-side scripting .The various types are Number, String, Boolean, Function, Object, Null, Undefined.

7.) How do I print JavaScript output?
JavaScript programs cannot directly access printers. However, the user can print out everything on the Web page, including the output of JavaScript programs, by using the File Print menu of the browser.

8.)How can I prevent an html page from being printed by a browser? Include a style sheet reference or a style sheet section with a media type of print. Set a rule for BODY with one entry, display:none.

9.) How to add a combo box dynamically at run time in Java script?
for (var i=0;i<5;i++)
{ document.forms[0].cmb1.options[i]= new Option("Test"+i,i)}

10.) What are the security related issues in JavaScript scripts?
Basically the source code of the Javascript will be visible when we select the source,hence the javascript part of the code is fully transparent.Secondly javascripts can be disabled on the browser easily.

11.) What is negative infinity?
It’s a number in JavaScript, derived by dividing negative number by zero.

12.) How to read and write a file using javascript?
I/O operations like reading or writing a file is not possible with client-side javascript. However , this can be done by coding a Java applet that reads files for the script.

Saturday, October 18, 2008

PHP

PHP stands for Hypertext Preprocessor. It is a server-side programming language specifically designed for creating dynamic web pages. The language was originally developed in 1994 by Rasmus Lerdorf and has since been expanded to become one of the WWW's most popular scripting languages. According to 2005 Netcraft statistics, PHP is currently being used in over 23,000,000 domains. Like other types of server-side languages such as ASP, ASP.NET, and JSP, PHP code is processed on the web server and generates the XHTML code or other output that can be viewed in the browser. Unlike other server-side languages, PHP is an open source product, meaning everyone has access to the source code and can use, alter, and redistribute it all without charge.
The current version of PHP and the version covered in this tutorial is 5. This tutorial is by no means a complete coverage of the PHP language. It is designed to demonstrate some of the most common features and applications of PHP.
PHP 5 can be run on just about any type of operating system and Web server. However, in order for PHP scripts to be processed, the PHP interpreter must be installed. The software is available in two forms - complete source code and executable binaries. These days, most Linux systems come with the PHP source code. For non-Unix/Linux systems, binaries can be downloaded from here:http://www.php.net/downloads.php
For more information about PHP please visit http://www.php.net