50 COMMON INTERVIEW QUESTIONS AND ANSWERS

Review these typical interview questions and think about how you would answer them. Read the questions listed; you will also find some strategy suggestions with it.

1. Tell me about yourself?
Ans : The most often asked question in interviews. You need to have a short statement prepared in your mind. Be careful that it does not sound rehearsed. Limit it to work-related items unless instructed otherwise. Talk about things you have done and jobs you have held that relate to the position you are interviewing for. Start with the item farthest back and work up to the present.

2. Why did you leave your last job?
Ans: Stay positive regardless of the circumstances. Never refer to a majorproblem with management and never speak ill of supervisors, co-workers or the organization. If you do, you will be the one looking bad. Keep smiling and talk about leaving for a positive reason such as an opportunity, a chance to do something special or other forward-looking reasons.

3. What experience do you have in this field?
Ans: Speak about specifics that relate to the position you are applying for. If you do not have specific experience, get as close as you can.

4. Do you consider yourself successful?
Ans:You should always answer yes and briefly explain why. A good explanation is that you have set goals, and you have met some and are on track to achieve the others.

5. What do co-workers say about you?
Ans: Be prepared with a quote or two from co-workers. Either a specific statement or a paraphrase will work. Jill Clark, a co-worker at Smith Company, always said I was the hardest workers she had ever known. It is as powerful as Jill having said it at the interview herself.

6. What do you know about this organization?
This question is one reason to do some research on the organization before the interview. Find out where they have been and where they are going. What are the current issues and who are the major players?

7. What have you done to improve your knowledge in the last year?
Try to include improvement activities that relate to the job. A wide variety of activities can be mentioned as positive self-improvement. Have some good ones handy to mention.

8. Are you applying for other jobs?
Be honest but do not spend a lot of time in this area. Keep the focuson this job and what you can do for this organization. Anything else is a distraction.

9. Why do you want to work for this organization?
This may take some thought and certainly, should be based on the research you have done on the organization. Sincerity is extremely important here and will easily be sensed. Relate it to your long-term career goals.

10. Do you know anyone who works for us?
Be aware of the policy on relatives working for the organization. This can affect your answer even though they asked about friends not relatives. Be careful to mention a friend only if they are well thought of.

11. What is your Expected Salary? A loaded question. A nasty little game that you will probably lose if you answer first. So, do not answer it. Instead, say something like, That’s a tough question. Can you tell me the range for this position? In most cases, the interviewer, taken off guard, will tell you. If not, say that it can depend on the details of the job. Then give a wide range.

12. Are you a team player?
You are, of course, a team player. Be sure to have examples ready. Specifics that show you often perform for the good of the team rather than for yourself are good evidence of your team attitude. Do not brag, just say it in a matter-of-fact tone. This is a key point.

13. How long would you expect to work for us if hired?
Specifics here are not good. Something like this should work: I’d like it to be a long time. Or As long as we both feel I’m doing a good job.

14. Have you ever had to fire anyone?
How did you feel about that? This is serious. Do not make light of it or in any way seem like you like to fire people. At the same time, you will do it when it is the right thing to do. When it comes to the organization versus the individual who has created a harmful situation, you will protect the organization. Remember firing is not the same as layoff or reduction in force.

15. What is your philosophy towards work?
The interviewer is not looking for a long or flowery dissertation here. Do you have strong feelings that the job gets done? Yes. That’s the type of answer that works best here. Short and positive, showing a benefit to the organization.

16. If you had enough money to retire right now, would you?
Answer yes if you would. But since you need to work, this is the type of work you prefer. Do not say yes if you do not mean it.

17. Have you ever been asked to leave a position?
If you have not, say no. If you have, be honest, brief and avoid saying negative things about the people or organization involved.

18. Explain how you would be an asset to this organization?
You should be anxious for this question. It gives you a chance to highlight your best points as they relate to the position being discussed. Give a little advance thought to this relationship.

19. Why should we hire you?
Point out how your assets meet what the organization needs. Do not mention any other candidates to make a comparison.

20. Tell me about a suggestion you have made?
Have a good one ready. Be sure and use a suggestion that was accepted and was then considered successful. One related to the type of work applied for is a real plus.

21. What irritates you about co-workers?
This is a trap question. Think real hard but fail to come up with anything that irritates you. A short statement that you seem to get along with folks is great.

22. What is your greatest strength?
Numerous answers are good, just stay positive. A few good examples: Your ability to prioritize, Your problem-solving skills, Your ability to work under pressure, Your ability to focus on projects, Your professional expertise, Your leadership skills, Your positive attitude.

23. Tell me about your dream job?
Stay away from a specific job. You cannot win. If you say the job you are contending for is it, you strain credibility. If you say another job is it, you plant the suspicion that you will be dissatisfied with this position if hired. The best is to stay genetic and say something like: A job where I love the work, like the people, can contribute andcan’t wait to get to work.

24. Why do you think you would do well at this job?
Give several reasons and include skills, experience and interest.

25. What are you looking for in a job?
See answer # 23

26. What kind of person would you refuse to work with?
Do not be trivial. It would take disloyalty to the organization, violence or lawbreaking to get you to object. Minor objections will label you as a whiner.

27. What is more important to you: the money or the work?
Money is always important, but the work is the most important. There is no better answer.

28. What would your previous supervisor say your strongest point is?
There are numerous good possibilities: Loyalty, Energy, Positive attitude, Leadership, Team player, Expertise,Initiativ e, Patience, Hard work, Creativity, Problem solver.

29. Tell me about a problem you had with a supervisor?
Biggest trap of all. This is a test to see if you will speak ill of your boss. If you fall for it and tell about a problem with a former boss, you may well below the interview right there. Stay positive and develop a poor memory about any trouble with a supervisor.

30. What has disappointed you about a job?
Don’t get trivial or negative. Safe areas are few but can include: Not enough of a challenge. You were laid off in a reduction Company did not win a contract, which would have given you more responsibility.

31. Tell me about your ability to work under pressure.
You may say that you thrive under certain types of pressure. Give an example that relates to the type of position applied for.

32. Do your skills match this job or another job more closely?
Probably this one. Do not give fuel to the suspicion that you may want another job more than this one.

33. What motivates you to do your best on the job?
This is a personal trait that only you can say, but good examples are: Challenge, Achievement, Recognition

34. Are you willing to work overtime? Nights? Weekends?
This is up to you. Be totally honest.

35. How would you know you were successful on this job?
Several ways are good measures: You set high standards for yourself and meet them. Your outcomes are a success. Your boss tell you that you are successful

36. Would you be willing to relocate if required?
You should be clear on this with your family prior to the interview if you think there is a chance it may come up. Do not say yes just to get the job if the real answer is no. This can create a lot of problems later on in your career. Be honest at this point and save yourself future grief.

