NGM College PG Department of Computerscience 18Pcs101-Android Programming
NGM College PG Department of Computerscience 18Pcs101-Android Programming
NGM College PG Department of Computerscience 18Pcs101-Android Programming
PG DEPARTMENT OF COMPUTERSCIENCE
18PCS101-ANDROID PROGRAMMING
Unit-I
1 . Explain android activity life cycle?
A onCreate() −> onStart() −> onActivityStarted() −> onResume() −> onPause() −> onStop() −>
onActivityDistroy() −> onDestroy()
B - OnCreate() −> onStart() −>onResume() −> onPause() −> onStop() −> onRestart() −>
onDestroy()
C - OnCreate() −> onStart() −> onPause() −> onResume() −> onStop() −> onDestroy()
D - −>onResume()
Answer : B
3 . How to upgrade SQlite the database from a lower version to higher version in android SQlite?
A - Using helper Class
B - Using cursor
C - Using intent
D - None of the above
Answer : A
4 . What are commands needed to create APK in android?
A - No need to write any commands
B - Create apk_android in command line
C - Javac,dxtool, aapt tool, jarsigner tool, and zipalign
D - None of the above
Answer : C
Answer : D
Unit-II
15. Which of the following Dialog boxes are supported by Android? 1) AlertDialog 2)
ProgressDialog 3) DatePickerDialog 4) TimePickerDialog<
A. 1 and 2
B. 3 and 4
C. all of the above
D. none of these
Answer : C
16. If you provide a _________, your choice identifier (second parameter) can be 0.
A. Runnable
B. Tapas
C. Includes
D. Droide
17. If you want to increase the whitespace between widgets, you will need to use the
____________ property
A. Android:padding
B. Android:digits
C. Android:capitalize
D. Android:autoText
Answer : A
18. Using a content provider, which of the following operations are able to perform? 1) create 2)
read 3) update 4) delete
A. 1,2,3
B. 2,3,4
C. all of the above
D. none of these
Answer : C
19.Which of the following don’t have any UI component and run as a background process?
A. Services
B. simulator
C. Emulator
D. none of these
ANSWER: A
21.Which of the following holds Java source code for the application?
A. res/
B. assets/
C,src/
D. bin/
ANSWER: C
22. Which of the following(s) is/are component of APK file?
A. Resources
B. Delvik Executable
C. both a and b
D. none of above
ANSWER: C
23.Typically MIME type will be
A. html
B.text
C. Text/HTML
D. Doc
ANSWER: D
24.Eclipse is an ________
A. Android tool
B. IDE
C. Android interface
D. none of these
ANSWER: B
25.To update contents of content provider using curser and commit you need to call________
A. commitUpdates()
B. updates()
C.commit()
D. none of these
ANSWER: A
26. insert data into a content provider, you need to use______ 1) insert() 2) bulkInsert() 3)
getContentProvider() 4)update()
A 1 and 2
B. 3 and 4
C all of the above
D none of these
ANSWER: A
27.What is mean by ANR?
A Application not Recognized
B Android not recognized
C Application Not Responding
D none of these
ANSWER: C
28.ADB stands for
A Android Debug Bridge
B Application Debug Bridge
C Android data bridge
D Application data bridge
ANSWER: A
29. In ___________, sender specifies type of receiver.
A Implicit intent
B Explicit intent
C a and b
D none of these
ANSWER: A
30. Which of the following are different storage methods available in Android? 1) Shared
Preferences 2) Internal Storage 3) External Storage 4) SQLite Databases 5) Network Connection
6)Intermediate storage
A. 1,2,3,4,6
B. 2,3,4,5,6
C. 1,2,3,4,5
D. all of above
ANSWER: C
Unit-IV
Unit-V
41.Where will you declare your activity so the system can access it?
Activity is to be declared in the manifest file. For example:
<manifest></manifest>
<application></application>
<activity android:name=”.MyIntellipaat”>
42. What is an anonymous class in android?
A - Interface class
B - A class that does not have a name but have functionalities in it
C - Java class
Answer : B
43. What are return types of startActivityForResult() in android?
A - RESULT_OK
B - RESULT_CANCEL
C - RESULT_CRASH
D-A&B
Answer : D
44. What is an activity in Android?
A - Activity performs the actions on the screen
B - Manage the Application content
C - Screen UI
D - None of the above
Answer : A
45. DEFINE- Linear Layout
LinearLayout is a view group that aligns all children in a single direction, vertically or
horizontally.
46. DEFINE- Relative Layout
RelativeLayout is a view group that displays child views in relative positions.
47. What is An Intent?
It is connected to either the external world of application or internal world of application ,Such
as, opening a pdf is an intent and connect to the web browser.etc.
Unit-I
1) Explain Android.
It is an open-sourced operating system that is used primarily on mobile devices, such as cell
phones and tablets. It is a Linux kernel-based system that's been equipped with rich components
that allows developers to create and run apps that can perform both basic and advanced
functions.
The Google Android SDK is a toolset that developers need in order to write apps on Android
enabled devices. It contains a graphical interface that emulates an Android driven handheld
environment, allowing them to test and debug their codes.
· Linux Kernel
· Libraries
· Android Framework
· Android Applications
The Android Framework is an important aspect of the Android Architecture. Here you can find
all the classes and methods that developers would need in order to write applications on the
Android environment.
AAPT is short for Android Asset Packaging Tool. This tool provides developers with the ability
to deal with zip-compatible archives, which includes creating, extracting as well as viewing its
contents.
6) Mention is the importance of having an emulator within the Android environment?
The emulator lets developers "play" around an interface that acts as if it were an actual mobile
device. They can write and test codes, and even debug. Emulators are a safe place for testing
codes especially if it is in the early design phase.
An activityCreator is the first step towards the creation of a new Android project. It is made up
of a shell script that will be used to create new file system structure necessary for writing codes
within the Android IDE.
8 ) Describe Activities.
Activities are what you refer to as the window to a user interface. Just as you create windows in
order to display output or to ask for an input in the form of dialog boxes, activities play the same
role, though it may not always be in the form of a user interface.
Intents displays notification messages to the user from within the Android enabled device. It can
be used to alert the user of a particular state that occurred. Users can be made to respond to
intents.
Activities can be closed, or terminated anytime the user wishes. On the other hand, services are
designed to run behind the scenes, and can act independently. Most services run continuously,
regardless of whether there are certain or no activities being executed.
Unit-II
These are the essential items that are present each time an Android project is created:
· AndroidManifest.xml
· build.xml
· bin/
· src/
· res/
· assets/
12) Specify the importance of XML-based layouts.
The use of XML-based layouts provides a consistent and somewhat standard means of setting
GUI definition format. In common practice, layout details are placed in XML files while other
items are placed in source files.
Containers, as the name itself implies, holds objects and widgets together, depending on which
specific items are needed and in what particular arrangement that is wanted. Containers may hold
labels, fields, buttons, or even child containers, as examples.
Orientation, which can be set using setOrientation(), dictates if the LinearLayout is represented
as a row or as a column. Values are set as either HORIZONTAL or VERTICAL.
Developers can write and register apps that will specifically run under the Android environment.
This means that every mobile device that is Android enabled will be able to support and run
these apps. With the growing popularity of Android mobile devices, developers can take
advantage of this trend by creating and uploading their apps on the Android Market for
distribution to anyone who wants to download it.
Given that Android is an open-source platform, and the fact that different Android operating
systems have been released on different mobile devices, there's no clear cut policy to how
applications can adapt with various OS versions and upgrades. One app that runs on this
particular version of Android OS may or may not run on another version. Another disadvantage
is that since mobile devices such as phones and tabs come in different sizes and forms, it poses a
challenge for developers to create apps that can adjust correctly to the right screen size and other
varying features and specs.
Adb is short for Android Debug Bridge. It allows developers the power to execute remote shell
commands. Its basic function is to allow and control communication towards and from the
emulator port.
ANR is short for Application Not Responding. This is actually a dialog that appears to the user
whenever an application have been unresponsive for a long period of time.
20) Which elements can occur only once and must be present?
Among the different elements, the and elements must be present and can occur only once. The
rest are optional, and can occur as many times as needed.
Unit-III
Escape characters are preceded by double backslashes. For example, a newline character is
created using '\\n'
Permissions allow certain restrictions to be imposed primarily to protect data and code. Without
these, codes could be compromised, resulting to defects in functionality.
Because every component needs to indicate which intents they can respond to, intent filters are
used to filter out intents that these components are willing to receive. One or more intent filters
are possible, depending on the services and activities that is going to make use of it.
A call to onStop method happens when an activity is no longer visible to the user, either because
another activity has taken over or if in front of that activity.
26) Is there a case wherein other qualifiers in multiple resources take precedence over
locale?
Yes, there are actually instances wherein some qualifiers can take precedence over locale. There
are two known exceptions, which are the MCC (mobile country code) and MNC (mobile
network code) qualifiers.
· foreground activity
· visible activity
· background activity
· empty process
One technique that prevents the Android system from concluding a code that has been responsive
for a long period of time is to create a child thread. Within the child thread, most of the actual
workings of the codes can be placed, so that the main thread runs with minimal periods of
unresponsive times.
Dalvik serves as a virtual machine, and it is where every Android application runs. Through
Dalvik, a device is able to execute multiple virtual machines efficiently through better memory
management.
This file is essential in every application. It is declared in the root directory and contains
information about the application that the Android system must know before the codes can be
executed.
Unit-IV
31) What is the proper way of setting up an Android-powered device for app development?
The following are steps to be followed prior to actual application development in an Android-
powered device:
-Declare your application as "debuggable" in your Android Manifest.
-Turn on "USB Debugging" on your device.
-Set up your system to detect your device.
When default resources, which contain default strings and files, are not present, an error will
occur and the app will not run. Resources are placed in specially named subdirectories under the
project res/ directory.
34) When dealing with multiple resources, which one takes precedence?
Assuming that all of these multiple resources are able to match the configuration of a device, the
'locale' qualifier almost always takes the highest precedence over the others.
The ANR dialog is displayed to the user based on two possible conditions. One is when there is
no response to an input event within 5 seconds, and the other is when a broadcast receiver is not
done executing within 10 seconds.
AIDL, or Android Interface Definition Language, handles the interface requirements between a
client and a service so both can communicate at the same level through interprocess
communication or IPC. This process involves breaking down objects into primitives that
Android can understand. This part is required simply because a process cannot access the
memory of the other process.
-string
-charSequence
-List
-Map
-all native Java data types like int,long, char and Boolean
38) What is a Fragment?
A fragment is a part or portion of an activity. It is modular in a sense that you can move around
or combine with other fragments in a single activity. Fragments are also reusable.
A visible activity is one that sits behind a foreground dialog. It is actually visible to the user, but
not necessarily being in the foreground itself.
The foreground activity, being the most important among the other states, is only killed or
terminated as a last resort, especially if it is already consuming too much memory. When a
memory paging state has been reach by a foreground activity, then it is killed so that the user
interface can retain its responsiveness to the user.
Unit-V
Yes, it is possible to do that, such as when you want to create a background behavior for a
particular activity. You can do this by using add(Fragment,string) method to add a fragment from
the activity.
42) How do you remove icons and widgets from the main screen of the Android device?
To remove an icon or shortcut, press and hold that icon. You then drag it downwards to the lower
part of the screen where a remove button appears.
43) Write the core components under the Android application architecture.
- services
- intent
- resource externalization
- notifications
- content providers
A Sticky Intent is a broadcast from sendStickyBroadcast() method such that the intent floats
around even after the broadcast, allowing others to collect data from it.
46) Do all mobile phones support the latest Android operating system?
Some Android-powered phone allows you to upgrade to the higher Android operating system
version. However, not all upgrades would allow you to get the latest version. It depends largely
on the capability and specs of the phone, whether it can support the newer features available
under the latest Android version.
Portable Wi-Fi Hotspot allows you to share your mobile internet connection to other wireless
device. For example, using your Android-powered phone as a Wi-Fi Hotspot, you can use your
laptop to connect to the Internet using that access point.
In Android development, an action is what the intent sender wants to do or expected to get as a
response. Most application functionality is based on the intended action.
49) Give the difference between a regular bitmap and a nine-patch image?
In general, a Nine-patch image allows resizing that can be used as background or other image
size requirements for the target device. The Nine-patch refers to the way you can resize the
image: 4 corners that are unscaled, 4 edges that are scaled in 1 axis, and the middle one that can
be scaled into both axes.
The main language supported is Java programming language. Java is the most popular language
for app development, which makes it ideal even for new Android developers to quickly learn to
create and deploy applications in the Android environment.
NGM COLLEGE
PG DEPARTMENT OF COMPUTERSCIENCE
18PCS101-ANDROID PROGRAMMING
K3 Level Questions:
Unit-I:
Unit-II:
Unit-IV:
31. Discuss about Motion Events with example.
32. Discuss about Motion Event Object with example.
33. Discuss about recycling Motion Events.
34. Discuss about Velocity Tracker with example.
35. Examine Multitouch with example.
36. Examine Gestures with example.
37. Examine Drag and Drop with example.
38. Discuss about detecting Sensors.
39. Examine Sensor Events with example.
40. Write notes on interpreting Sensor Data.
Unit-V:
41. Examine the concept of Security in Android.
42. Classify the types of Permissions in Android.
43. Discuss about the Android Security Model.
44. How do you perform Runtime Security Checks in Android?
45. Write notes on deploying the Android Application.
46. Write the steps for becoming a Android Application Publisher.
47. Discuss about preparing the Application for sale.
48. Explain payment options in Android Application.
49. Explain the rules to be followed during uploading the Android Application.
50. Write notes on uploading the Android Application.
NGM COLLEGE
PG DEPARTMENT OF COMPUTERSCIENCE
18PCS101-ANDROID PROGRAMMING
Unit-I:
1. Explain Android’s Fundamental Components.
2. Explain about the structure of an Android Application.
3. Classify the different ways if designing the User Interface in Android.
4. Explain about various Layouts in Android.
5. Explain Resources and Backgrounds in Android.
Unit-II:
6. Explain about various controls in Android.
7. Explain about Adapters and List Controls in Android.
8. Explain the basic List control and List View control.
9. What is Gallery Control? Explain with an example program.
10. Explain Menus and Action bars with example program
Unit-III:
11. What is Fragment? Explain the Structure of Fragment and its uses.
12. Explain about Broadcast Receivers with example program.
13. What is SQLite? What are the Packages and Classes available in SQLite?
14. Explain about exploring databases on the Emulator and available devices.
Unit-IV:
16. What is MotionEvent? Explain about about Motion Event Object with example.
17. Explain about Velocity Tracker with example.
18. Write an Android program to display the available sensors in an Android device.
19. Explain Multitouch. Write an Android program to implement the concept of Multitouch.
20. Explain the concept of Drag and Drop with example program.
Unit-V:
21. Explain the concept of Security in Android. Discuss about the Android Security model.
22. Write notes on deploying the Android Application.
23. Explain payment options in Android Application. Discuss about preparing the
Application for sale.
24. Explain how to perform Runtime Security Checks in Android.
25. Create an Android Application for Chat Server and Client. Write the steps for uploading
the Android Application on Google Play Store.