Its My Space

Cooooooooooool

Archive for the ‘Interview Questions’ Category

Interview Questions

HOW TO ANSWER TOUGH INTERVIEW QUESTIONS

Posted by Ramkumar on April 1, 2009

There’s no worse feeling than when you’re in an interview and the interviewer asks you a question to which you don’t know the answer. The best way to handle this dreaded debacle is to go into the interview prepared. Familiarize yourself with a few common difficult questions and arm yourself with answers prepared ahead of time.
Check out these tough interview questions and some suggested responses in order to avoid an interview disaster:

Tough question No. 1: “Tell me about yourself.”
This is usually the opening question in an interview and it’s the perfect moment for you to toot your own horn — not to tell your life history. Your answers should be a quick rundown of your qualifications and experience. Talk about your education, work history, recent career experience and future goals.
Suggested answer: “I graduated from University X and since then, I have been working in public relations with an agency where I have generated millions of PR hits for my clients. While I’ve enjoyed working on the agency side, I’m looking to expand my horizons and start doing PR for corporate companies such as this one.”

Tough question No. 2: “Why did you leave your last job?”
This is your chance to talk about your experience and your career goals, not to badmouth a former boss or give a laundry list of reasons for your exit. Instead, focus on what you learned in your previous position and how you are ready to use those skills in a new position.
Suggested answer: “The company just wasn’t a good fit for my creativity, but I learned that organizations have distinct personalities just like people do. Now I know where I’ll be a better fit.”

Tough question No. 3: “Where do you see yourself in five years?”
Let the employer know that you’re stable and you want to be with this company for the long haul. Keep your aspirations to take over the firm with which you are interviewing, own your own company, retire at 40 or be married with five children to yourself.
Suggested answer: “I want to secure a civil engineering position with a national firm that concentrates on retail development. Ideally, I would like to work for a young company, such as this one, so I can get in on the ground floor and take advantage of all the opportunities a growing firm has to offer.”

Tough question No. 4: “What are your weaknesses?”
The key to answering this age-old question is not to respond literally. Your future employer most likely won’t care if your weak spot is that you can’t cook, nor do they want to hear the generic responses, like you’re “too detail oriented” or “work too hard.” Respond to this query by identifying areas in your work where you can improve and figure out how they can be assets to a future employer. If you didn’t have the opportunity to develop certain skills at your previous job, explain how eager you are to gain that skill in a new position.
Suggested answer: “In my last position, I wasn’t able to develop my public-speaking skills. I’d really like to be able to work in a place that will help me get better at giving presentations and talking in front of others.”

Tough question No. 5: “Why were you laid off?”
This question will become more common as the economy continues to slow down. It’s a tough question, however, especially because many workers aren’t told exactly why they were laid off. The best way to tackle this question is to answer as honestly as possible.
Suggested answer: “As I’m sure you’re aware, the economy is tough right now and my company felt the effects of it. I was part of a large staff reduction and that’s really all I know. I am confident, however, that it had nothing to do with my job performance, as exemplified by my accomplishments. For example…”

Tough question No. 6: “Tell me about the worst boss you ever had.”
Never, ever talk badly about your past bosses. A potential boss will anticipate that you’ll talk about him or her in the same manner somewhere down the line.
Suggested answer: “While none of my past bosses were awful, there are some who taught me more than others did. I’ve definitely learned what types of management styles I work with the best.”

Tough question No. 7: How would others describe you?
You should always be asking for feedback from your colleagues and supervisors in order to gauge your performance; this way, you can honestly answer the question based on their comments. Keep track of the feedback to be able to give to an employer, if asked. Doing so will also help you identify strengths and weaknesses.
Suggested answer: “My former colleagues have said that I’m easy to do business with and that I always hit the ground running with new projects. I have more specific feedback with me, if you’d like to take a look at it.”

Tough question No. 8: “What can you offer me that another person can’t?”
This is when you talk about your record of getting things done. Go into specifics from your résumé and portfolio; show an employer your value and how you’d be an asset.
Suggested answer: “I’m the best person for the job. I know there are other candidates who could fill this position, but my passion for excellence sets me apart from the pack. I am committed to always producing the best results. For example…”