37. Are you willing to put the interests of the organization ahead of your own?
This is a straight loyalty and dedication question. Do not worry about the deep ethical and philosophical implications. Just say yes.

38. Describe your management style ?
Try to avoid labels. Some of the more common labels, like progressive, salesman or consensus, can have several meanings or descriptions depending on which management expert you listen to. The situational style is safe, because it says you will manage according to the situation, instead of one size fits all.

39. What have you learned from mistakes on the job?
Here you have to come up with something or you strain credibility. Make it small, well intentioned mistake with a positive lesson learned. An example would be working too far ahead of colleagues on a project and thus throwing coordination off.

40. Do you have any blind spots?
Trick question. If you know about blind spots, they are no longer blind spots. Do not reveal any personal areas of concern here. Let them do their own discovery on your bad points. Do not hand it to them.

41. If you were hiring a person for this job, what would you look for?
Be careful to mention traits that are needed and that you have.

42. Do you think you are overqualified for this position?
Regardless of your qualifications, state that you are very well qualified for the position.

43. How do you propose to compensate for your lack of experience?
First, if you have experience that the interviewer does not know about, bring that up: Then, point out (if true) that you are a hard working quick learner.

44. What qualities do you look for in a boss?
Be generic and positive. Safe qualities are knowledgeable, a sense of humor, fair, loyal to subordinates and holder of high standards. All bosses think they have these traits.

45. Tell me about a time when you helped resolve a dispute ?
between others. Pick a specific incident. Concentrate on your problem solving technique and not the dispute you settled.

46. What position do you prefer on a team working on a project?
Be honest. If you are comfortable in different roles, point that out.

47. Describe your work ethic?
Emphasize benefits to the organization. Things like, determination to get the job done and work hard but enjoy your work are good.

48. What has been your biggest professional disappointment?
Be sure that you refer to something that was beyond your control. Show acceptance and no negative feelings.

49. Tell me about the most fun you have had on the job.
Talk about having fun by accomplishing something for the organization.

50. Do you have any questions for me?
Always have some questions prepared. Questions prepared where you will be an asset to the organization are good. How soon will I be able to be productive? and What type of projects will I be able to assist on? are examples.

And Finally Best of Luck Hope you will be succussful in the interview you are going to face in coming days.

“Never take some one for granted,Hold every person Close to your Heart because you might wake up one day and realise that you have lost a diamond while you were too busy collecting stones.” Remember this always in life.

extracting patterns in perl

In many applications we may need to extract certain numbers , characters or even a mixture of characters ans numbers from sentences….
the below code will help you

consider the below example

eg: id #23517348 – from reply

Our aim is to extract 23517348 from the above data

regex for extracting is:- /(\d+)/

=====================================
my $sub=$::FORM{desc’}; // suppose sub prints the data
id #23517348 – from reply

#print “$sub”;
$sub =~/(\d+)/;
print “$1″;

=======================
Output
=====
23517348

100 keyboard shortcuts

Here are 100 keyboard shortcuts to pace up your work and Impress others
CTRL+C (Copy)
CTRL+X (Cut)
CTRL+V (Paste)
CTRL+Z (Undo)
DELETE (Delete)
SHIFT+DELETE (Delete the selected item permanently without placing the item in the Recycle Bin)
CTRL while dragging an item (Copy the selected item)
CTRL+SHIFT while dragging an item (Create a shortcut to the selected item)
F2 key (Rename the selected item)
CTRL+RIGHT ARROW (Move the insertion point to the beginning of the next word)
CTRL+LEFT ARROW (Move the insertion point to the beginning of the previous word)
CTRL+DOWN ARROW (Move the insertion point to the beginning of the next paragraph)
CTRL+UP ARROW (Move the insertion point to the beginning of the previous paragraph)
CTRL+SHIFT with any of the arrow keys (Highlight a block of text)
SHIFT with any of the arrow keys (Select more than one item in a window or on the desktop, or select text in a document)
CTRL+A (Select all)
F3 key (Search for a file or a folder)
ALT+ENTER (View the properties for the selected item)
ALT+F4 (Close the active item, or quit the active program)
ALT+ENTER (Display the properties of the selected object)
ALT+SPACEBAR (Open the shortcut menu for the active window)
CTRL+F4 (Close the active document in programs that enable you to have multiple documents open simultaneously)
ALT+TAB (Switch between the open items)
ALT+ESC (Cycle through items in the order that they had been opened)
F6 key (Cycle through the screen elements in a window or on the desktop)
F4 key (Display the Address bar list in My Computer or Windows Explorer)
SHIFT+F10 (Display the shortcut menu for the selected item)
ALT+SPACEBAR (Display the System menu for the active window)
CTRL+ESC (Display the Start menu)
ALT+Underlined letter in a menu name (Display the corresponding menu)
Underlined letter in a command name on an open menu (Perform the corresponding command)
F10 key (Activate the menu bar in the active program)
RIGHT ARROW (Open the next menu to the right, or open a submenu)
LEFT ARROW (Open the next menu to the left, or close a submenu)
F5 key (Update the active window)
BACKSPACE (View the folder one level up in My Computer or Windows Explorer)
ESC (Cancel the current task)
SHIFT when you insert a CD-ROM into the CD-ROM drive (Prevent the CD-ROM from automatically playing)

Dialog Box Keyboard Shortcuts

CTRL+TAB (Move forward through the tabs)
CTRL+SHIFT+TAB (Move backward through the tabs)
TAB (Move forward through the options)
SHIFT+TAB (Move backward through the options)
ALT+Underlined letter (Perform the corresponding command or select the corresponding option)
ENTER (Perform the command for the active option or button)
SPACEBAR (Select or clear the check box if the active option is a check box)
Arrow keys (Select a button if the active option is a group of option buttons)
F1 key (Display Help)
F4 key (Display the items in the active list)
BACKSPACE (Open a folder one level up if a folder is selected in the Save As or Open dialog box)

Microsoft Natural Keyboard Shortcuts

Windows Logo (Display or hide the Start menu)
Windows Logo+BREAK (Display the System Properties dialog box)
Windows Logo+D (Display the desktop)
Windows Logo+M (Minimize all of the windows)
Windows Logo+SHIFT+M (Restore the minimized windows)
Windows Logo+E (Open My Computer)
Windows Logo+F (Search for a file or a folder)
CTRL+Windows Logo+F (Search for computers)
Windows Logo+F1 (Display Windows Help)
Windows Logo+ L (Lock the keyboard)
Windows Logo+R (Open the Run dialog box)
Windows Logo+U (Open Utility Manager)

Accessibility Keyboard Shortcuts

