Interview Question and Answer for Ajax
1) What is Javascript?
Answer:- An object-oriented computer programming language commonly used to create interactive effects within web browsers.
2) What is jQuery?
Answer:- jQuery is a cross-platform JavaScript library designed to simplify the client-side scripting of HTML. jQuery is the most popular JavaScript library in use today, with installation on 65% of the top 10 million highest-trafficked sites on the Web. jQuery is free, open-source software licensed.
3) Difference Between javascript and JQuery?
Answer:- The main difference is: JavaScript is a programming language, while jQuery is a library.
4) $("div").css("width","300px").add("p").css("background-color","blue");?
Answer:- This code will make the div tag size with width - 300px, and add a paragraph tag with background-color blue.
5) More efficient Lines?
document.get.ElementById("logo");
OR
$("#logo");
Answer:- $("#logo"); is the more efficient because it uses the JQuery and it takes the less space.
6) What does dollar Sign($) means in Jquery?
Answer:- The $ is just a function. It is actually an alias for the function called jQuery, so your code can be written like this with the exact same results:
jQuery('#text').click(function () { jQuery('#text').css('color','red');});
7) Difference between ID selector and class selector in JQuery?
Answer:- The $ is just a function. It is actually an alias for the function called jQuery, so your code can be written like this with the exact same results:
8) How do you hide an div on a button click using jQuery?
Answer:- $('#btn').onclick(funtction () {
$("div").css("visibility","hidden");
9) How do you set attribute using JQuery?
Answer:- $("button").click(function(){
$("#m3w").attr("href", "http://www.myweb.com/jQuery");
10) How to submit form without using submit button?
Answer:- document.formname.submit();
Interview Question and Answer for MySql
1) What is MySql?
Answer:- With PHP, you can connect and manipulate databases.
MySQL is the most popular database system used with PHP.
2) List down 10 data types in MySql?
Answer:- Int, Float, Varchar, enum, date, double, time, boolean, datetime
3) Difference between primary key and unique key?
Answer:- Each table must have at most ONE primary key but it can have multiple unique key. A primary key is used to uniquely identify a table row. A primary key cannot be NULL since NULL is not a value.
4) Difference between group by and order by?
Answer:- Group By is use to group the same values and order by is use to give the output of sql query in Ascending and Descending order.
5) Difference between float and double?
Answer:- The Decimal, Double, and Float variable types are different in the way that they store the values. Precision is the main difference where float is a single precision (32 bit) floating point data type, double is a double precision (64 bit) floating point data type and decimal is a 128-bit floating point data type.
6) What do you mean by % and _in the LIKE statement?
Answer:- % specify that there may or may not be any character whereas _ specify that there must only one character.
7) How can we get the number of rows affected by query?
Answer:- mysql_affected_rows(mysql_query(“SELECT * FROM table_name”));
8) What is the difference between mysql_fetch_array and mysql_fetch_object?
Answer:- The mysql_fetch_array() function fetches a result row as an associative array, a numeric array, or both.
The mysql_fetch_object() function returns the current row of a resultset, as an object.
9) How to display top 50 rows?
Answer:- By using LIMIT 0, 50;
10) How to display the structure of the table?
Answer:- By using desc table_name;
Interview Question and Answer for PHP
1) What is LAMP?
Answer:- LAMP is an open source Web development platform that uses Linux as the operating system, Apache as the Web server, MySQL as the relational database management system and PHP as the object-oriented scripting language.
2) What is the difference between client side language and server side language, give examples?
Answer:- A Client side language is run on the client browser and the output is displayed on the client browser whereas server side language is run on the server and return back to the client browser with the information / errors.
3) What is the use of header() function in php?
Answer:- A header() function is used to redirect the pages.
4) What are the different types of errors in php?
Answer:- E_ERROR: A fatal error that causes script termination.
E_WARNING: Run-time warning that does not cause script termination.
E_PARSE: Compile time parse error.
E_NOTICE: Run time notice caused due to error in code.
5) Difference between GET and POST?
Answer:- We can send 1024 bytes using GET method but POST method can transfer large amount of data and POST is the secure method than GET method.
6) Difference between $_GET and $_POST?
Answer:- $_GET is an array of variables passed to the current script via the URL parameters.
$_POST is an array of variables passed to the current script via the HTTP POST method.
7) What is $_REQUEST method?
Answer:- $_REQUEST, by default, contains the contents of $_GET, $_POST and $_COOKIE.
8) What is difference between required_once(), required(), include()?
Answer:- 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.
9) Explain the steps to connect with database?
Answer:- //Step1
$db = mysql_connect("localhost","username","password");
if (!$db) {
die("Database connection failed miserably: " . mysql_error());
}
//Step2
$db_select = mysql_select_db("databasename",$db);
if (!$db_select) {
die("Database selection also failed miserably: " . mysql_error());
}
10) Write down your own encryption algorithm?
Answer:- <?php
$str = "Hello";
$str1 = "123abc";
$strs = $str1.$str.$str1;
echo $strs;
?>
11) How to get value of current session id?
Answer:- by using session_id();
12) Explain some array functions?
Answer:- is_array — Finds whether a variable is an array
explode — Split a string by string
implode — Join array elements with a string
split — Split string into array by regular expression
preg_split — Split string by a regular expression
unset — Unset a given variable
13) What will be the output of following
date(“Y-m-d H:i:s”);
date(“y-M-D”);?
Answer:- 2015-11-03 11:15:23
15-Nov-Tue
14) How to get IP Address of user?
Answer:- $_SERVER['REMOTE_ADDR']
15) Explain some string function?
Answer:- echo Output one or more strings
explode — Split a string by string
fprintf — Write a formatted string to a stream
ltrim — Strip whitespace (or other characters) from the beginning of a string
rtrim — Strip whitespace (or other characters) from the end of a string
trim — Strip whitespace (or other characters) from the beginning and end of a string
str_replace — Replace all occurrences of the search string with the replacement string
strlen — Get string length
substr — Return part of a string
16) Explain isset and empty. Difference between these two?
Answer:- isset(); checks if the variable is literally set, as in the variable actually points to a value something.empty(); checks if the value the variable points to contains anything.
Comments
Post a Comment