Thursday, 21 August 2014

XML Interview Questions And Answers

XML Interview Questions And Answers

What is full Form XML?
Extensible Markup Language.


What is XML?
It is text-based standard design for interchange the information between two application. There are no predefined tags and attributes in XML. you can create your own tags and attributes in tag.


Who created the XML?
Jon Bosak


Why It is so popular?
  • It is free standard for exchange information.
  • It is independent of language.
  • It is independent of Hosting Server 
  • Human Readable.
  • You can create your Own tags in XML. 
  • Used for embed images, video etc

Where XML is used?
It is used to exchange the information between two application. Information can also be exchanged between two different application which is running on different OR same server. It is used in Web Application, Mobile Application (IOS, Android, Iphone, window Phone) for providing the API. It is also used AS installer in web application, you can set the application configuration in XML file.


Why it is used?
  • It is Opensource.
  • It is easy to understand.
  • you can create your own tags. 
  • Independent of languages and OS.
  • You can embed photo, videos in XML.

What is file extension of XML?
.xml


How the raw XML file can be viewed in a browser?
Raw XML files can be viewed in Mozilla, Firefox, Opera, Internet Explorer and in Netscape. For make XML documents to display like nice web pages, you will have to add some display information.


How to parse XML in PHP?
http://www.web-technology-experts-notes.in/2013/05/parse-xml-in-php-by-example.html


What is a CDATA section in XML?
The CDATA is used when you don't want some text data be parsed by the XML parser.
<![CDATA[ HERE IS NON-PARSED DATA]]>
Now, above data will not parse.


What is XQuery?
Xquery is a query language that is used to retrieve data from XML documents. You can add, update, delete and list the XML with use of XQuery.


What i XMLA ?
It is protocol of Microsoft  for XML-messaging used for exchanging data between client and servers.


What is XSL?
XSL is a language used for expressing style sheets. An XSL style sheet is a file that describes the way to display an XML document.


What is the difference between XML and HTML?
HTML XML
Used for displaying information. Used for data representation.
HTML is used to mark up text so it can be displayed to users. XML is used to mark up data so it can be processed by computers.
HTML describes both structure (e.g. <p>, <h2>, <em>) and appearance (e.g. <br>, <font>, <i>) XML describes only content
HTML uses a fixed, unchangeable tags There is no predefined tags, you can create your own.



What are the benefits of XML?
Simplicity
Openness
Extensibility
Self-description
Contains machine-readable context information- Tags, attributes and element structure provide context information. Can embed multiple data types - XML documents can contain any possible data type - from multimedia data (image, sound, video) to active components (Java applets, ActiveX).



What is a well-formed XML document?
If a document is syntactically correct it can be called as well-formed XML documents.
Every open tag must be closed.
The open tag must exactly match the closing tag: XML is case-sensitive.
All elements must be embedded within a single root element.
Child tags must be closed before parent tags.
A well-formed document has correct XML tag syntax, but the elements might be invalid for the specified document type.



How to add CSS in XML File?
<!--xml-stylesheet type="text/css" href="/css/mystyle.css"?-->



How to add CSS in XML File?
<script>
<![CDATA[
function()
{
    any code........
}
]]>
</script>

Tuesday, 19 August 2014

Json Interview Questions And Answers For Freshers

Json Interview Questions And Answers For Freshers

Question: What is full Form JSON?
Answer: JavaScript Object Notation.


Question: What is JSON?
Answer: It is text-based standard design for interchange the information Between two or more different application. It is also very light as compare to XML and human readable.


Question: Who created the JSON?
Answer: Douglas Crockford


Question: Who is Father of JSON?
Answer: Douglas Crockford


Question: Why It is so popular?
Answer:
  1. It is light weight standard for exchange information
  2. It is independent of language
  3. It is independent of Hosting Server
  4. Human Readable
  5. Easy to Encode
  6. Easy to Decode
  7. Used in Mobile application



Question: Where JSON is used?
Answer: It is used to transfer the information between two application. Information can also be exchanged between two different application which is running on different OR same server. It is used in Web Application, Mobile Application (IOS, Android, Iphone, window Phone)


Question: What is file extension of JSON?
Answer: .json


