All HTML Interview Questions And Answers

What is HTML?
Hyper Text Markup Language,which allows an individual special code to
create web pages to be viewed on the Internet.It’s the default markup language used for displaying web pages.

What is a DOCTYPE?
<!DOCTYPE> is used to inform the browser as to which version of HTML the current web page is using.
The doctype declaration refers to a Document Type Definition (DTD) which specifies the rules for the markup language,


What are meta tags and why it is used?
The <meta> tag always goes inside the head element. They can be used by browsers, search engines or other web services.


What is SPAN?
The SPAN having notation as:<SPAN> </SPAN>is used for highlighting text
of any color desired for adding colored text for adding background image to text.
 SPAN does not cause a line break.

 What is the format for commenting in a HTML document?
 <!-- comment here -->
 It must be noted that comments are not displayed in the browser and is visible only if we view the code.

 How can you make images clickable?
 image tag by the “a tag”.
 <a href=”http://test.com”>
 <img src=”http://test.com/some-image.jpg” alt=”some text” />
  </a>

what is Hyperlinks?
<a href="http://www.kumquat.com/archive.html">
Kumquat Archive</a>
The anchor (<a>) tag is the HTML/XHTML feature
for defining both the source and the destination of a hyperlink

What is <hr> Tag?
The <hr> tag tells the browser to insert a horizontal rule across the display window.

find the number of parameters passed into function in PHP?

func_num_args() function returns the number of parameters/arguments passed to a function in PHP.

difference between include and require?


Answer: It"s how they handle failures. If the file is not found by require(), it will cause a fatal error and halt the
execution of the script. If the file is not found by include(), a warning will be issued, but execution will
continue.

Use mysqldump to create a copy of the database?

mysqldump -h mysqlhost -u username -p mydatabasename > tgdbdump.sql

What is SERIAL data type in MySQL?

BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT

What’s the default port for MySQL Server?

3306

Conditional Functions mysql

The IF() Function

The IF() function provides a way to return a value based on a condition within a query.
The first argument is a condition that is evaluated for each row of the query. The value in the second is returned if the condition is trUE, and the third argument is returned if it is FALSE.
The following example is a very simple shipping rate calculator. If the product weight is less than 5 pounds, shipping costs $1.99; otherwise, it costs $2.99.
mysql> SELECT code, weight, IF(weight < 5, 1.99, 2.99)
    -> FROM products;
+------+--------+------------------------------+
| code | weight |    IF(weight <5, 1.99, 2.99) |
+------+--------+------------------------------+
| MINI |   1.50 |                         1.99 |
| MIDI |   4.50 |                         1.99 |
| MAXI |   8.00 |                         2.99 |
+------+--------+------------------------------+
3 rows in set (0.00 sec) 
 

The CASE Statement

The CASE statement is a multiple-valued conditional construct. Suppose you wanted to set three or more shipping rates based on weight. This would require a complex series of nested IF() functions.
The following example uses a CASE statement to determine the shipping rate based on three different weight bands:
mysql> SELECT code, weight,
    ->        CASE WHEN weight < 2 THEN 1.99
    ->             WHEN weight < 5 THEN 2.99
    ->             ELSE 4.99 END as shipping
    -> FROM products; 
+------+--------+----------+
| code | weight | shipping |
+------+--------+----------+
| MINI |   1.50 |     1.99 |
| MIDI |   4.50 |     2.99 |
| MAXI |   8.00 |     4.99 |
+------+--------+----------+
3 rows in set (0.00 sec)
 

Combined Queries-UNION

Mosy SQL queries contain just one SELECT statement that can return data from one table, or several tables using a join. The technique of combining two or more independent queries into a single data set is usually known as a union or a compound query.
You might want to use this technique to retrieve records from two tables that have a similar structure in a single query. For instance, suppose you have archived off some data so that you have a customers table that contains your current customers and another table called old_customers.
These tables would have the same structureor at least would share many common columns if new columns had been added to the customers table since the archive took place. Therefore, you could perform a query on this table that takes into account both current and archived customers. This would look something like the following:


SELECT name, telephone, email
FROM customers
UNION
SELECT name, telephone, email
FROM old_customers;
 
 

You can also use UNION to perform two different queries on the same table and combine the two results into a single data set.

mysql> SELECT first_name, last_name
    -> FROM customer_contacts
    -> WHERE customer_code = 'SCICORP'
    -> UNION
    -> SELECT first_name, last_name
    -> FROM customer_contacts
    -> WHERE customer_code = 'PRESINC';
+------------+-----------+
| first_name | last_name |
+------------+-----------+
| Albert     | Einstein  |
| Charles    | Darwin    |
| Marie      | Curie     |
| Benjamin   | Franklin  |
| Abraham    | Lincoln   |
| Richard    | Nixon     |
| Franklin   | Roosevelt |
| Theodore   | Roosevelt |
+------------+-----------+
8 rows in set (0.01 sec)

What is SQL Injection?

SQL Injection is the hacking technique which attempts to pass SQL commands (statements) through a web application for execution by the backend database.

it can be prevented by mysql_real_escape_string() function of PHP.

Such features as login pages, support and product request forms, feedback forms, search pages, shopping carts and the general delivery of dynamic content, shape modern websites and provide businesses with the means necessary to communicate with prospects and customers.

keep your session secure php

  1. Use SSL when authenticating users or performing sensitive operations.
  2. Regenerate the session id whenever the security level changes (such as logging in). You can even regenerate the session id every request if you wish.
  3. Have sessions time out
  4. Don't use register globals
  5. Store authentication details on the server. That is, don't send details such as username in the cookie.
  6. Check the $_SERVER['HTTP_USER_AGENT']. This adds a small barrier to session hijacking. You can also check the IP address. But this causes problems for users that have changing IP address due to load balancing on multiple internet connections etc (which is the case in our environment here).
  7. Lock down access to the sessions on the file system or use custom session handling
  8. For sensitive operations consider requiring logged in users to provide their authenication details again.