Answer: C We can't really call it as a language. It is light weight text-based format used to exchange data between two systems connected in the network. It is an alternative to xml way of transferring data between systems.
Description: Its full form is JavaScript Object Notion.
Answer: A Number, String, Boolean, null, Array, Object.
Description:
Answer: D option 2 is true, and many of the web sites and services including twitter, facebook, google, linkedin uses json than xml.
Description: for small data - use name spaces, for heavy structured data - use json. json is faster than xml. json has advantage over xml with java script which is sued to update client side web page fastly.
Answer: C i & iii
Description: Response status code >=400 means error, else success.
Note : as a simple example, status code 404 is an error "page not found". So error codes are always > 400.
Answer: D ii & iv
Description: The purpose of Main UI thread is to take care of all UI events coming to the screen from the user. All UI is under control of Main thread.
Connecting to internet is a heavy functionality. Basic android rule says don't do more than 1 heavy functionality in Main UI thread. Because it affects UI responsiveness and it may lead to ANR (Application Not Responding) error at run time.
Connecting to internet in main thread, wont give any error till 2.3 version but may lead to ANR at run time.
From 3.0 it is mandatory that all network connections has to happen in separate worker thread else it throws run time exception.
Exception name is : NetworkOnMainThreadException
Answer: D till before Froyo better to use option DefaultHTTPClient or AndroidHttpClient, but from then on wards better to use HTTPUrlConnection as it has the size advantage over later.
Description: To connect to internet, till before Froyo better to use DefaultHttpClient or AndroidHttpClient, but from then on wards better to use HTTPUrlConnection as it has the size advantage over later.
Answer: A DefaultHttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost("http://mail.google.com/");
List<NameValuePair> params = new ArrayList<NameValuePair>(3);
params.add(new BasicNameValuePair("Email", "username@gmail.com"));
params.add(new BasicNameValuePair("Passwd", "password here"));
params.add(new BasicNameValuePair("signIn", "Sign in"));
post.setEntity(new UrlEncodedFormEntity(params));
HttpResponse res = client.execute(post);
if(res.getStatusLine().getStatusCode() < 400)
//success
else
//fail
Description: DefaultHttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost("http://mail.google.com/");
List<NameValuePair> params = new ArrayList<NameValuePair>(3);
params.add(new BasicNameValuePair("Email", "username@gmail.com"));
params.add(new BasicNameValuePair("Passwd", "password here"));
params.add(new BasicNameValuePair("signIn", "Sign in"));
post.setEntity(new UrlEncodedFormEntity(params));
HttpResponse res = client.execute(post);
if(res.getStatusLine().getStatusCode() < 400)
//success
else
//fail
Answer: B i & ii
Description: If the data is very small, then use NameValuePairs. And if the data is heavy structured data, then use JSON. Because JSON is lighter than xml so transferring speed will be fast. JSON can be easily transferred to javascript object compared to XML, so its preferred to use json.
Note : JSON will get lot of advantage over xml especially when used with AJAX kind of technology which refreshes page content dynamically with out reloading entire page.
Answer: C JSON is faster than XML, XML is faster than SOAP. But if we want to SOAP in mobiles, we can go with KSOAP designed for embedded devices which is faster.
Description: JSON is faster than XML, XML is faster than SOAP. But if we want to SOAP in mobiles, we can go with KSOAP designed for embedded devices which is faster than SOAP.
Answer: B JSONException
Description:
Answer: B i & ii
Description: JSONObject & JSONArray.
Answer: A use length() function
Description: use length() function on JSONArray object to find number of elements in it.
Answer: B facebook, google drive, twitter, linkedin
Description: Now a days almost all famous social networking sites and search engines uses JSON as the mechanism to send and receive data. JSON is lightweight and faster compared to other ways of data transmission.
Answer: C 2,3
Description: GCM is a faster mechanism to push data (light weight) from your web server to all your client mobile devices at a time with free of cost. It is a framework deisgned by Google to support faster and free data transimission between server to mobile deives that is powerd by android. This is a 2 way communication channel that allows even android devices to send the data to the web server via GCM framework. This is really useful to the start up companies who can't afford high bandwidth communication rates to the mobile clients to communicate.
Answer: A ClientProtocolException, IOException, UnsupportedEncodingException, XmlPullParserException
Description: ClientProtocolException - if httpget or post protocol is not proper, IOException - if network connection could not be established with server, UnsupportedEncodingException - while encoding the data to be send if encoding format is not supported, XmlPullParserException - while parsing xml data that we got from server.