Tough question No. 9: “If you could choose any company to work for, where would you go?”
Never say that you would choose any company other than the one where you are interviewing. Talk about the job and the company for which you are being interviewed.
Suggested answer: “I wouldn’t have applied for this position if I didn’t sincerely want to work with your organization. ” Continue with specific examples of why you respect the company with which you are interviewing and why you’ll be a good fit.

Tough question No. 10: “Would you be willing to take a salary cut?”
Salary is a delicate topic. In today’s tough economy though, how much a company can afford to pay you might be the deal breaker in whether or not you are offered a position.
Suggested answer: “I’m making $X now. I understand that the salary range for this position is $XX – $XX. Like most people, I would like to improve on my salary, but I’m more interested in the job itself than the money. I would be open to negotiating a lower starting salary but would hope that we can revisit the subject in a few months after I’ve proved myself to you.”

Posted in General, Interview Questions, Technology | Tagged: , | 1 Comment »

Differences Between PHP 4 and 5

Posted by Ramkumar on January 29, 2009

Differences Between PHP 4 and 5

Language Features

  • PHP 5 allows limited type hinting. This allows you to specify that the parameter

to a function or class method can only be of a specific class (or one of its

subclasses), or an array. However, you may not specify any other scalar types.

  • The foreach construct now supports by-reference declaration of the value element.
  • A number of new functions, particularly for string and arraymanipulation, has

also been added to the core platform.

Objects

  • For all intents and purposes, all objects in PHP 5 are passed by reference. This

means that assigning an object to a variable will not create a copy of the former,

but simply creates another reference to it.

  • Constants, aswell as staticmethods and properties, can nowbe definedwithin

the scope of a class.

  • Class methods and properties now feature visibility, and can be declared as

public, private or protected. Classes and methods can also be declared as

final to prevent further inheritance.

  • Since all objects are assigned by reference, you now need a specialized mechanism

to copy objects. This is provided by the clone construct and the __clone()

magic method.

  • PHP 5 features unified constructors and destructors-all constructors should

now be named __construct(), and the new __destruct() magic method has

been added for object destruction.

  • With the addition of interfaces and abstract classes, PHP developers now have

far greater control over how they implement their object-oriented code. Interfaces

can be used to define common APIs, while abstract classes provide

models for class implementations that follow a specific blueprint.

  • Class definitions can now be loaded on demand by using the __autoload()

function.

MagicMethods

A multitude of new “magic” methods has been introduced in PHP 5:

  • __get() and __set() are called when accessing or assigning an undefined object

property, while __call() is executed when calling a non-existent method

of a class.

  • __isset() is called when passing an undefined property to the isset() construct.
  • __unset() is called when passing an undefined property to unset().
  • __toString() is called when trying to directly echo or print() an object.
  • __set_state() is inserted dynamically by var_export() to allow for reinitialization

on execution of var_export()’s output.

Selected New Extensions

  • SimpleXML allows easy access to XML data using object and array notation.
  • PHP 5 also introduces a DOMXML, DOMXSL and Sablotron replacement in

the formof the libxml2-based DOM and XSL extensions.

  • The PHP Data Objects (PDO) extension provides a unified database access extension

that allows access to many different types of database systems by using

a common interface. PDO is not an abstraction layer-except for prepared

queries, it does nothing to abstract the actual database code (SQL), itself.

  • The hash extension is a new replacement for the GPLed libmhash; it was added

to the PHP core starting with version 5.1.2. It can produce hashes using many

algorithms, including the familiarMD5and SHA1, aswell as some more secure

(albeit slower) algorithms, such as snefru.

  • The Standard PHP Library (SPL) provides numerous interfaces that enhance

the way classes interact with the PHP language, including the new Iterator

interfaces.

  • The new Reflection extension allows for runtime introspection of executing

PHP code.

ErrorManagement

  • Classes now support exceptions; the new set_exception_handler() function

allows you to define a script-wide exception handler.

  • The E_STRICT error reporting level has been added to the language to emit notices

when legacy or deprecated code is encountered.

Posted in Interview Questions, Introduction, PHP | Tagged: , | 1 Comment »

PHP and COM

Posted by Ramkumar on January 24, 2009

1. I have built a DLL to calculate something. Is there any way to run this DLL under PHP ?

