Thursday, July 25, 2013

TCAD Certification Questions 

I would like to post some of the questions I came across through the Titanium certification(I am still practising) and some found through google search.

I hope this resource helpful to everyone that wish to write Titanium Certification.

Please, let me know if there are any wrong answers to any of the question that I answered though my email: nagella.ranjith@gmail.com, I will update as soon as possible.  Also, If you have any other samples that I can add please, feel free to email me.

Good luck with your certification.

Questions

1. What is considered as the bootstrap file of a Titanium Project?
solution. app.js
=============================================================================================
2. The recommended use of the following ? 
Choiceseva, require, Ti.include
Solution Ti.require is preferred. 
Explanation:Ti.require uses the CommonJS specifications. Although files accessed via Ti.require have access to the Ti namespace, they don't have access to the Global namespace - any variable or functions you have declared in the main program. 
Where as Ti.include files do have access to the global space and can be modify or add to it. 
Resources Mobile best practises  https://wiki.appcelerator.org/display/guides/Mobile+Best+Practices common js module specifications - https://wiki.appcelerator.org/display/guides/CommonJS+Modules+in+Titanium 
=============================================================================================
3.What is the read only file directory ?
Solution. 
Resource Directory - Ti.FileSystem.resourceDirectory - Read only
Application Directory - Ti.FileSystem.applicationDirectory - Read/Write
Temporary Directory  - Ti.FileSystem.tempDirectory - Read/Write
external storage directory - Ti.FileSystem.externalStorageDirectory - Read/Write
=============================================================================================
4. What is the format of appID
Solution:
com.companyname.appname
=============================================================================================
5. What is the database type on Android ?
Solution:
SQLite
=============================================================================================
6. What is the database type on iOS?
Solution:
SQLite
=============================================================================================
7. What can be used for persistent data storage ?
Solution:
Explanation:
1. Titanium.App.Properties is ideal for storing application-related settings 
Point1 - The Titanium.App.Properties API provides a lightweight key/value storage. Titanium provides methods for reading and writing string, integer, boolean, and array values in properties. Any data that can be JSON searlized can be stored in an application property. Properties are a great place to store small chunks of data such as configuration data for your app. But if you have got a lot of data to store, or need to setup relations between those data points, you'd be better served putting in a database.. 
Point2 - .Application Properties - used when one or all of the following is true
 > the data consists of simple key/value pair.
 > the data related to application rather than the user.
 > the data doesn't require other data in order to be meaningful or useful
 >there only needs to be one version of the data stored at any one time 

2.Titanium.Database gives access to local SQLite3 databases 
Point1 - The database is an appropriate place to store lots of structured data or when you need transactional support. Data persists in the database until the user uninstalls your app or until you overwrite or remove the data
Point2. database used when one or all of the following is true
 > There are many similar data items 
 > items of data relate to each other
 > you require flexibility over how the data will be presented when you retrieve it
 > the data accumulates over time, such as transaction, logging, or archiving data

3. Titanium.Filesystem facilitates file and directory manipulation
Point1 - Titanium.FileSystem let's you read from and write to files on the user's device. Broadly speaking, your app is restricted to reading and writing its own files and can't access files created by other apps. On Android Devices, your app can save files to internal or external (SD Card) storage. Files are great place to store images or other binary data.
Point2. used when one or all of the following is true
 > the data is already provided in  the file format.
 > the data is an image file

Note - Although the local database has the capabilities to store images in blob (binary ) format, this won't lead to optimal performance form your application. Instead, use Titanium.Database to store the image file path and name in the database, and Titanium.Filesystem to manage the physical files.


=============================================================================================
8. What platforms support horizontal and vertical scrolling?
Solution: 
iOS
Explanation:
1. http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.ScrollView - Ti.UI.ScrollView
2. Android : On Android, a scroll view can only scroll in one  direction, either vertical or horizontal, and not both at the same time. 