Question: Why Use JSON over XML?
Answer: 

  1. It is light weight standard for exchange information.
  2. Human readable
  3. Easy to parse in PHP as well as in javaScript.
  4. Due to light weight It is fast.
  5. Question: Explain JSON Structures?
  6. Answer: It as an object, structure, or associative array where we stored data an ordered list.
  7. Each value have an key
  8. once key may have an further object
  9. Its lightweight that's why used in android application
  10. A JSON object begins with { and ends with } (braces)
  11. Each name is followed by : (colon) and the name/value pairs are separated by , (comma)


Question: Which Browser Support JSON?
Answer: JSON support is included in newer browsers and in the newest ECMAScript (JavaScript) standard.

  • Firefox (Mozilla) 3.5
  • Internet Explorer 8
  • Chrome
  • Opera 10
  • Safari 4



Question: What is JSON Parser?
Answer:JSON Parser is used to parse the JSON data into object to use its value. JSON can be parse by javaScript, jQuery and PHP.


Question: What is JSON-RPC?
Answer: Remote Procedure call protocol with use of JSON. It is similar to XML-RPC only difference, It use JSON instead of XML.

Question: What is JSON-RPC-Java?
Answer: JSON-RPC-Java is a Java implementation of the JSON-RPC protocol.


Question: How to create json from php array?
Answer:
$array = array('name'=>'PHP Tutorial','Description'=>'Web technology experts notes');
echo json_encode($array);


Question: How to get PHP array from json Object?
Answer:
$object='{"name":"PHP Tutorial","Description":"Expert in web technology"}';
$array = json_decode($object);


Question: How to parse JSON in JavaScript?
Answer:
var json = '{"name":"PHP Tutorial","Description":"Web technology experts notes"}'
    var obj = JSON.parse(json);
    //alert(obj.name);


Question: How to create JSON Object from JavaScript?
Answer:
var obj = {};
    obj['name']='php-tutorial-php.blogspot.in'; //string
    obj['age'] = 32;  // integer.
    obj['marks']= [80,70,60,50,60,80]; //array


Question: How to parse JSON in jQuery?
Answer:
var json = '{"name":"PHP Tutorial","Description":"Web technology experts notes"}'
    obj = $.parseJSON(json);
    //alert(obj.name);


Question: How to Validate json in php?
Answer:
$json = '{"name":"PHP Tutorial","Description":"Web technology experts notes"}';
$obj = json_decode($json);
if(is_null($obj)) {
 die('Invalid JSON');
}


Question: How to Validate json in javascript?
Answer:
function isValidJson(jsonData) {
    try {
        JSON.parse(jsonData);
        return true;
    } catch (e) {
        return false;
    }
}
var json = '{"name":"PHP Tutorial","Description":"Web technology experts notes"}'
isValidJson(json);


Question: How to Validate json in jQuery?
Answer:
 function isValidJson(jsonData) {
    try {
        $.parseJSON(jsonData);
        return true;
    } catch (e) {
        return false;
    }
}
var json = '{"name":"PHP Tutorial","Description":"Web technology experts notes"}'
isValidJson(json);


Question: How Convert json object to json string in jquery?
Answer:
var json = '{"name":"PHP Tutorial","Description":"Web technology experts notes"}'
JSON.stringify(json)


Question: How to convert json object to json string in javaScript?
Answer:
var json = '{"name":"PHP Tutorial","Description":"Web technology experts notes"}'
JSON.stringify(json)


Question: How to receive JSON Data at the Client Side?
Answer:
var json = '{"name":"PHP Tutorial","Description":"Web technology experts notes"}'
obj = $.parseJSON(json)


Question: How to get JSON response in Ajax?
Answer:
$.ajax({
  dataType: "json",
  url: '/ajax/url',
  data: 'name=php-tutorial-php',
  success: function(data){
  //data
  }
});


Question: What are online tool for Validate JSON data?
Answer:
http://jsonlint.com
http://www.freeformatter.com/json-validator.html


Question: What are JSON online tool for Formatter & Validator?
Answer: http://jsonlint.com/
http://www.freeformatter.com/json-validator.html
http://jsonviewer.stack.hu/
http://json.parser.online.fr/