Right SHIFT for eight seconds (Switch FilterKeys either on or off)
Left ALT+left SHIFT+PRINT SCREEN (Switch High Contrast either on or off)
Left ALT+left SHIFT+NUM LOCK (Switch the MouseKeys either on or off)
SHIFT five times (Switch the StickyKeys either on or off)
NUM LOCK for five seconds (Switch the ToggleKeys either on or off)
Windows Logo +U (Open Utility Manager)

Windows Explorer Keyboard Shortcuts

END (Display the bottom of the active window)
HOME (Display the top of the active window)
NUM LOCK+Asterisk sign (*) (Display all of the subfolders that are under the selected folder)
NUM LOCK+Plus sign (+) (Display the contents of the selected folder)
NUM LOCK+Minus sign (-) (Collapse the selected folder)
LEFT ARROW (Collapse the current selection if it is expanded, or select the parent folder)
RIGHT ARROW (Display the current selection if it is collapsed, or select the first subfolder)

Shortcut Keys for Character Map

After you double-click a character on the grid of characters, you can move through the grid by using the keyboard shortcuts:
RIGHT ARROW (Move to the right or to the beginning of the next line)
LEFT ARROW (Move to the left or to the end of the previous line)
UP ARROW (Move up one row)
DOWN ARROW (Move down one row)
PAGE UP (Move up one screen at a time)
PAGE DOWN (Move down one screen at a time)
HOME (Move to the beginning of the line)
END (Move to the end of the line)
CTRL+HOME (Move to the first character)
CTRL+END (Move to the last character)
SPACEBAR (Switch between Enlarged and Normal mode when a character is selected)

Microsoft Internet Explorer Navigation

CTRL+B (Open the Organize Favorites dialog box)
CTRL+E (Open the Search bar)
CTRL+F (Start the Find utility)
CTRL+H (Open the History bar)
CTRL+I (Open the Favorites bar)
CTRL+L (Open the Open dialog box)
CTRL+N (Start another instance of the browser with the same Web address)
CTRL+O (Open the Open dialog box, the same as CTRL+L)
CTRL+P (Open the Print dialog box)
CTRL+R (Update the current Web page)
CTRL+W (Close the current window)

How to Lock windows folders without any software

How to Lock windows folders without any software

We are assuming that the name of the folder to be renamed is HideMePlease and it is located in D Drive, thereby making the path to the folder as

Disc D:\

Step I


The trick is pretty simple, If you rename the folder ( in our case
HideMePlease) to HideMePlease.{21EC2020-3AEA-1069-A2DD-08002B30309D}
When this renaming of the folder is done, windows by default makes
it point to the control panel. Upon clicking on the folder after
renaming, Control Panel is displayed.
To get your folder back to the original one, rename it back to HideMePlease.

In order to make the entire process simple and clean,
i would suggest that you make two batch files (files ending with .bat
extension). One file for hiding/locking the folder; the other for
getting it back/unlocking it.
Step II

1.) The batch file for hiding the folder can be named as:
Hide.bat
2.) Open notepad/your favorite text editor and type in this
//THIS FILE SHOULD BE PLACED IN d:\
REN HideMePlease HideMePlease.{21EC2020-3AEA-1069-A2DD-08002B30309D}
Step III


1.) The batch file for unlocking the folder can be named as
Recover.bat
2.) Open notepad/your favorite text editor and type in this
//THIS FILE SHOULD BE PLACED IN D:\
REN HideMePlease.{21EC2020-3AEA-1069-A2DD-08002B30309D} HideMePlease
IT IS A VERY GOOD TRICK AND WOULD COME HANDY WHEN YOU HAVE TO HIDE YOUR PERSONAL INFO FROM OTHERS!

Cascading style sheets(CSS)


Cascading style
sheets are a new way of formatting your page layout, text, fonts, images, and almost anything you put on the page.They allow you to position things on your page down to the exact pixel. Also, if a style is declared in the head section of a page, a change to the style changes the style on the entire page.

What is CSS?

* CSS stands for Cascading Style Sheets
* Styles define how to display HTML elements
* Styles are normally stored in Style Sheets
* Styles were added to HTML 4.0 to solve a problem
* External Style Sheets can save you a lot of work
* External Style Sheets are stored in CSS files
* Multiple style definitions will cascade into one

Suppose that you created a style for a heading tag, <H1>. In your style, you set the color of your H1 tags to red. Now if you have 10 H1 tags on the page, and decide you would rather have your headings be blue, you would no longer need to go back and change the font color for each heading. All you have to do is change the style of your H1 tags from the color red to blue. Changing the style once will adjust all of your H3 tags and they will now be all blue instead of red, with alot less work.

Syntax

The CSS takes the following syntax

selector {property: value}

eg:-body {color: blue}

This can be applied to a group also
h1,h2
{
color: #000000;
}
Adding Styles to Elements with Particular Attributes

input[type="text"] {background-color: red}

The id Selector

You can also define styles for HTML elements with the id selector. The id selector is defined as a #.

The style rule below will match the element that has an id attribute with a value of “black”:

#black{color: black}

The style rule below will match the p element that has an id with a value of “para1″:

p#para1
{
text-align: center;
color: red
}

Comments in CSS

/* This is a comment */
p
{
text-align: center;

}

Inline Styles:

Inline styles are added directly to the element to be styled with the style attribute:

<p style=”color: red;”>

Inline styles are CSS styles that are applied to one element using the style attribute.

1. We write the style properties all one line .then we separate multiple properties with a semi-colon

eg:- background:#112344; color:#223555; border: solid black 1px;

2. Now you place that line of styles inside the style attribute of the element you want styled.

<p style =” background:#112344; color:#223555; border: solid black 1px;”>
Advantages and disadvantages of Inline Styles

Advantage

1) Inline styles have the highest precedence because of the cascade.

Disadvantages

1)They can over-ride things you didn’t intend them to do as they are most specific in cascade.

2)It’s impossible to style pseudo-elements and -classes with inline styles. For example, with external and internal style sheets, you can style the visited, hover, active, and link color of an anchor tag. But with an inline style all you can style is the link itself, because that’s what the style is on.

External style sheets

External style sheets (CSS) allow you to use one style sheet on multiple Web pages – so when you change the look for your site, you change the CSS in one.

Advantages and Disadvantages of External Style Sheets

Advantages

1)Since External style sheets are written in a single page it is easy to change the style and look of websites without much trouble.You need to make changes only in a single page and to a single portion.

2)To use the styles effectively we can group them easily.

Disadvantages

* External style sheets can increase the download time, if they are extremely large.

* If you only have a small number of styles, they can increase the complexity of your site.

* Like with table rendering, you have to wait until the entire style sheet is loaded before the page can display.

* External style sheets get big very quickly as it’s hard to tell when a style is no longer in use, because it’s not deleted when the page is removed.

LINKING TO PAGE