=============================================================================================
9. What is the JavaScript engine on Android?
Explanation:
1. V8 is a C-based JavaScript interpreter developed primarily by Google. It is the JavaScript engine used ny the likes of Chrome and node.js, as well asTitanium Mobile for Android. In Android Platform version 2.2 and higher, V8 can be used as a JavaScript engine for Titanium by using Android's NDk (Which enables developers to write their own C code for Android). This is the default JavaScript engine used by Titanium on Android.
2. Rhino is a java-based JavaScript interpreter developed by Mozilla and Contributed to by many. Because it is java-vased, Rhino can be used in any Android environment. Not all Android devices support the NDK (despite being Android 2.2 or better), notably Google TV. IN general V8 is preferred to Rhino because the performance of V8 is significantly better in most scenarios
3. The "Android Runtime" might be considered the combination of:
 > A JavaScript engine (Rhino or V8)
 > Titanium's native C code, which provides the binding layer between the JavaScript environment in whig your source code is evaluated.
 > Titanium's Java code, which implements most of the Android APIs for UI, data access, and other platform features 
http://developer.appcelerator.com/question/133696/what-is-v8-what-is-rhino-what-is-android-runtime

=============================================================================================
10.What is the JavaScript engine on iPhone?
Solution: JavaScriptCore - iOS interpreter 
=============================================================================================
11. What is the Preferred data transmission format for mobile networks?
Solution: JSON . If considered XML and JSON as data transporter
=============================================================================================
12. what mobile platforms does Titanium support
Solution:
iOS, android, blackberry, tizen,  mobile web
=============================================================================================
13. What is the difference between a simulator and a Emulator ?
Explanation:
 > Emulator is combination of hardware and software. Simulator is only software.
 > Consider an example of android emulator, when any action is done on android emulator, the instruction is get converted into ARM call and then to the underlying operating system(windows/mac/unix)
 > In case of iPhone simulator instructions on simulator are directly converted to the native calls (Mac)
 > Thats why emulator provides more realistic behavior 
=============================================================================================
14. What is the Android specific name space for UI?
Solution:
Ti.UI.android

15. What is the iPhone specific name space for UI?
Solution:
Ti.UI.iPhone

16. What is the zIndex?
Explanation.
 > z-index is a property which determines the stack level of UI elements which is placed one over the other.  
http://www.avlabz.com/2013/02/titanium-tutorial-understanding-z-index-depth/
========================================================================
17. What is the difference between PhoneGap and Titanium?
Explanation.
 > PhoneGap applications are web applications inside a Web-View
 > PhoneGap is a web based solution where as Appcelerator Titanium is a pure JavaScript API that creates native code
========================================================================
18. What is the configuration file of an Titanium project?
Solution.
Ti.XML
========================================================================


19. What are the layout types for a view ?
 > Composite/ Absolute [Default]
 > Vertical
 > Obsolute

========================================================================

20. What are the events associated with view ?
Solution. Ti.UI.View http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.View
> Following are the list of events associated with Ti.UI.View
   - Click, dbclick, double tap,focus, key pressed, long press, pinch, postlayout, singletap, swipe, touch cancel, touchend, touchmove, touch start, twofingertap


========================================================================

21. The use of multiple execution contexts are recommended ?
Solution.  Not recommended , always recommends Single Contexts.
    1. http://developer.appcelerator.com/blog/2010/08/execution-contexts.html
    2. A JavaScript application running in a web browser is single threaded and has a global variable scope for the entire application. 
    3. A Titanium Mobile application is similar, except that a single application may have multiple JavaScript processes running at once, each with it's own unique scope. we call these "execution contexts"
    4. https://wiki.appcelerator.org/display/guides/Coding+Strategies 
    5. As is often the case in software development, the answer is "that depends". Most of the time, we recommend you use a single execution context for these reasons
      1. You can pass complex objects easily within your app's single context - where events, you can pass JSON serializable objects, but not objects with methods.
      2. You include your libraries/dependencies only once, since there is only one context - with multiple contexts, each file would need to include your libraries/dependencies, increasing memory usage.
      3. In most of the projects done by Appcelerators own Professional Service ten on Titanium Mobile, a single execution context with multiple included external files is used. However, there are instances where having multiple execution context is useful. For example, in Kitchen Sink application, it is advantageous to have a 'clean slate' for every API usage example, so we don't have to worry about polluting global scope and can keep the example easy.