If this is a simple DLL there is no way yet to run it from PHP. If the DLL contains a COM server you may be able to access it if it implements the IDispatch interface.

2. What does ‘Unsupported variant type: xxxx (0xxxxx)’ mean ?

There are dozens of VARIANT types and combinations of them. Most of them are already supported but a few still have to be implemented. Arrays are not completely supported. Only single dimensional indexed only arrays can be passed between PHP and COM. If you find other types that aren’t supported, please report them as a bug (if not already reported) and provide as much information as available.

3. Is it possible manipulate visual objects in PHP ?

Generally it is, but as PHP is mostly used as a web scripting language it runs in the web servers context, thus visual objects will never appear on the servers desktop. If you use PHP for application scripting e.g. in conjunction with PHP-GTK there is no limitation in accessing and manipulating visual objects through COM.

4. Can I store a COM object in a session ?

No, you can’t. COM instances are treated as resources and therefore they are only available in a single script’s context.

5. How can I trap COM errors ?

In PHP 5, the COM extension throws com_exception exceptions, which you can catch and then inspect the code member to determine what to do next.

In PHP 4 it’s not possible to trap COM errors beside the ways provided by PHP itself (@, track_errors, ..).

6. Can I generate DLL files from PHP scripts like i can in Perl ?

No, unfortunately there is no such tool available for PHP.

7. What does ‘Unable to obtain IDispatch interface for CLSID {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}’ mean ?

This error can have multiple reasons:

  • the CLSID is wrong
  • the requested DLL is missing
  • the requested component doesn’t implement the IDispatch interface

8. How can I run COM object from remote server ?

Exactly like you run local objects. You only have to pass the IP of the remote machine as second parameter to the COM constructor.

Make sure that you have set com.allow_dcom =TRUE in your php.ini.

9. I get ‘DCOM is disabled in C:\path…\scriptname.php on line 6′, what can I do ?

Edit your php.ini and set com.allow_dcom =TRUE.

10. Is it possible to load/manipulate an ActiveX object in a page with PHP ?

This has nothing to do with PHP. ActiveX objects are loaded on client side if they are requested by the HTML document. There is no relation to the PHP script and therefore there is no direct server side interaction possible.

11. Is it possible to get a running instance of a component ?

This is possible with the help of monikers. If you want to get multiple references to the same word instance you can create that instance like shown:

<?php
$word = new COM("C:\docs\word.doc");
?>

This will create a new instance if there is no running instance available or it will return a handle to the running instance, if available.

12. Is there a way to handle an event sent from COM object ?

You can define an event sink and bind it using com_event_sink(). You can use com_print_typeinfo() to have PHP generate a skeleton for the event sink class.

13. I’m having problems when trying to invoke a method of a COM object which exposes more than one interface. What can I do ?

The answer is as simple as unsatisfying. I don’t know exactly but i think you can do nothing. If someone has specific information about this, please let me know :)

14. So PHP works with COM, how about COM+ ?

COM+ extends COM by a framework for managing components through MTS and MSMQ but there is nothing special that PHP has to support to use such components.

15. If PHP can manipulate COM objects, can we imagine to use MTS to manage components resources, in conjunction with PHP ?

PHP itself doesn’t handle transactions yet. Thus if an error occurs no rollback is initiated. If you use components that support transactions you will have to implement the transaction management yourself.

Posted in Interview Questions, Introduction, PHP | Leave a Comment »

What can PHP do?

Posted by Ramkumar on January 24, 2009

Anything. PHP is mainly focused on server-side scripting, so you can do anything any other CGI program can do, such as collect form data, generate dynamic page content, or send and receive cookies. But PHP can do much more.

There are three main areas where PHP scripts are used.

  • Server-side scripting. This is the most traditional and main target field for PHP. You need three things to make this work. The PHP parser (CGI or server module), a webserver and a web browser. You need to run the webserver, with a connected PHP installation. You can access the PHP program output with a web browser, viewing the PHP page through the server. All these can run on your home machine if you are just experimenting with PHP programming. See the installation instructions section for more information.
  • Command line scripting. You can make a PHP script to run it without any server or browser. You only need the PHP parser to use it this way. This type of usage is ideal for scripts regularly executed using cron (on *nix or Linux) or Task Scheduler (on Windows). These scripts can also be used for simple text processing tasks. See the section about Command line usage of PHP for more information.
  • Writing desktop applications. PHP is probably not the very best language to create a desktop application with a graphical user interface, but if you know PHP very well, and would like to use some advanced PHP features in your client-side applications you can also use PHP-GTK to write such programs. You also have the ability to write cross-platform applications this way. PHP-GTK is an extension to PHP, not available in the main distribution. If you are interested in PHP-GTK, visit its own website.