Each page which uses CSS must link to the style sheet using the <link> tag. The <link> tag goes inside the head section:

Your style sheet should be saved with a .css extension

Suppose that style.css is the name of the page where you put your styles.

<head>
<link rel=”stylesheet” type=”text/css”
href=”style.css” />
</head>

The browser will read the style definitions from the file style.css and format the document according to it.
body { background : #FFFFFF;}
p {margin-left: 20px}

Internal style sheets

An internal style sheet should be used when a single document has a unique style. You define internal styles in the head section by using the <style> tag, like this:

<head>
<style type=”text/css”>

p {margin-left: 20px}

body {background : #FFFFFF;}
</style>
</head>

Multiple Style Sheets

A group of properties can be applied to a tag

eg:-body {
background : #FFFFFF;
border: #000000 ;
border-style: solid;
border-width: 0px;
padding: 10px ;
vertical-align: middle ;
text-align: center;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: 400 ;
color: #000000;
font-size:6;

}
Inside the tables for a all columns or rows you can specify the styles

td {
empty-cells : show;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: 400 ;
color: #000000;
text-align: center;
}

SCIENTIFIC LEMON Battery

The penny

: Any copper coin will work. (Canadian pennies from 1960 – 2001 all worked)

www.NidoKidos.Org

Creating the battery
: Insert a penny into a cut on one side of the lemon. Push a galvanized nail into the other side of the lemon.
The nail and penny must not touch.

www.NidoKidos.Org

This is a single cell of a battery. The zinc nail and the copper penny are called electrodes.

The lemon juice is called electrolyte.
All batteries have a “+” and “-” terminal. Electric current is a flow of atomic particles called electrons. Certain materials , called conductors, allow electrons to flow through them. Most metals (copper, iron) are good conductors of electricity. Electrons will flow from the “-” electrode of a battery, through a conductor, towards the “+” electrode of a battery.
Volts (voltage) is a measure of the force moving the electrons. (High voltage is dangerous!)

www.NidoKidos.Org

I have connected a volt meter to our single cell lemon battery. The meter tells us this lemon battery is creating a voltage of 0.906 volts.
Unfortunately this battery will not produce enough current (flowing electrons) to light a bulb.

www.NidoKidos.Org

To solve this problem we can combine battery cells to create higher voltages. Building more lemon batteries and connecting them with a metal wire from “+” to “-” adds the voltage from each cell.
www.NidoKidos.Org

The two lemon batteries above, combine to produce a voltage of 1.788 volts. This combination still does not create enough current to light a small bulb. Note the red wire connecting the batteries is joined from “+” (penny) to “-” (galvanized nail).

www.NidoKidos.Org

Four lemon batteries create a voltage of 3.50 volts. We should be able to light up a small device like an LED (Light Emitting Diode).
Note the connecting wires go from “+” to “-” on each battery.


www.NidoKidos.Org

LED

To turn on an LED you must determine the “+” and “-” connections. If you look closely at the red plastic base of an LED you will notice a “flat” spot (indicated by arrow above). The wire that comes out beside the flat spot must connect to the “-” side of a battery, the other wire to the “+” side.


Important information about LEDs
: LEDs are designed to work at very low voltages (~ 2V) and low currents. They will be damaged if connected to batteries rated at over 2 volts. LEDs require resistors to control current when used with batteries rated at over 2 volts. Lemon batteries produce low current. It is OK to connect an LED to a lemon battery.


www.NidoKidos.Org

In the above image, electrons flow from the “-” (nail) end of our lemon battery through the LED (making it glow) then back to the “+” (penny) end of the battery. This is an electronic circuit. The LED glows dimly with this configuration.

www.NidoKidos.Org


Improving your battery.

The quality of the copper and zinc can be a problem for a battery like this. Pennies in particular are rarely pure copper.
Try substituting a length of 14 gauge copper wire (common house wire) for the penny. Experiment with different lengths and configurations of electrodes. Other sources of zinc and copper may be found in the plumbing supply department of a hardware store.

The first battery was created in 1799 by Alessandro Volta . Today batteries provide the power for an amazing variety of devices, everything from flashlights to robots, computers, satellites and cars. Inventors and researchers continue to improve the battery, designing batteries that last longer and that are more friendly to our environment.

Understanding how batteries actually work requires a knowledge of chemistry. The most important factor in battery design is the electrical relationship between the two metals used in the battery. Some metals give electrons away while other metals accept extra electrons. Chemists have investigated metals and created an “electric potential” table comparing different metals.

MYSQL

MYSQL COMMANDS

1)To login (from unix shell) use -h only if needed.
—->[mysql dir]/bin/mysql -h hostname -u root -p

***************************************************************
2)Create a database on the sql server.
—-> create database [databasename];
—->eg :- create database college;

****************************************************************
3)List all databases on the sql server.
—-> show databases;

*****************************************************************
4)Switch to a database.
—–> use [databasename];

*****************************************************************
5)To see all the tables in the database.
——->show tables

******************************************************************
6) To see database’s field formats.
—–> desc [table name];

*******************************************************************
7)To delete a db.
—> drop database [database name];
eg:- drop database college;

******************************************************************
8)To create a table.
—–>CREATE table tablename(field_one datatype(size),fiels_two datatype(size));

eg1:-mysql> CREATE TABLE student( id INT(20),name VARCHAR(100));
Query OK, 0 rows affected (0.03 sec)

eg:-2 mysql> CREATE TABLE [table name] (firstname VARCHAR(20), middleinitial VARCHAR(3), lastname VARCHAR(35),suffix VARCHAR(3),officeid VARCHAR(10),userid VARCHAR(15),username VARCHAR(8),email VARCHAR(35),phone VARCHAR(25), groups
VARCHAR(15),datestamp DATE,timestamp time,pgpemail VARCHAR(255));
*******************************************************************
9)Creating a table with auto_increment

—> CREATE TABLE tablename(field_one datatype(size) NOT NULL AUTO_INCREMENT PRIMARY KEY , field_two datatype(size));

eg:-mysql> CREATE TABLE student (id INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) );
Query OK, 0 rows affected (0.01 sec)

*******************************************************************
10)Creating a table with the current timestamp
—> CREATE TABLE student ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
data VARCHAR(100), cur_timestamp TIMESTAMP(7) );

*******************************************************************
11Creating a table with TIMESTAMP DEFAULT NOW()

—> CREATE TABLE student (
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(100), created TIMESTAMP DEFAULT NOW());

*******************************************************************
12)Viewing a table definition
—-> DESC tablename;

*********************************************************************
13)To delete a table.
—–> drop table [table name];
eg) drop table student;

*********************************************************************
14)INSERT values into table
—–>INSERT INTO [tablename] (filed_one,field_two,feild_three) values(value1,value2,value3);