========================================================================


22. You can access all the native API from a web view?
Solution.
http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.WebView

========================================================================

23. Map routing is supported on both iPhone and Android ?
Solution. only supports iPhone
 > http://developer.appcelerator.com/question/137152/map-routing
 > https://wiki.appcelerator.org/display/guides/Native+Maps+and+Annotations

========================================================================

24. Button bar is supported on both iPhone and Android?
Solution.
false, It is iOS button bar component.

========================================================================

25. The Appcelerator Platform is free and open source ?
Solution.
true

========================================================================

26. Http requests on titanium are asynchronous 
Solution. true.
Explanation.
    1. By default, the HTTPClient makes asynchronous requests. Asynchronous requests don't block the application and use callbacks to process responses when they are received 
    2. Synchronous requests block the execution of the application unitll it receives a response. On iOS and Mobile web platforms, you can make synchronous requests by setting the optional async parameter to false when calling the open method.
    3. The Android platform doesn't support synchronous requests. 
========================================================================

27. In order to use ACS in your application ?
Solution.  
Check 'Automatic Enable Cloud Services' when creating project.

========================================================================

28. You can list your API keys in either the tipaa.xml or in your JavaScript code ?
Solution. 
yes

=============================================================================================
29. If you created w/o ACS, you can't add it later. You would need to create a new Project?
Solution. 
false

=============================================================================================
30. ACS secures web service request via
Solution.
OAuth

=============================================================================================
31. The four SQLite data types are Text, Integer, Real and Blob
Options
1. true
2. false.
Explanation.
    1. There are only five underlying data types TEXT, NUMERIC, INTEGER, REAL , and NONE
    2. Binary Objects (BLOBs) are stored as Text representations, the access to BLOB is not optimal. We recommend you store BLOBs n the filesystem and store the file system path in the database.
    3. BLOB is not SQLite data type. Hence false.  
    4. https://wiki.appcelerator.org/display/guides/Working+with+a+SQLite+Database
32. SQLite is the database engine used for both iOS and Android
Solution. 
True

=============================================================================================
33. Say if wanted to store a large number of images locally in your application. What would be the preferred method for storage
Options
 1. A SQL database
2.The Properties API
3. The device file system.
Solution & Explanation.
The device file system, because the images are BLOBs. Hence, storing the images in the file system and store the path in the database.

=============================================================================================
34. You can store a JavaScript object as a string property using Ti.App.Properties.setString and JSON parse
Options
1.true
2. false
Solution &Explanation
    1. http://developer.appcelerator.com/blog/2010/06/how-to-persist-complex-javascript-objects.html
    2. True
=============================================================================================
35. The properties API uses an encrypted data store, so it is suitable for storing sensitive information like username and passwords
Options.
1. true
2. false
Solution & Explanation.
    1. Titanium.App.Properties re stored in a simple .plist file. It is in a compressed (encoded ) XML file. So not encrypted, but also not technically in plain text ( although any .plist reader, including the Mac itself, can represent it in plain text)
    2. I hope it is false with above statement.  
=============================================================================================
36. In order to use native maps components on Android in a production application, you must
Solution. 
Obtain an API key from Google to place in tiapp.xml 

=============================================================================================
37. What is reverse geocoding?
Solution.
converting Latitude, Longitude to Address

