Priti's Technical Corner

November 21, 2008

PHP Interview Questions


Question 1: What are the main features of PHP 5?

Answer 1 :

 Robust support for object-oriented programming.

  1. Mysqli extension which offers prepared statement, Bound input and output, subquery and other advance features.
  2. Introduction of libxml2 which is a w3c standardized class.
  3. SQLite is now bundled with PHP which supports Transactions, subqueries, triggers and many other advance features.
  4. Cleaner Error handling with exceptions.
  5. SPL-Standatd PHP Library: it provide interators which allow you to run for-each loop in directory listing,database results and XML documents.
  6. Code introspection using the reflection classes.

Question 2: which function is use to upload the files?.

Answer 2: move_uploaded_file. The function move tmp_file to the destination specified in function.

Question 3: Name super global arrays in PHP.

Answers3: $_GET,$_POST,$_REQUEST,$_SERVER,$_SESSION,$_COOKIES.

Question 4: opposite of explode function?

Answer 4:Implode()

Question5: what is difference between abstract class and interface.

Answer 5:

Abstract Class:

  1. you cann’t instantiate an abstract class.
  2. ‘extends’ keyword is used to inherit the functions and variable.\
  3. you can extend ONLY one class

Interface

  1. Only function signature is defined. The definition of functions will be in class which implements it.
  2. ‘implement’ keyword is use
  3. You can implement many interface 

Question 6: what is design pattern?

Answer 6: Design patterns are the standard solutions to common problem in object oriented software design. 

Question 7: Discuss common design patterns you have used in your projects?

Answer 7: The factory pattern is a class that has some methods that create objects for you and other I use is Singleton it can include one and only type of object at a time.

Advertisements

November 13, 2008

Mysql Questions

Filed under: Mysql — Tags: , , — pritisolanki @ 5:38 pm

Question 1: Name different types of storage engines you worked with?
Answer 1: Innodb, ISAM (I worked with them).

Question 2: What are the main features of Mysql 5?
Answer 2: In mysql 5+ we are provided with following functionalities

1. Event Scheduler is introduce to set up events like we do in crontab on Linux
2. Server log tables can be written in to log files or general_log and slow_log tables.
3. Introduced ‘mysql_upgrade’ program which checks all existing tables for incompatibilities with the current version of mysql and repair if necessary.
3. The mysqldump utility now supports an option for dumping tablespaces
4. MySQL 5.1 provides much more information in its metadata database o.e New tables in the INFORMATION_SCHEMA database include FILES, EVENTS, PARTITIONS, PROCESSLIST, ENGINES, and PLUGINS.
5. The mysqlslap program is designed to emulate client load for a MySQL server and report the timing of each stage. It works as if multiple clients were accessing the server

Question 3: What is right join?
Answer 3: All the records from right table + matching records from left table.

Question 4: Can we delete rows based on joins in mysql?
Answer 4: Yes

Question 5: How to take backup of your mysql database?

Answer 5: mysqldump on linux OR you can use PHPMyAdmin interface to export the Database.

Question 6:How to load text file in to table.
Answer 6:LOAD DATA LOCAL INFILE ‘/path/filename.txt’ INTO TABLE table_name;

Question 7: what is difference between now( ) , curdate()?
Answer 7:curdate() return date in “YYYY-MM-DD” format.
now() return the current timestamp in “YYYY-MM-DD HH:MM:SS” format.

Question 8: Write query to matches only lowercase ‘a’ at the beginning of a name
Answer  8: SELECT * FROM pet WHERE name REGEXP BINARY ‘^a’;

Older Posts »

Create a free website or blog at WordPress.com.

%d bloggers like this: