0% found this document useful (0 votes)
53 views9 pages

Basic Interview Questions

Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1/ 9

what the use of $ symbol in Jquery?

$ Symbol is just replacement of jquery means at the place of $ you may use jquery hence $ symbol is used for indication that this line used for jquery universal selector in query is *

Explain bind() vs live() methods

down vote

accept ed

.bind() attacheds events to elements that exist or match the selecto made. Any elements created afterwards or that match going forward changed, will not fire the bound event. .live() works for existing and future matching elements.

What is the difference between jQuery find and children methods


The difference between find() and children() methods are that the children only travels a single level down the DOM tree while the find travels at all level down the DOM tree.

Array Sort:
Normal array: array.sort(); array.reverse(); numerical array: var points = [40,100,1,5,25,10]; points.sort(function(a,b){return a-b});

String Operation
//lastIndexOf(substr, [start]) var myString = 'javascript rox'; console.log(myString.lastIndexOf('r'));

//replace(substr, replacetext) var myString = '999 JavaScript Coders'; console.log(myString.replace(/JavaScript/i, "jQuery"));); finite value check
isFinite(value) What does isNaN function do?

Return true if the argument is not a number.

Synchronous and Asynchronous AJAX request


synchronous where the script stops and waits for the server to send back a reply before continuing and asynchronous where the script allows the page to continue to be processed and will handle the reply if and when it arrives.

By default, all requests are sent asynchronously. true and false for synchronous

animation zoom
$("#imgId").animate({ height: '800', width: '800' }, 1000, function() {

});

Replace A div with a header in jquery


$('div.second').replaceWith('<h2>New heading</h2>');

Append in jquery
$('.box').append("<div class='newbox'>I'm new box by append</div>"); $("<div class='newbox'>I'm new box by appendTo</div>").appendTo('.box');

Select first and last child


$("#master > :first-child").addClass("grid_4 alpha"); $("#master > :last-child").addClass("grid_4 omega");

How do you submit a form using Javascript?


Use document.forms[0].submit();
How to get the contents of an input box using Javascript? Document.getElementById(id).value;

How do you create a new object in JavaScript?


var obj = new Object(); or var obj = {};

How to disable an HTML object ?


document.getElementById("myObject").disabled = true;

How to change style on an element?


document.getElementById("myText").style.color = "green";

document.getElementById("myText").style.fontSize = "20";

How to reload the current page ?


window.location.reload(true);

What does break and continue statements do?


Continue statement continues the current loop (if label not specified) in a new iteration whereas break statement exits the current loop.

How do you target a specific frame from a hyperlink?


Include the name of the frame in the target attribute of the hyperlink. <a href=mypage.htm target=myframe>>My Page</a>

What is the difference between HTML and HTML5 ?


Ans: HTML5 is nothing more then upgraded version of HTML where in HTML5 Lot of new future like Video, Audio/mp3, date select function , placeholder , Canvas, 2D/3D Graphics, Local SQL Database added so that no need to do external plugin like Flash player or other library

SQL
What is DDL, DML and DCL ?

If you look at the large variety of SQL commands, they can be divided into three large subgroups. Data Definition Language deals with database schemas and descriptions of how the data should reside in the database, therefore language statements like CREATE TABLE or ALTER TABLE belong to DDL. DML deals with data manipulation, and therefore includes most common SQL

statements such SELECT, INSERT, etc. Data Control Language includes commands such as GRANT, and mostly concerns with rights, permissions and other controls of the database system
How do you return the a hundred books starting from 25th?

SELECT book_title FROM books LIMIT 25, 100

sort

order by col_name

How would you change a column from VARCHAR(10) to VARCHAR(50)?


ALTER TABLE table CHANGE col_name VARCHAR(50).

Deference between delete and drop a table How do you get a portion of a string?
SELECT SUBSTR(title, 1, 10) from table The RIGHT JOIN keyword returns all the rows from the right table (table_name2), even if there are no matches in the left table (table_name1). The LEFT JOIN keyword returns all rows from the left table (table_name1), even if there are no matches in the right table (table_name2). The INNER JOIN keyword returns rows when there is at least one match in both tables

Create database syntax CSS


What is CSS?
1. CSS stands for Cascading Style Sheets and is a simple styling language

The possible value of the "Position" attributes are absolute fixed inherit relative static

How to display a link without underline and display underline when mouseover on the link using CSS?
a{text-decoration:none;} a:hover{text-decoration:underline;} different type of embedding stylesheet 1) Inline style 2) External style sheet 3) Internal style sheet

What is the <!DOCTYPE> ? Is it necessary to use in HTML5 ?


Ans: The <!DOCTYPE> is an instruction to the web browser about what version of HTML the page is written in. AND The <! DOCTYPE> tag does not have an end tag and It is not case sensitive. The <!DOCTYPE> declaration must be the very first thing in HTML5 document, before the <html>tag. As In HTML 4.01, all <! DOCTYPE > declarations require a reference to a Document Type Definition (DTD), because HTML 4.01 was based on Standard Generalized Markup Language (SGML). WHERE AS HTML5 is not based on SGML, and therefore does not require a reference to a

Document Type Definition (DTD).

What is the use of localStorage in HTML5?


Ans: Before HTML5 LocalStores was done with cookies. Cookies are not very good for large amounts of data, because they are passed on by every request to the server, so it was very slow and in-effective. In HTML5, the data is NOT passed on by every server request, but used ONLY when asked for. It is possible to store large amounts of data without affecting the websites performance.and The data is stored in different areas for different websites, and a website can only access data stored by itself 1. 2. 3. 4. 5. 6. 7. 8. <script type=text/javascript> localStorage.name=PHPZAG; document.write(localStorage.name); </script> <script type=text/javascript> localStorage.address=Newyork USA; document.write(localStorage.address); </script>

Canvas
The HTML5 <canvas> element is used to draw graphics, on the fly, via scripting (usually JavaScript). 1. 2. 3. 4. 5. 6. 7. 8. 9. <canvas id=pcdsCanvas width=500 height=400> </canvas> <script type=text/javascript> var pcdsCanvas=document.getElementById(phpzagCanvas ); var pcdsText=pcdsCanvas.getContext(2d); pcdsText.fillStyle=#82345c; pcdsText.fillRect(0,0,150,75); </script>

WHAT ARE THE DIFFERENT TYPES OF STORAGE IN HTML5?


Ans: HTML5 offers two new objects for storing data on the client: LocalStorage stores data with no time limit 1. 2. 3. 4. <script type=text/javascript> localStorage.lastname=ZAG; document.write(localStorage.lastname); </script>

SessionStorage stores data for one session.The data is deleted when the user closes the browser window. 1. 2. 3. 4. <script type=text/javascript> sessionStorage.lastname=ZAG; document.write(sessionStorage.lastname); </script>

Yes we can use below new input type Attribute in HTML5 Type Value The input is of type tel telephone number The input field is a search search field url email datetime date a URL One or more email addresses A date and/or time A date

month week time datetimelocal number range color

A month A week The input value is of type time A local date/time A number A number in a given range A hexadecimal color, like #82345c

You might also like