=============================================================================================
38. What is Forward geocoding ?
Solution. 
Converting Address to Lattitude, Longitude 

=============================================================================================
39. On Android you must set a property to sate why you intended to use the device location ?
Solution. 
> We don't need to set this. false.
> for iOS we must set Ti.Geolocation.Purpose
40. A MapView control ..
Solution & Explanation.
can be embedded and resized within any parent view or window.

=============================================================================================
41. Map annotations can contain custom attributes that are available in the click event for the MapView control
Solution & Explanation.
True, because id is the custom attribute that we add in the createAnnotaions 

=============================================================================================
42. The JSON module must be into the current execution context before it can be used ?
Solution & Explanation.
False, JSON is by default part of Titanium library, so no need to include it.

=============================================================================================
43. The following HTTP verbs are supported by HTTPClient ?
Options.
HEAD
POST
DELETE 
PUT
GET
Solution.
Most commonly, your mobile application will interact with this data on the web using HTTP GET or POST requests(through the full range of HTTP verbs are supported by HTTPClient: GET, POST, PUT and DELETE

=============================================================================================
44. JSON is preferred as a data transporter format in Titanium mobile because .. check that all apply
Options and Solution(in brackets)
It is easy to serialize into JavaScript objects than XML   (true)
JSON usually requires less data to be transmitted over network than XML (true)
Titanium natively doesn't support XML (false)
the JSON module has better support for SOAP (false, hopefully ) 

=============================================================================================
45. Only GET and POST request are supported by the Titanium network APIs
Solution.
true
46. Most of the time it is a bad idea to do synchronous remote data access
Solution & Explanation. 
> there js no support for synchronous network. Android doesn't support synchronous data access, but, iPhone and web has synchronous data access.
> true

=============================================================================================
47. To register an iOS device for testing, you must determine the device's 
Solution.
UDID

=============================================================================================
48. Which setting or settings must you enable on your Android device to enable app testing?
Options.
Unknow sources 
Allow mockup locations
Development mode
USB debugging
Solution.
Unknown Resources, Development mode, USB debugging 

49. Which must you create when uploading an app to the App store that you don't need when deploying an app during development ? select that all apply
Options.
A distribute Device Certififcate 
A self signed key pair
An itunes connect app entry
A distribution Provisioning profile
Solution.
A disstrubite device certficate, An itunes connect app entry, A distribution Provisioning profile 

=============================================================================================
50. Which describes the bundle seed ID ?
Option and Solution.
It specifies the app's specific name, or you can also use a wildcard specifier - CF bundle identifier (Bundle identifier must be unique for push, In app purchases, Game center)
> It is a name typically entered in revese domain order  (App ID - uniquely identifies your app)
> It is a 10- character universally unique identifier  - Bundle seed ID
> Together with the APK seed ID, It uniquely identifies your app

=============================================================================================
51. Which tool do you use to create your Android signing certificate ?
Options.
> adb
> Titanium Studio
> Xcode
> jarsigner
Solution.
> adb - android debug bridge
> Titanium studio - Sign your application - choose distribution Android market > Android SDK version > etc., these all done with the Titanium Studio
 > Xcode -
> Jarsigner - verify name of api file (last line hat verified)

=============================================================================================
52. Internationalization  files used by Titanium are in the same XML format created by native Andriod applications
Solution & Explanation
The string resource file closely mirrors the format of Android localization files, which have an XML based format. 

=============================================================================================
53. Titanium mobile JavaScript source files are not cross-compiled to native Objective-C or Java code
Solution & Explanation.
false, they are compiled to native Objective-C or Java code

=============================================================================================
54. Titanium Mobile offers an option to program in Python, PHP or A Ruby if desired rather than just JavaScript
Solution.
true

=============================================================================================

Titanium Mobile Development

I would like to post my experience with Titanium Mobile development as well as some useful resources as it goes. Please, stay to my updates!!!

Thanks for reading my blog!