eg:-INSERT INTO student (id,name,branch) values(1,’Amit’,'computer science’);

*******************************************************************
15)Change a users password.(from unix shell).
—->mysql dir]/bin/mysqladmin -u root -h hostname.blah.org -p password ‘new-password’

******************************************************************
16)Change a users password.(from MySQL prompt).
—-> SET PASSWORD FOR ‘user’@'hostname’ = PASSWORD(‘passwordhere’);

******************************************************************
17)GRANT privileges
—–>grant all privileges on [databasename].* to user@’localhost’ identified by ‘passwd’;

******************************************************************
18)GRANT specific privileges
—-> GRANT SELECT ON databasename.* TO username@’localhost’ IDENTIFIED BY ‘password’;

To enable more options you would separate them with a comma. So to enable SELECT, INSERT, and DELETE your syntax would look like this;

—–>GRANT SELECT, INSERT, DELETE ON database.* TO username@’localhost’ IDENTIFIED BY ‘password’;

Once you have given the desired privileges for your user, you will need to run this command within the MySQL command prompt;

—–>FLUSH PRIVILEGES;

To see a list of the privileges that have been granted to a specific user;

—–> select * from MySQL.user where User=’user’ \G

This is a list of privileges that you can grant;

Privilege Meaning
ALL [PRIVILEGES] Sets all simple privileges except GRANT OPTION
ALTER Enables use of ALTER TABLE
CREATE Enables use of CREATE TABLE
CREATE TEMPORARY TABLES Enables use of CREATE TEMPORARY TABLE
DELETE Enables use of DELETE
DROP Enables use of DROP TABLE
EXECUTE Not implemented
FILE Enables use of SELECT … INTO OUTFILE and LOAD DATA INFILE
INDEX Enables use of CREATE INDEX and DROP INDEX
INSERT Enables use of INSERT
LOCK TABLES Enables use of LOCK TABLES on tables for which you have the SELECT privilege
PROCESS Enables the user to see all processes with SHOW PROCESSLIST
REFERENCES Not implemented
RELOAD Enables use of FLUSH
REPLICATION CLIENT Enables the user to ask where slave or master servers are
REPLICATION SLAVE Needed for replication slaves (to read binary log events from the master)
SELECT Enables use of SELECT
SHOW DATABASES SHOW DATABASES shows all databases
SHUTDOWN Enables use of MySQLadmin shutdown
SUPER Enables use of CHANGE MASTER, KILL, PURGE MASTER LOGS, and SET GLOBAL statements, the MySQLadmin debug command; allows you to connect (once) even if max_connections is reached
UPDATE Enables use of UPDATE
USAGE Synonym for “no privileges”
GRANT OPTION Enables privileges to be granted

********************************************************************
19)To update info already in a table.
—-> Update table tablename SET fieldname=newvalue where fieldname=oldvalue;
eg1:- Update table student set id=2 where id=2;
eg2:- Update table student set name=’Arun’ where name=’Amit’;

********************************************************************
20) Modify an existing field in a table
—-> update table table name MODIFY fieldname(new size);
eg:- Update table tablename MODIFY id(30);

********************************************************************
21)Delete a row(s) from a table.
—> DELETE from [table name] where [field name] = ‘value’;

********************************************************************
22)Delete a column.
—->alter table [table name] drop column [column name];

*******************************************************************
23)Add a new column to db.
—–> alter table [table name] add column [new column name] varchar (20);

***************************************************************
24)Change column name.
—-> alter table [table name] change [old column name] [new column name] varchar (50);

*****************************************************************
25)Make a unique column so you get no dupes.
—-> alter table [table name] add unique ([column name]);

******************************************************************
26)Make a column bigger.
—-> alter table [table name] modify [column name] VARCHAR(3);

*****************************************************************
27)Select values from a table

To see alla values of a table use

SELECT * from tablename;

To select specific values from a table use

SELECT fieldname_one,fieldname_two from tablename;

To select fields based on condition

SELECT fieldname_one,fieldname_two from tablename where [condition];

eg:-SELECT id from student where name=’Arun’;

28 ) Dump a table from a database

[mysql dir]/bin/mysqldump -c -u username -ppassword databasename tablename > /tmp/databasename.tablename.sql

29)Restore database (or database table) from backup.
[mysql dir]/bin/mysql -u username -ppassword databasename < /tmp/databasename.sql

php recompilation

Before starting the installation, first you need to know what do you want to use PHP for. There are three main fields you can use PHP, as described in the What can PHP do?

* Websites and web applications (server-side scripting)
* Command line scripting
* Desktop (GUI) applications

For the first and most common form, you need three things: PHP itself, a web server and a web browser. You probably already have a web browser, and depending on your operating system setup, you may also have a web server (e.g. Apache on Linux and MacOS X; IIS on Windows). You may also rent webspace at a company. This way, you don’t need to set up anything on your own, only write your PHP scripts, upload it to the server you rent, and see the results in your browser.

In case of setting up the server and PHP on your own, you have two choices for the method of connecting PHP to the server. For many servers PHP has a direct module interface (also called SAPI). These servers include Apache, Microsoft Internet Information Server, Netscape and iPlanet servers. Many other servers have support for ISAPI, the Microsoft module interface (OmniHTTPd for example). If PHP has no module support for your web server, you can always use it as a CGI or FastCGI processor. This means you set up your server to use the CGI executable of PHP to process all PHP file requests on the server.

If you are also interested to use PHP for command line scripting (e.g. write scripts autogenerating some images for you offline, or processing text files depending on some arguments you pass to them), you always need the command line executable.
Installation on Unix systems

Installation Instructions (Apache Shared Module Version) for PHP

1.  gunzip apache_xxx.tar.gz
2.  tar -xvf apache_xxx.tar
3.  gunzip php-xxx.tar.gz
4.  tar -xvf php-xxx.tar
5.  cd apache_xxx
6.  ./configure –prefix=/www –enable-module=so
7.  make
8.  make install
9.  cd ../php-xxx

10. Now, configure your PHP.  This is where you customize your PHP
with various options, like which extensions will be enabled.  Do a
./configure –help for a list of available options.  In our example
we’ll do a simple configure with Apache 1 and MySQL support.  Your
path to apxs may differ from our example.

./configure –with-mysql –with-apxs=/www/bin/apxs

11. make
12. make install

If you decide to change your configure options after installation,
you only need to repeat the last three steps. You only need to
restart apache for the new module to take effect. A recompile of
Apache is not needed.

Note that unless told otherwise, ‘make install’ will also install PEAR,
various PHP tools such as phpize, install the PHP CLI, and more.

13. Setup your php.ini file:

cp php.ini-dist /usr/local/lib/php.ini

You may edit your .ini file to set PHP options.  If you prefer your
php.ini in another location, use –with-config-file-path=/some/path in
step 10.