PHP can be used on all major operating systems, including Linux, many Unix variants (including HP-UX, Solaris and OpenBSD), Microsoft Windows, Mac OS X, RISC OS, and probably others. PHP has also support for most of the web servers today. This includes Apache, Microsoft Internet Information Server, Personal Web Server, Netscape and iPlanet servers, Oreilly Website Pro server, Caudium, Xitami, OmniHTTPd, and many others. For the majority of the servers PHP has a module, for the others supporting the CGI standard, PHP can work as a CGI processor.

So with PHP, you have the freedom of choosing an operating system and a web server. Furthermore, you also have the choice of using procedural programming or object oriented programming, or a mixture of them. Although not every standard OOP feature is implemented in PHP 4, many code libraries and large applications (including the PEAR library) are written only using OOP code. PHP 5 fixes the OOP related weaknesses of PHP 4, and introduces a complete object model.

With PHP you are not limited to output HTML. PHP’s abilities includes outputting images, PDF files and even Flash movies (using libswf and Ming) generated on the fly. You can also output easily any text, such as XHTML and any other XML file. PHP can autogenerate these files, and save them in the file system, instead of printing it out, forming a server-side cache for your dynamic content.

One of the strongest and most significant features in PHP is its support for a wide range of databases. Writing a database-enabled web page is incredibly simple. The following databases are currently supported:

Adabas D InterBase PostgreSQL
dBase FrontBase SQLite
Empress mSQL Solid
FilePro (read-only) Direct MS-SQL Sybase
Hyperwave MySQL Velocis
IBM DB2 ODBC Unix dbm
Informix Oracle (OCI7 and OCI8)
Ingres Ovrimos

We also have a DBX database abstraction extension allowing you to transparently use any database supported by that extension. Additionally PHP supports ODBC, the Open Database Connection standard, so you can connect to any other database supporting this world standard.

PHP also has support for talking to other services using protocols such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, COM (on Windows) and countless others. You can also open raw network sockets and interact using any other protocol. PHP has support for the WDDX complex data exchange between virtually all Web programming languages. Talking about interconnection, PHP has support for instantiation of Java objects and using them transparently as PHP objects. You can also use our CORBA extension to access remote objects.

PHP has extremely useful text processing features, from the POSIX Extended or Perl regular expressions to parsing XML documents. For parsing and accessing XML documents, PHP 4 supports the SAX and DOM standards, and you can also use the XSLT extension to transform XML documents. PHP 5 standardizes all the XML extensions on the solid base of libxml2 and extends the feature set adding SimpleXML and XMLReader support.

While using PHP in the e-commerce field, you’ll find the Cybercash payment, CyberMUT, VeriSign Payflow Pro and MCVE functions useful for your online payment programs.

At last but not least, we have many other interesting extensions, the mnoGoSearch search engine functions, the IRC Gateway functions, many compression utilities (gzip, bz2), calendar conversion, translation…

Posted in Interview Questions, PHP | Leave a Comment »

What is PHP?

Posted by Ramkumar on January 24, 2009

PHP (recursive acronym for “PHP: Hypertext Preprocessor”) is a widely-used Open Source general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.

Simple answer, but what does that mean? An example:

Example

<html>
<head>
<title>Example</title>
</head>
<body>

<?php
echo "Hi, I'm a PHP script!";
?>

</body>
</html>

Notice how this is different from a script written in other languages like Perl or C — instead of writing a program with lots of commands to output HTML, you write an HTML script with some embedded code to do something (in this case, output some text). The PHP code is enclosed in special start and end tags that allow you to jump into and out of “PHP mode”.

What distinguishes PHP from something like client-side JavaScript is that the code is executed on the server. If you were to have a script similar to the above on your server, the client would receive the results of running that script, with no way of determining what the underlying code may be. You can even configure your web server to process all your HTML files with PHP, and then there’s really no way that users can tell what you have up your sleeve.

