- What a is platform independent software?
- It is a case sensitive language.
- It can handle date and time very effectively.
- What are different types of scripting?
Server side scripting and Client side scripting.
- Client-side Scripting: the script resides on client computer (browser) and can run on the client.
- Server-side Scripting: the script resides on web server.
- The script resides on client computer (browser) and that can run on the client.
- These types of scripts are placed inside an HTML document.
Server side scripting:
- The script resides on web server.
- To execute the script it must be activated by client, and then it is executed on web server.
- What is the Difference between server side scripting and client side scripting?
Server Side Scripting
Client Side Scripting
1. Server-side scripting is used at the backend, where the source code is not visible or is hidden at the client side (browser).
1. Client-side scripting is used at the frontend which users can see from the browser.
2. Server-side scripting is more secure.
2. Client-side scripting is less secure.
3. When a Server-Side script is processed, it communicates to the server.
3. Client-side scripting does not need any server interaction.
4. Server-side scripting is useful in customizing the web pages and implements the dynamic changes in the websites.
4. Client- side scripts are generally used for validation purpose and effectively minimize the load to the server.
5. PHP, ASP.net, Ruby, ColdFusion, Python, C# are examples of server side scripting languages.
6. Web Server Software is required to execute server-side script
6. Client-side script requires web browser as an interface.
- How does the Switch case structure work?
- The switch statement tests the value of a given expression against a list of case values.
- When a match is found, a block of statement associated with that case is executed.
- Why should there not be duplicity between the Switch cases?
- The switch statement tests the value of given expression against a list of case values
- When a match is found, a block of statement associated with that case is executed. Thus, there should not be duplicity between the cases.
- What is the syntax for Switch Case Statement?
statement block 1;
statement block 2;
case value n:
statement block n;
- What is a Looping Statement?
- These are used to execute statements repeatedly while creating programming logic.
- Iteration is the execution of one or a group of statements of a code for fixed number of times or till the condition is satisfied.
- The condition is a Boolean condition.
- For…loop and while…loop are examples of looping statements.
- What is “for… loop”?
- This loop executes the statement in the statement block as long as the condition is true.
- When condition becomes false, control is transferred out of the loop and executes the remaining program.
- It combines initialization, condition and loop iteration in a single statement.
- Initialization is assigning initial value to the variable, which executes only once, and then the condition is checked.
In above example “i” is the running variable and “i++” is incremental iteration of for loop.
- How does “while… loop” work?
- First is initialization.
- Check condition: Then the loop will be executed repeatedly as long as the condition is true.
- Iteration: If condition is always true, then loop would be executed infinitely, so after some execution condition becomes false.
VAR a=1 while(a<=5)
- What is a break statement?
- A break statement is used to jump out of the loop.
- It is used to make an early exit out of a loop.
- When control encounters the keyword ‘break’, it automatically passes to the next statement after the loop.
- What is a continue statement?
- An object can group data together with functions needed to manipulate it.
- Real world objects examples are table, board, television, bicycle, shop, bus, car, monitor etc.
- Example: car object. It has properties like Name, Model, Weight, Color etc. and methods like Start, Stop and Brake etc.
- What is a Document Object Model?
The way in which HTML document content is accessed and modified is called as document object model. It is a programming interface for HTML and XML documents.
- What is W3C (World Wide Web Consortium) Document Object Model?
The W3C Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document.
- What is the innerHTML property?
- The innerHTML property is useful for getting html element and changing its content.
- It can be used to get or change any html element, including <html> and <body>.
- What is the use of the Window Object Method prompt()?
Ans. Window Object Method prompt() is used to display a dialog box to get input from the user.
- Why do we use Window Object method setTimeout()?
Ans. setTimeout() method is used to call a function or evaluate an expression after a specified number of milliseconds.
Ans. The “onchange” event occurs when the user changes the content of an element or selects dropdown value.
E.g. for textbox, password, select box, textarea, etc.
- Which event handler occurs when document/page has been unloaded or closes?
- What is the use of the String Object method indexOf() ?
Ans. It returns the index of the first occurrence of specified character in a given string, or -1 if it never occurs, so with that index you can determine if the string contains the specified character.
- Which String object method is used for returning the index of the last occurrence of specified character in given string?
- Which String object methods are used to convert string to lower/ upper case?
- toLowerCase() method converts a string to lower case
- toUpperCase() method converts a string to upper case
- Why do we use substr() String object method?
Ans. substr() string object method is used to return the characters you specified.
- Syntax: string.substr(start, length)
- Example: (14,7) returns 7 characters, from the 14th character.
- What is the use of the String object method: substring()?
Ans. It returns the characters you specified
- Syntax: string.substring(start, end)
- Example: (7,14) returns ALL characters between the 7th AND the 14th.
- What is the use of math object method: ceil(x)?
Ans. Math method ceil(x) is used to return the next integer Greater Than or Equal to a given number. (That is, rounding up the given number.)
- What is the use of math object method floor(x)?
Ans. Math method floor(x) is used to return the next integer less than or equal to a given number. (That is, rounding down the given number.)
- Which Math method returns the highest-valued number in a list of numbers?
Ans. max(n1, n2, n3,….n)
Where(n1, n2, n3,….n) are the list to compare.
- ____ Math method returns the lowest -valued number in a list of numbers.
Ans. min(n1, n2, n3,….n)
Where (n1, n2, n3,….n) are the list to compare.
- What are the different ways to create new Date object?
- var currentdate=new Date();
- var currentdate =new Date(milliseconds);
- var currentdate =new Date(dateString);
- var currentdate =new Date (year, month, day, hours, minute, seconds, milliseconds);
- What is the use of isFixed() Number object method?
Ans. isFixed() Number method is used to return the string that represents a number with exact digits after a decimal point.
- What is the use of Array method indexOf()?
Ans. It searches the array for an element and returns its position.
- Which array method is used to checks whether an object is an array?