If you instead choose php.ini-recommended, be certain to read the list
of changes within, as they affect how PHP behaves.

14. Edit your httpd.conf to load the PHP module.  The path on the right hand
side of the LoadModule statement must point to the path of the PHP
module on your system.  The make install from above may have already
added this for you, but be sure to check.

For PHP 4:

LoadModule php4_module libexec/libphp4.so

For PHP 5:

LoadModule php5_module libexec/libphp5.so

15. And in the AddModule section of httpd.conf, somewhere under the
ClearModuleList, add this:

For PHP 4:

AddModule mod_php4.c

For PHP 5:

AddModule mod_php5.c

16. Tell Apache to parse certain extensions as PHP.  For example,
let’s have Apache parse the .php extension as PHP.  You could
have any extension(s) parse as PHP by simply adding more, with
each separated by a space.  We’ll add .phtml to demonstrate.

AddType application/x-httpd-php .php .phtml

It’s also common to setup the .phps extension to show highlighted PHP
source, this can be done with:

AddType application/x-httpd-php-source .phps

17. Use your normal procedure for starting the Apache server. (You must
stop and restart the server, not just cause the server to reload by
using a HUP or USR1 signal.)

Installation Instructions (Static Module Installation for Apache) for PHP

1.  gunzip -c apache_1.3.x.tar.gz | tar xf -
2.  cd apache_1.3.x
3.  ./configure
4.  cd ..

5.  gunzip -c php-5.x.y.tar.gz | tar xf -
6.  cd php-5.x.y
7.  ./configure –with-mysql –with-apache=../apache_1.3.x
8.  make
9.  make install

10. cd ../apache_1.3.x

11. ./configure –prefix=/www –activate-module=src/modules/php5/libphp5.a
(The above line is correct! Yes, we know libphp5.a does not exist at this
stage. It isn’t supposed to. It will be created.)

12. make
(you should now have an httpd binary which you can copy to your Apache bin dir if
it is your first install then you need to “make install” as well)

13. cd ../php-5.x.y
14. cp php.ini-dist /usr/local/lib/php.ini

15. You can edit /usr/local/lib/php.ini file to set PHP options.
Edit your httpd.conf or srm.conf file and add:
AddType application/x-httpd-php .php

commands for restarting Apache

1. Several Linux and SysV variants:
/etc/rc.d/init.d/httpd restart

2. Using apachectl scripts:
/path/to/apachectl stop
/path/to/apachectl start

3. httpdctl and httpsdctl (Using OpenSSL), similar to apachectl:
/path/to/httpsdctl stop
/path/to/httpsdctl start

4. Using mod_ssl, or another SSL server, you may want to manually
stop and start:
/path/to/apachectl stop
/path/to/apachectl startssl

Different examples of compiling PHP for apache are as follows:

./configure –with-apxs –with-pgsql

This will create a libphp5.so (or
libphp4.so in PHP 4) shared library that is loaded
into Apache using a LoadModule line in Apache’s httpd.conf file. The
PostgreSQL support is embedded into this library.

./configure –with-apxs –with-pgsql=shared

This will create a libphp4.so shared
library for Apache, but it will also create a
pgsql.so shared library that is loaded into
PHP either by using the extension directive in
php.ini file or by loading it explicitly in
a script using the dl() function.

./configure –with-apache=/path/to/apache_source –with-pgsql

This will create a libmodphp5.a library, a mod_php5.c and some accompanying files and copy this into the src/modules/php5 directory in the Apache source tree. Then you compile Apache using –activate-module=src/modules/php5/libphp5.a and the Apache build system will create libphp5.a and link it statically into the httpd binary (replace php5 by php4 in PHP 4). The PostgreSQL support is included directly into this httpd binary, so the final result here is a single httpd binary that includes all of Apache and all of PHP.

./configure –with-apache=/path/to/apache_source –with-pgsql=shared

Note: Apache’s default httpd.conf currently ships with a section that looks like this:

User nobody
Group “#-1″

Unless you change that to “Group nogroup” or something like that (“Group daemon” is
also very common) PHP will not be able to open files.

Note:

Make sure you specify the installed version of apxs when using
–with-apxs=/path/to/apxs.
You must NOT use the apxs version that is in the apache sources but the one
that is actually installed on your system.

Installation Instructions (Apache 2 Shared Module Version)

1.  gzip -d httpd-2_0_NN.tar.gz
2.  tar xvf httpd-2_0_NN.tar
3.  gunzip php-NN.tar.gz
4.  tar -xvf php-NN.tar
5.  cd httpd-2_0_NN
6.  ./configure –enable-so
7.  make
8.  make install

Now you have Apache 2.0.NN available under /usr/local/apache2,
configured with loadable module support and the standard MPM prefork.
To test the installation use your normal procedure for starting
the Apache server, e.g.:
/usr/local/apache2/bin/apachectl start
and stop the server to go on with the configuration for PHP:
/usr/local/apache2/bin/apachectl stop.

9.  cd ../php-NN

10. Now, configure your PHP.  This is where you customize your PHP
with various options, like which extensions will be enabled.  Do a
./configure –help for a list of available options.  In our example
we’ll do a simple configure with Apache 2 and MySQL support.  Your
path to apxs may differ, in fact, the binary may even be named apxs2 on
your system.

./configure –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql

11. make
12. make install

If you decide to change your configure options after installation,
you only need to repeat the last three steps. You only need to
restart apache for the new module to take effect. A recompile of
Apache is not needed.

Note that unless told otherwise, ‘make install’ will also install PEAR,
various PHP tools such as phpize, install the PHP CLI, and more.

13. Setup your php.ini

cp php.ini-dist /usr/local/lib/php.ini

You may edit your .ini file to set PHP options.  If you prefer having
php.ini in another location, use –with-config-file-path=/some/path in
step 10.

If you instead choose php.ini-recommended, be certain to read the list
of changes within, as they affect how PHP behaves.

14. Edit your httpd.conf to load the PHP module.  The path on the right hand
side of the LoadModule statement must point to the path of the PHP
module on your system.  The make install from above may have already
added this for you, but be sure to check.

For PHP 4:

LoadModule php4_module modules/libphp4.so

For PHP 5:

LoadModule php5_module modules/libphp5.so

15. Tell Apache to parse certain extensions as PHP.  For example,
let’s have Apache parse the .php extension as PHP.  You could
have any extension(s) parse as PHP by simply adding more, with
each separated by a space.  We’ll add .phtml to demonstrate.

AddType application/x-httpd-php .php .phtml

It’s also common to setup the .phps extension to show highlighted PHP
source, this can be done with:

AddType application/x-httpd-php-source .phps

16. Use your normal procedure for starting the Apache server, e.g.:

/usr/local/apache2/bin/apachectl start

Apache 2.0 on Unix systems

If you install PHP as an Apache module, you can consider the following. Instead of adding:
application/x-httpd-php php
application/x-httpd-php-source phps
into Apache mime.types, you can add:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
into Apache httpd.conf, OR you can add:
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .phps
into Apache httpd.conf. The last one is the preferred way of configuration, but it does not work in previous Apache versions.

PHP Interview Question & Answer

1. What are the differences between GET and POST methods in form submitting, give
the case where we can use get and we can use post methods?

Answer:
On the server side, the main difference between GET and POST is where the
submitted is stored. The $_GET array stores data submitted by the GET method.
The $_POST array stores data submitted by the POST method.
On the browser side, the difference is that data submitted by the GET method will
be displayed in the browser’s address field. Data submitted by the POST method
will not be displayed anywhere on the browser.
GET method is mostly used for submitting a small amount and less sensitive data.
POST method is mostly used for submitting a large amount or sensitive data.

2. Who is the father of php and explain the changes in php versions?
Answer:
Rasmus Lerdorf for version changes go to http://php.net/
Marco Tabini is the founder and publisher of php|architect.
3. How can we submit from without a submit button?
Answer:
We can use a simple JavaScript code linked to an event trigger of any form field.
In the JavaScript code, we can call the document.form.submit() function to submit
the form. For example:
4. How many ways we can retrieve the date in result set of mysql Using php?
Answer:
As individual objects so single record or as a set or arrays.
5. What is the difference between mysql_fetch_object and mysql_fetch_array?
Answer:
MySQL fetch object will collect first single matching record where
mysql_fetch_array will collect all matching records from the table in an array.
6. What is the difference between $message and $$message?
Answer:
They are both variables. But $message is a variable with a fixed name. $$message is
a variable who’s name is stored in $message. For example, if $message contains
“var”, $$message is the same as $var.
7. How can we extract string ‘abc.com ‘ from a string
‘http://info@a…’ using regular _expression of php?
Answer:
We can use the preg_match() function with “/.*@(.*)$/” as
the regular expression pattern. For example:
preg_match(“/.*@(.*)$/”,”http://info@abc.com”,$data);
echo $data[1];
8. How can we create a database using php and mysql?
Answer:
PHP: mysql_create_db()
Mysql: create database;
9. What are the differences between require and include, include_once?
Answer:
File will not be included more than once. If we want to include a file once only and
further calling of the file will be ignored then we have to use the PHP function
include_once(). This will prevent problems with function redefinitions, variable
value reassignments, etc.
10. Can we use include (“abc.php”) two times in a php page “makeit.php”?
Answer:
Yes we can include..
11. What are the different tables present in mysql, which type of table is generated when
we are creating a table in the following
syntax: create table employee(eno int(2),ename varchar(10)) ?
Answer:
Total 5 types of tables we can create
1. MyISAM
2. Heap
3. Merge
4. InnoDB
5. ISAM
6. BDB
MyISAM is the default storage engine as of MySQL 3.23.
12. Functions in IMAP, POP3 AND LDAP?
Answer:
Please visit:

http://fi2.php.net/imap

http://uk2.php.net/ldap

13. How can I execute a php script using command line?
Answer:
Just run the PHP CLI (Command Line Interface) program and provide the PHP
script file name as the command line argument. For example, “php myScript.php”,
assuming “php” is the command to invoke the CLI program.
Be aware that if your PHP script was written for the Web CGI interface, it may not
execute properly in command line environment.

14. Suppose your ZEND engine supports the mode <? ?> Then how can u configure your
php ZEND engine to support <?php ?> mode ?

Answer:
If you change the line: short_open_tag = off in php.ini file. Then your php ZEND
engine support only <?php ?> mode.
15. Shopping cart online validation i.e. how can we configure the paypals?
16. What is meant by nl2br()?
Answer:
nl2br — Inserts HTML line breaks before all newlines in a string
string nl2br (string);
Returns string with ‘<br />’ inserted before all newlines.
For example: echo nl2br(“god bless\n you”) will output “god bless
\n you” to your browser.
17. Draw the architecture of ZEND engine?

18. What are the current versions of apache, php, and mysql?
Answer:
PHP: php5.1.2
MySQL: MySQL 5.1
Apache: Apache 2.1
19. What are the reasons for selecting lamp (Linux, apache, mysql, php) instead of
combination of other software programs, servers and operating systems?

Answer:
All of those are open source resource. Security of linux is very very more than
windows. Apache is a better server that IIS both in functionality and security.
Mysql is world most popular open source database. Php is more faster that asp or
any other scripting language.
20. How can we encrypt and decrypt a data present in a mysql table using mysql?
Answer:
AES_ENCRYPT () and AES_DECRYPT ()
21. How can we encrypt the username and password using php?
Answer:
You can encrypt a password with the following Mysql>SET
PASSWORD=PASSWORD(“Password”);
We can encode data using base64_encode($string) and can decode using
base64_decode($string);

22. What are the features and advantages of OBJECT ORIENTED PROGRAMMING?
Answer:
One of the main advantages of OO programming is its ease of modification; objects
can easily be modified and added to a system there by reducing maintenance costs.
OO programming is also considered to be better at modeling the real world than is
procedural programming. It allows for more complicated and flexible interactions.
OO systems are also easier for non-technical personnel to understand and easier for
them to participate in the maintenance and enhancement of a system because it
appeals to natural human cognition patterns.
For some systems, an OO approach can speed development time since many objects
are standard across systems and can be reused. Components that manage dates,
shipping, shopping carts, etc. can be purchased and easily modified for a specific
system.

23. What are the differences between PROCEDURE ORIENTED LANGUAGES
AND OBJECT ORIENTED LANGUAGES?

Answer:
Traditional programming has the following characteristics:
Functions are written sequentially, so that a change in programming can affect any
code that follows it.

If a function is used multiple times in a system (i.e., a piece of code that manages the
date), it is often simply cut and pasted into each program (i.e., a change log, order
function, fulfillment system, etc). If a date change is needed (i.e., Y2K when the code
needed to be changed to handle four numerical digits instead of two), all these pieces
of code must be found, modified, and tested.

Code (sequences of computer instructions) and data (information on which the
instructions operates on) are kept separate. Multiple sets of code can access and
modify one set of data. One set of code may rely on data in multiple places. Multiple
sets of code and data are required to work together. Changes made to any of the
code sets and data sets can cause problems through out the system.

Object-Oriented programming takes a radically different approach:
Code and data are merged into one indivisible item – an object (the term
“component” has also been used to describe an object.) An object is an abstraction
of a set of real-world things (for example, an object may be created around “date”)
The object would contain all information and functionality for that thing (A dateobject it may contain labels like January, February, Tuesday, Wednesday. It may
contain functionality that manages leap years, determines if it is a business day or a
holiday, etc., See Fig. 1). Ideally, information about a particular thing should reside
in only one place in a system. The information within an object is encapsulated (or
hidden) from the rest of the system.
A system is composed of multiple objects (i.e., date function, reports, order
processing, etc., See Fig 2). When one object needs information from another object,
a request is sent asking for specific information. (for example, a report object may
need to know what today’s date is and will send a request to the date object) These
requests are called messages and each object has an interface that manages
messages.
OO programming languages include features such as “class”, “instance”,
“inheritance”, and “polymorphism” that increase the power and flexibility of an
object.

24. What is the use of friend function?
Answer:
Friend functions
Sometimes a function is best shared among a number of different classes. Such
functions can be declared either as member functions of one class or as global
functions. In either case they can be set to be friends of other classes, by using a
friend specifier in the class that is admitting them. Such functions can use all
attributes of the class whichnames them as a friend, as if they were themselves
members of that class.

25. What are the different types of errors in php?
Answer:
Three are three types of errors:

1. Notices: These are trivial, non-critical errors that PHP encounters while
executing a script – for example, accessing a variable that has not yet been defined.
By default, such errors are not displayed to the user at all – although, as you will see,
you can change this default behaviour.
2. Warnings: These are more serious errors – for example, attempting to include() a
file which does not exist. By default, these errors are displayed to the user, but they
do not result in script termination.
3. Fatal errors: These are critical errors – for example, instantiating an object of a
non-existent class, or calling a non-existent function. These errors cause the
immediate termination of the script, and PHP’s default behaviour is to display them
to the user when they take place.

26. How can we convert asp pages to php pages?
Answer:
You can download asp2php front-end application from the site

http://asp2php.naken.cc.

27.How can we get second of the current time using date function?
Answer:
$second = date(“s”);

28. What is the difference between the functions unlink and unset?
Answer:
unlink() deletes the given file from the file system.
unset() makes a variable undefined.

29. How can we register the variables into a session?
Answer:
We can use the session_register ($ur_session_var) function.

30. What is the difference between char and varchar data types?
Answer:
char(M) M bytes 0<=M<=255
varchar(M) L+1 bytes where L<=M & 0<=M<=255
i.e.; char data type allocate memory statically
and varchar data type allocate memory dynamically

31. What is the functionality of md5 function in php?
Answer:
string md5(string)
Calculate the md5 hash of a string. The hash is a 32-character hexadecimal number.
We can use it to generate keys, which we use to identify users etc. If we add random
no techniques to it the md5 generated now will be totally different for the same
string we are using..

32. How can we know the number of days between two given dates using mysql?
Answer:
select DIFFDATE( NOW(), ‘yyyy-mm-dd’ );

33. What are the differences between drop a table and truncate a table?
Answer:
Delete a Table or DatabaseTo delete a table (the table structure, attributes, and
indexes will also be deleted).
What if we only want to get rid of the data inside a table, and not the table itself?
Use the TRUNCATE TABLE command (deletes only the data inside the table).

34. What are the different ways to login to a remote server? Explain the means,
advantages and disadvantages?

Answer:
There is at least 3 ways to logon to a remote server:
Use ssh or telnet if you concern with security
You can also use rlogin to logon to a remote server.

35. How would you backup and restore a big MySQL database? What are the advantages
of the approach which you have taken over the others?

Use the mysqldump command.
If you have Telnet/SSH access to your MySQL server, log in and issue the following
command for each database you want to back up:
shell> mysqldump -u user -ppassword –opt -full database_name > backupfile.sql

Then move the resulting file(s) to your preferred backup areas. If you require more
information on the mysqldump command, then simply check out this
URL:www.mysql.com/documentation/mysql
Copy all the relevant table files.
If the server isn’t updating anything (or you’ve deliberately killed mysqld for this
purpose) then you can copy all the files with the following extensions in your
MySQL data directory:
*.frm
*.myd
*.myi
Make sure you restart the MySQL daemon once you finish copying and
downloading the files to your preferred backup areas.
TIP: once you’ve completed the backup, restart MySQL with the –log-update
switch. This will allow you to keep track of all modifications done in the MySQL
tables since your last ‘dump’.
To restore your dumps, you should either restore to an existing database or create a
new database using
shell> mysqladmin create database_name
then issue the following command :
shell> mysql -u user -ppassword database_name < backup-file.sql
If you don’t have access to Telnet/SSH and you’re unable to do backups using the
methods described above, you should ask your host if it is possible for them to do a
backup for you and put the backups in a separate directory so that you can easily
FTP your backups to your selected backup areas. Otherwise, if you have access to
phpMyAdmin, you can use the following procedure:
Access phpMyAdmin, and select the database you wish to ‘dump’ (backup).
Scroll down and you will see a bulleted point saying: “View dump (schema) of
database” along with some radio and check boxes. Choose ‘Structure and data’,
then click on ‘Add Drop Table’ and ‘Send’ and click ‘Go’. This will save the ‘dump’
to your hard drive.
To restore a dump using phpMyAdmin, simply insert the file in the correct place
once you have chosen the correct database by doing the following:
Choose the database you will insert your data into, or create a new database.
Insert the appropriate SQL queries you already have, or just paste the name of
the .sql file you have on your hard drive into the text box under ‘Location of the
textfile’, and fire away!
Tip : use a crontab job to schedule backups periodically.
The advantages of this approach is the backup is only a file consisting of SQL query.
So that needs minimum spaces to backup a large database.
36. For the database from the previous question, please give an SQL query which returns
the invoice number of all invoices which contain the article with the number “1234″. The
query should be able to run under a MySQL 4.0 database.

Answer:
Select invoceNo from invoice where article_id=1234;

37. What is meant by PEAR in php?
Answer:
PEAR is short for “PHP Extension and Application Repository” and is pronounced
just like the fruit. The purpose of PEAR is to provide:
A structured library of open-sourced code for PHP users
A system for code distribution and package maintenance
A standard style for code written in PHP
The PHP Foundation Classes (PFC),
The PHP Extension Community Library (PECL),
A web site, mailing lists and download mirrors to support the PHP/PEAR
community
PEAR is a community-driven project with the PEAR Group as the governing body.
The project has been founded by Stig S. Bakken in 1999 and quite a lot of people
have joined the project since then.

http://pear.php.net/manual/en/introduction.php

38 How many ways we can give the output to a browser?
Answer:
HTML output
PHP, ASP, JSP, Servlet Function
Script Language output Function
Different Type of embedded Package to output to a browser
39. How can we know that a session is started or not?
Answer:
a session starts by session_start()function.
this session_start() is always declared in header portion.it always declares first.then
we write session_register().

40. What is the default session time in php and how can I change it?
Answer:
The default session time in php is until closing of browser