The best things in using PHP are that it is extremely simple for a newcomer, but offers many advanced features for a professional programmer. Don’t be afraid reading the long list of PHP’s features. You can jump in, in a short time, and start writing simple scripts in a few hours.

Posted in Interview Questions, PHP | Leave a Comment »

In PHP how many size data can upload by default?

Posted by Ramkumar on January 24, 2009

As far i know it depends on your limitations specified by your hosting provider but not by your script. In general when you are uploading large file sizes it is advisable to use FTP protocol to load them into your server. For small filesizes you can load them using HTTP.

The default size :2 M

Max size:16 MB

Posted in Interview Questions, PHP | Leave a Comment »

What is the difference between using copy() and move() function in PHP file uploading?

Posted by Ramkumar on January 24, 2009

Copy :Makes a copy of a file. Returns TRUE if the copy succeeded,  otherwise FALSE.syntax is copy(source,destination)

Move :  If the file is valid, it was uploaded via PHP’s HTTP POST upload mechanism,  it will be moved to the filename given by destination.Otherwise no action will occur, and move_uploaded_file() will return FALSE. syntax is same as copy().

copy the particular file source to target for Example A directory have qw.txt copy to B directory after the copy the A directory have qw.txt and B directory have qw.txt In move the A directoru does’n have qw.txt

One Big difference between copy and move command that is we

can just use move command once but the copy can use more then one thime

Posted in Interview Questions, PHP | Leave a Comment »

Explain about Type Juggling in PHP?

Posted by Ramkumar on January 24, 2009

Type Juggling

PHP does not require (or support) explicit type definition in variable declaration; a variable’s type is determined by the context in which that variable is used. That is to say, if you assign a string value to variable $var, $var becomes a string. If you then assign an integer value to $var, it

becomes an integer.

An example of PHP’s automatic type conversion is the addition operator ‘+’. If any of the operands is a float, then all operands are evaluated as floats, and the result will be a float. Otherwise, the operands will be interpreted as integers, and the result will also be an integer. Note that this does NOT change the types of the operands themselves; the only change is in how the operands are evaluated.

<?php

$foo = “0″;  // $foo is string (ASCII 48)

$foo += 2;  // $foo is now an integer (2)

$foo = $foo + 1.3;  // $foo is now a float (3.3)

$foo = 5 + “10 Little Piggies”; // $foo is integer (15)

$foo = 5 + “10 Small Pigs”;    // $foo is integer (15)

?>

If the last two examples above seem odd, see String conversion to numbers. If you wish to force a variable to be evaluated as a certain type, see the section on Type casting. If you wish to change the type of a variable, see settype(). If you would like to test any of the examples in this

section, you can use the var_dump() function. Note: The behaviour of an automatic conversion to array is currently undefined.

<?php

$a = “1″;    // $a is a string

$a[0] = “f”;  // What about string offsets? What happens?

?>

Since PHP (for historical reasons) supports indexing into strings via offsets using the same syntax as array indexing, the example above leads to a problem: should $a become an array with its first element being “f”, or should “f” become the first character of the string $a?

The current versions of PHP interpret the second assignment as a string offset identification, so $a becomes “f”, the result of this automatic conversion however should be considered undefined. PHP 4 introduced the new curly bracket syntax to access characters in string, use this

syntax instead of the one presented above:

<?php

$a    = “abc”; // $a is a string

$a{1} = “f”;  // $a is now “afc”

?>

Posted in Interview Questions, PHP | Leave a Comment »

What is the use of friend function?

Posted by Ramkumar on January 24, 2009

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 which names them as a friend, as if they were themselves members of that class. A friend declaration is essentially a prototype for a member function, but instead of requiring an implementation with the name of that class

attached by the double colon syntax, a global function or member function of another class provides the match.

Posted in Interview Questions, PHP | Leave a Comment »

how do u call in & out parameters for stored procedures?

Posted by Ramkumar on January 24, 2009

procedure_name(a in number,b out varchar)

(

script of execution;

)

exec procedure_name(first_parameter,second_parameter);

create or replace procedure p_name(p_no in out number)

is begin

{

executable statement

}

end p_name;

Posted in Interview Questions, PHP | Leave a Comment »