1. What is Ajax?
Ajax stands for Asynchronous Java and XML. It is a set of client side technologies that allows asynchronous communication between client and server.
In synchronous communication complete round trip is performed with each Request/Response every time even when a small portion of data is to be refreshed. Ajax solves this problem of making a complete round trip to the server by making asynchronous calls
XMLHttpRequest is the basic fundamental behind Ajax which allows browser to communicate with web server without making post back
This website is dedicated to common, day to day programming and database related Frequently Asked Questions. Popular Programming and Database Articles under one blog
Wednesday, June 13, 2012
Sunday, June 10, 2012
OOP Q&A
1. What is the difference between Abstract class and Interface?
Abstract Class
An abstract class can have one or more abstract functions but not necessarily all functions have to be abstract.
Abstract function needs to be implemented in its extending class
Abstract classes can have function definitions as well as implementations
Interface
Interfaces can only have abstract functions which must be implemented in extending class
2. What is the difference between encapsulation and abstraction?
Encapsulation
Encapsulation means information hiding i.e hiding all the complexity in one class.
Encapsulation can be achieved by grouping data and behavior in one class that is capsule and making use of access modifiers like public, protected, private along with inheritance, composition or aggregation.
Like Vehicle class has start and stop behaviors which can be inherited by Car class without knowing all the complexities involving in the start & stop functions
Abstraction
Abstraction is the characteristics of an object which differs it from other objects
Abstraction can be achieved by defining a class having one or more abstract methods which is nothing but characteristics which should be implemented by the extending class
Abstract Class
An abstract class can have one or more abstract functions but not necessarily all functions have to be abstract.
Abstract function needs to be implemented in its extending class
Abstract classes can have function definitions as well as implementations
Interface
Interfaces can only have abstract functions which must be implemented in extending class
2. What is the difference between encapsulation and abstraction?
Encapsulation
Encapsulation means information hiding i.e hiding all the complexity in one class.
Encapsulation can be achieved by grouping data and behavior in one class that is capsule and making use of access modifiers like public, protected, private along with inheritance, composition or aggregation.
Like Vehicle class has start and stop behaviors which can be inherited by Car class without knowing all the complexities involving in the start & stop functions
Abstraction
Abstraction is the characteristics of an object which differs it from other objects
Abstraction can be achieved by defining a class having one or more abstract methods which is nothing but characteristics which should be implemented by the extending class
Friday, June 8, 2012
MySQL Q&A
MySQL Storage Engines
There are many but following three are commonly used:
1. MyISAM
MyISAM is the default storage engine for MySQL
2. InnoDB
InnoDB is a transaction safe (ACID compliant) storage engine for MySQL that has commit, rollback
and crash recover capabilities to protect user data
3. Memory
Memory storage engine creates tables with contents that are stored in memory. Memory/Heap tables are used for high speed temporary storage. Only Comparison operators supported (=, <=>). TEXT or BLOB fields are not supported. Auto Increment fields also not supported
Comparison
Features MyISAM InnoDB Memory
Storage Limits 256TB 64TB RAM
Transaction No Yes No
Locking Table Row Table
Full Text Search Indexes Yes No No
Clustered Indexes No Yes No
Replication Support Yes Yes Yes
Foreign Key No Yes No
What is the difference between MyISAM static and MyISAM dynamic?
MyISAM static tables fields are fixed length. MyISAM dynamic tables can have variable length fields
such as Text, BLOB etc
Advantages of MyISAM over InnoDB
MyISAM tables are stored on disk which can therefore be compressed so it can accommodate a very large set of data
Advantages of InnoDB over MyISAM
Transaction support, row level locking, foreign key constraints, crash recovery
What is Serial Data Type in MySQL?
BIGINT NOT NULL PRIMARY KEY AUTO INCREMENT
What are Federated Tables?
They are like linked tables in SQL Server which allows access to tables on different server
What is Candidate Key?
Any table that uniquely identifies a row in a table is candidate key for that table. We select one of the candidate keys as primary key
Difference between Primary Key and Unique Key
Primary Key
1. Uniquely identifies a column
2. Cannot be NULL
3. There can only be one primary key in a table
Unique Key
1. Uniquely identifies a column
2. Can be NULL
3, There can be more than unique keys
What is the difference between Drop Table and Truncate Table?
Drop table deletes table including data, structure, attributes & indexes
Truncate table deletes only the data
There are many but following three are commonly used:
1. MyISAM
MyISAM is the default storage engine for MySQL
2. InnoDB
InnoDB is a transaction safe (ACID compliant) storage engine for MySQL that has commit, rollback
and crash recover capabilities to protect user data
3. Memory
Memory storage engine creates tables with contents that are stored in memory. Memory/Heap tables are used for high speed temporary storage. Only Comparison operators supported (=, <=>). TEXT or BLOB fields are not supported. Auto Increment fields also not supported
Comparison
Features MyISAM InnoDB Memory
Storage Limits 256TB 64TB RAM
Transaction No Yes No
Locking Table Row Table
Full Text Search Indexes Yes No No
Clustered Indexes No Yes No
Replication Support Yes Yes Yes
Foreign Key No Yes No
What is the difference between MyISAM static and MyISAM dynamic?
MyISAM static tables fields are fixed length. MyISAM dynamic tables can have variable length fields
such as Text, BLOB etc
Advantages of MyISAM over InnoDB
MyISAM tables are stored on disk which can therefore be compressed so it can accommodate a very large set of data
Advantages of InnoDB over MyISAM
Transaction support, row level locking, foreign key constraints, crash recovery
What is Serial Data Type in MySQL?
BIGINT NOT NULL PRIMARY KEY AUTO INCREMENT
What are Federated Tables?
They are like linked tables in SQL Server which allows access to tables on different server
What is Candidate Key?
Any table that uniquely identifies a row in a table is candidate key for that table. We select one of the candidate keys as primary key
Difference between Primary Key and Unique Key
Primary Key
1. Uniquely identifies a column
2. Cannot be NULL
3. There can only be one primary key in a table
Unique Key
1. Uniquely identifies a column
2. Can be NULL
3, There can be more than unique keys
What is the difference between Drop Table and Truncate Table?
Drop table deletes table including data, structure, attributes & indexes
Truncate table deletes only the data
JSON Q&A
1. What is JSON?
JSON is a light weight, text based (human readable) open format used for data transformation.
JSON is language independent with parsers available in many languages
JSON is often used for serializing and transmitting structured data over a network connection.
Hence it is used as an alternative to XML
2. Why JSON over XML?
JSON
(i) Is lighter and faster than xml
(ii) Objects are typed
(iii) Data types in JSON can be number, string, bool, arrays whereas in xml only strings
3. How is JSON structured?
JSON is structured as a collection of name value pairs
JSON is a light weight, text based (human readable) open format used for data transformation.
JSON is language independent with parsers available in many languages
JSON is often used for serializing and transmitting structured data over a network connection.
Hence it is used as an alternative to XML
2. Why JSON over XML?
JSON
(i) Is lighter and faster than xml
(ii) Objects are typed
(iii) Data types in JSON can be number, string, bool, arrays whereas in xml only strings
3. How is JSON structured?
JSON is structured as a collection of name value pairs
Subscribe to:
Posts (Atom)