Question Bank PT1-MAD-22-23-CO-IF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

Question Bank-PT1

Subject: Mobile Application Development

Sub.Code:22617

Course/Year: CO6I (A+B) and IF6I

Academic Year: 22-23

2 Marks Questions

1. State features of android O.S.

ANS:

Beautiful UI

Android OS basic screen provides a beautiful and intuitive user interface.

Storage

SQLite, a lightweight relational database, is used for data storage purposes.

Multi-touch

Android has native support for multi-touch which was initially made available in
handsets such as the HTC Hero.

Messaging

SMS and MMS are available forms of messaging,

Web browser

Based on the open-source layout engine, coupled with Chrome's V8 JavaScript engine
supporting HTML5 and CSS3 it provides different browser support.

Media support

Android supports the following audio/video/still media formats: H.263, H.264, MPEG-4
SP, AMR, AMR-WB, AAC, HE-AAC, AAC 5.1, MP3, MIDI, Ogg Vorbis, WAV, JPEG, PNG, GIF,
and BMP.

Multiple language support


Android supports multiple languages.

CO-IF dept PT-1 Question Bank 21-22 by Poonam V Page 1


Connectivity

Android supports connectivity technologies


including GSM/EDGE, Bluetooth, LTE, CDMA, EV-DO, UMTS, NFC, IDEN and WiMAX.

2. List the different Android versions.

ANS: Android 1.0


Android 1.1
Android 1.5: Android Cupcake
Android 1.6: Android Donut
Android 2.0: Android Eclair
Android 2.2: Android Froyo
Android 2.3: Android Gingerbread
Android 3.0: Android Honeycomb
Android 4.0: Android Ice Cream Sandwich
Android 4.1 to 4.3.1: Android Jelly Bean
Android 4.4 to 4.4.4: Android KitKat
Android 5.0 to 5.1.1: Android Lollipop
Android 6.0 to 6.0.1: Android Marshmallow
Android 7.0 to 7.1: Android Nougat
Android 8.0 to Android 8.1: Android Oreo
Android 9.0: Android Pie
Android 10

3. Explain features of Android SDK.


Android SDK is a collection of libraries and Software Development tools that are
essential for
Developing Android Applications. Whenever Google releases a new version or
update of Android Software, a corresponding SDK also releases with it. In the
updated or new version of SDK, some more features are included which are not
present in the previous version. Android SDK consists of some tools which are
very essential for the development of Android Application. These tools provide a
smooth flow of the development process from developing and debugging.
Android SDK is compatible with all operating systems such as Windows, Linux,
macOS, etc.
1. Android Tool: This tool helps in managing the Android Virtual Device projects
as well as the installed components of the software development kit.
CO-IF dept PT-1 Question Bank 21-22 by Poonam V Page 2
2. Emulator Tool: It helps us in testing the applications without the need of using
the application on an actual device.
3. Dalvik Debug Monitor Server(DDMS): DDMS is very useful for debugging the
Android Application.
4. Android Debug Bridge (ADB): It is a very versatile command-line tool and is
helpful for the communication between the developer and the Emulator or the
Android device that is connected.

4. State how the APK files are built?


The javac compiler compiles the java source file into the class file.
 The dx tool takes all the class files of your application and generates a
single .dex file which is a platform specific tool.
 Then Android Assets Packaging Tool (aapt) handles the packaging
process and finally creates an executable file with extension .apk.
 An APK file contains all of a program's code (such as .dex files), resources,
assets, certificates, and manifest file.

5. List eight alignment attributes of relative layout.

ANS: The 8 alignment attributes are:

android:layout_alignParentTop

android:layout_alignParentBottom

android:layout_alignParentLeft

android:layout_alignParentRight

android:layout_alignTop

android:layout_alignBottom

android:layout_alignLeft

android:layout_alignRight

CO-IF dept PT-1 Question Bank 21-22 by Poonam V Page 3


6. What is OHA?

ANS: Open Handset Alliance (OHA) was formed in November 2007. The OHA is the group
that is in charge of Android smartphones operating system. It was created by Google. The
OHA is business alliance that consists of 47 companies for developing open standard
platform for mobile devices. Now the firms had increased from 80 to 84. The members of
OHA include handset manufactures, chip makers, commercialization companies, software
companies and mobile operators.

7. Define Emulator.

ANS

Emulator:

The Android Emulator simulates Android devices on your computer so that you can test
your application on a variety of devices and Android API levels without needing to have
each physical device. The emulator provides almost all of the capabilities of a real Android
device. It lets you prototype, develop and test Android applications without using a physical
device.

8. What is ADT? Explain ADT plugin in details.

ANS Android Development Tools (ADT) is a plug in for the Android studio that is designed
to give you a powerful integrated environment to build Android applications.

ADT extends the capabilities of Android studio to let you quickly set up new Android
projects, create an application UI, add components based on the Android framework API,
debug your application using the Android SDK tools and even export signed (or unsigned)
APK’s in order to distribute your application. Developing in android studio with ADT is
highly recommended and is the fastest way to get started with the guided project setup, it
provides, as well as tools integration, custom XML editors and debug output pane, ADT gives
you an incredible boost in developing Android applications.

CO-IF dept PT-1 Question Bank 21-22 by Poonam V Page 4


9. List the different attributes of linear layout.

Sr.No Attribute & Description

android:id
1
This is the ID which uniquely identifies the layout.

android:baselineAligned

2 This must be a boolean value, either "true" or "false" and prevents the layout from
aligning its children's baselines.

android:baselineAlignedChildIndex

3 When a linear layout is part of another layout that is baseline aligned, it can specify
which of its children to baseline align.

android:divider

4 This is drawable to use as a vertical divider between buttons. You use a color value, in
the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".

android:gravity

This specifies how an object should position its content, on both the X and Y axes.
5
Possible values are top, bottom, left, right, center, center_vertical, center_horizontal
etc.

android:orientation

6 This specifies the direction of arrangement and you will use "horizontal" for a row,
"vertical" for a column. The default is horizontal.

android:weightSum
7
Sum up of child weight

CO-IF dept PT-1 Question Bank 21-22 by Poonam V Page 5


10. Explain attributes wrap_content and match_parent w.r.t viewgroups.

ANS: These three are called as Layout Parameters. They are used by sub-views to tell the
parent view how they want to be laid on the Activity screen i.e we can set the Horizontal
and Vertical size of a view using Layout Parameters.

match_parent: When you set layout width and height as match_parent, it will occupy
the complete area that the parent view has, i.e. it will be as big as the parent.
Note : If parent is applied a padding then that space would not be included.

wrap_content: If you set layout width or height as wrap_content it will use space big
enough for its contents to get enclosed.

11. What is Toast in Android?

ANS: An Android Toast is a small message displayed on the screen, similar to a tool tip or other
similar popup notification. A Toast is displayed on top of the main content of an activity, and
only remains visible for a short time period.

12. Define ems

ANS: android:ems or setEms(n) sets the width of a TextView to fit a text of ‘N’ letters regardless
of the actual text extension and text size.

13. What is AVD?

An Android Virtual Device (AVD) is an emulator configuration that allows developers to test the
application by simulating the real device capabilities. We can configure the AVD by specifying
the hardware and software options. AVD manager enables an easy way of creating and
managing the AVD with its graphical interface. We can create as many AVDs as we need, based
on the types of device we want to test for.

CO-IF dept PT-1 Question Bank 21-22 by Poonam V Page 6


14. Draw the hierarchical directory structure in detail.

ANS:

15. List folders from directory structure of Android project and elaborate any
2 in short.

Folders from directory structure:

1)app: The App folder contains three subfolders (manifests, java and res) that make
up our application. They are divided so that it should be fairly easy to determine
which resources go in which folder.

CO-IF dept PT-1 Question Bank 21-22 by Poonam V Page 7


2)Manifest: This is where we would put our manifest files. Most Android apps have
single manifest file. But an app may have several manifest files due to application
versioning, or for supporting specific hardware.

3)Java: This is the folder in our project where we will be storing all of the source
code files written in Java programming language.

4)res: It contains folders that help us to separate and sort the resources of our
application. Resources basically mean all the needed files except the source code.

5)drawable: The drawable folder contains graphics that can be drawn to the screen.

6)layout: The layout folder contains XML files used for your layouts. These file are
used to set up the layout for your Activity and is used for basic alignment of your
layouts, components, widgets, and similar resources that are used for the UI of your
application.

7)mipmap : The mipmap folder contains the launcher icon files for the app. A
launcher icon is a graphic that represents your app to users.

8)values: The values folder contains XML files that contain simple values, such as
strings, integers, and colors. The values folder is used to keep track of the values we
will be using in our application.

16. Explain the following activity files.


Main activity file
Manifest file
String file
Layout file

The Main Activity File

activity_main refers to the activity_main. xml file located in the res/layout folder. The
onCreate() method is one of many methods that are figured when an activity is loaded.

The AndroidManifest.xml file contains information of your package, including components of


the application such as activities, services, broadcast receivers, content providers etc. Every
project in Android includes a manifest file, which is AndroidManifest. xml, stored in the root

CO-IF dept PT-1 Question Bank 21-22 by Poonam V Page 8


directory of its project hierarchy. The manifest file is an important part of our app because it
defines the structure and metadata of our application, its components, and its requirements.

A string resource provides text strings for your application with optional text styling and
formatting.

In Android, an XML-based layout is a file that defines the different widgets to be used in the UI
and the relations between those widgets and their containers. Android treats the layout files as
resources. Hence the layouts are kept in the folder res layout.

4 Marks Questions

1. Explain Android architecture in detail with neat diagram.

CO-IF dept PT-1 Question Bank 21-22 by Poonam V Page 9


1) Linux kernel

It is the heart of android architecture that exists at the root of android


architecture. Linux kernel is responsible for device drivers, power
management, memory management, device management and resource
access.

2) Native Libraries

On the top of linux kernel, there are Native libraries such as WebKit,
OpenGL, FreeType, SQLite, Media, C runtime library (libc) etc.

The WebKit library is responsible for browser support, SQLite is for database,
FreeType for font support, Media for playing and recording audio and video
formats.

3) Android Runtime

In android runtime, there are core libraries and DVM (Dalvik Virtual
Machine) which is responsible to run android application. DVM is like
JVM but it is optimized for mobile devices. It consumes less memory and
provides fast performance.

4) Android Framework

On the top of Native libraries and android runtime, there is android


framework. Android framework includes Android API's such as UI (User
Interface), telephony, resources, locations, Content Providers (data) and
package managers. It provides a lot of classes and interfaces for android
application development.

5) Applications

On the top of android framework, there are applications. All applications such
as home, contact, settings, games, browsers are using android framework that
uses android runtime and libraries. Android runtime and native libraries are
using linux kernal.

2. Differentiate between JVM and DVM.

CO-IF dept PT-1 Question Bank 21-22 by Poonam V Page 10


DVM (Dalvik Virtual
Sr. no. Machine) JVM (Java Virtual Machine)

It is Register based which is


1 designed to run on low memory. It is Stack based.

DVM uses its own byte code and

2 runs the “.Dex” file. From JVM uses java byte code and runs “.class”file
Android 2.2 SDK Dalvik has gota having JIT (Just In Time).
Just in Time compiler

DVM has been designed so that a


device can run multiple instances

3 of the VM efficiently. Applications A single instance of JVM is shared with


multiple applications.
are given their owninstance.

DVM supports the Android


4 operating system only. JVM supports multiple operating systems.

For DVM very few Re-tools are


5 available For JVM many Re-tools are available.

There is a constant pool for


6 every application. It has a constant pool for every class.

7 Here the executable is APK. Here the executable is JAR.

CO-IF dept PT-1 Question Bank 21-22 by Poonam V Page 11


3. Explain Android Ecosystem.

4. What is TextView and EditText? Explain Text View attributes.

In android, TextView is a user interface control which is used to set and display the text to
the user based on our requirements. The TextView control will act as like label control and it
won’t allow users to edit the text.

In android, EditText is a user interface control which is used to allow the user to enter or
modify the text. While using EditText control in our android applications, we need to specify
the type of data the text field can accept using inputType attribute.

CO-IF dept PT-1 Question Bank 21-22 by Poonam V Page 12


For example, if it accept plain text, then we need to specify the inputType as “text”. In case
if EditText field is for password, then we need to specify the inputType as “textPassword”.

In android, EditText control is an extended version of TextView control with an additional


features and it is used to allow users to enter input values.
Attribute Description

android: id It is used to uniquely identify the control

android:autoLink It will automatically found and convert urls and email addresses as a
clickable links.

android: ems It is used to make the textview be exactly this many ems wide.

android:hint It is used to display the hint text when text is empty

android:width It makes the TextView be exactly this many pixels wide.

android:height It makes the TextView be exactly this many pixels tall.

android:text It is used to display the text.

android:textColor It is used to change the color of text.

android:gravity It is used to specify how to align the text by the view's x and y axis.

android:maxWidth It is used to make the TextView be at most this many pixels wide.

android:minWidth It is used to make the TextView be at least this many pixels wide.

android:textSize It is used to specify the size of text.

android:textStyle It is used to change the style (bold, italic, bolditalic) of text.

android:textAllCaps It is used to present the text in all CAPS

android:typeface It is used to specify the Typeface (normal, sans, serif, monospace) for
the text.

android:textColor It is used to change the color of text.

CO-IF dept PT-1 Question Bank 21-22 by Poonam V Page 13


android:textColorHighlight It is used to change the color of text selection highlight.

android:textColorLink It is used to change the text color of links.

android:inputType It is used to specify the type of text being placed in a text fields.

android:fontFamily It is used to specify the fontFamily for the text.

android:editable If we set, it specifies that this TextView has an input method.

5. Explain any 4 UI components of Android application with syntax.

TextView
In android, TextView is a user interface control which is used to set and display
the text to the user based on our requirements. The TextView control will act as
like label control and it won’t allow users to edit the text.

<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:text="Welcome to Thakur Polytechnic"
android:textColor="#86AD33"
android:textSize="20dp"
android:textStyle="bold" />

EditText

In android, EditText is a user interface control which is used to allow the user to
enter or modify the text. While using EditText control in our android
applications, we need to specify the type of data the text field can accept
using inputType attribute.

<EditText
android:id="@+id/txtSub"
android:layout_width="match_parent"

CO-IF dept PT-1 Question Bank 21-22 by Poonam V Page 14


android:layout_height="wrap_content"
android:hint="Subject"
android:inputType="text"/>

Similarly write any 4 components.

6. Explain the steps to install and configure Android studio and SDK
Step 1) Download Android Studio
You can download Android Studio from developer.android.com homepage
and search for downloads. Choose appropriate platform either for
windows, mac or linux
Step 2) Run .exe file
1. Now the next step is to launch .exe file you just download.

2. Click next and select Android SDK checked if you don’t have it
already. Make sure Android virtual device is also checked.

3. Next step is to accept license and agreement. Click on I Agree

4. Next step is to set location of installation. Please make sure your disk
has minimum required space before clicking on Next. For Android
Studio installation location must have at least 500MB free space. For
Android SDK installation, selected location must have at least 3.25GB
free space.

5. Next step is to choose the start menu folder, where you want to create
shortcut. If
you don’t want to create a shortcut just mark Do not create shortcut.

6. And hit Install button.


7. It will start installation. Once it’s done, Click Finish. Make sure
Start Android Studio is checked.

CO-IF dept PT-1 Question Bank 21-22 by Poonam V Page 15


Step 3) Configure Android Studio
1. When you run it for the first time it will ask for Android Studio settings.

2. If you don’t have any previous settings click on the second option
(I don’t have a previous version of Studio or I don’t want to
import my settings).

3. Select a theme and click next.

4. At the very first run it needs to download some necessary


components, wait till it completes.

5. And it’s all done.

6. Click on Finish and start building your Android apps.


OR

 Download the latest version of Android Studio from above URL and launch
Android Studio.exe file by double clicking on it.
 The initial android studio setup screen will open in that click Next to continue for
further steps of environment setup
 Now we need to select a required components to setup an android environment.
Here we selected all three components (Android Studio, Android SDK and
Android Virtual Device) and click Next.
 Now we need to agree the License agreements to proceed further, click on I
Agree button
 Now we need to specify the local machine drive location to install Android Studio
and Android SDK.  After selecting the location path to install required
components, click Next.
 Now select the start menu folder to create a shortcut for android studio and click
Install

CO-IF dept PT-1 Question Bank 21-22 by Poonam V Page 16


 Once we click Install button the installation process will start and click Next after
completion of Installation
 After that it will show installation completion wizard in that click Finish to
launch android studio While launching Android Studio it will give you an option
to import settings from previous version of studio. In case if you don’t have any
previous version, select second option and click OK
 Now android studio will open a welcome wizard window in that click Next to
validate our current Android SDK and development environment setup
 Now select a Standard installation type and click Next to install a common
settings and options
 Now verify settings and click Finish to complete android studio setup process
 After completion of required components installation click on Finish
 After completion of all required components installation, we will be able to see
Android Studio welcome window

7. State syntax to create Text View and Image button with any two attributes
of each.

ANS:

Text View:

Syntax :

<TextView

android:id="@+id/textView1"

android:layout_width="<width value>”

android:layout_height="<height_value>"

android:text="<text to be displayed>"/>

Attributes/Properties of TextView:

● id: Supply an identifier name of this view, to later retrieve it with

View.findViewByID() or Activity.findViewById()

CO-IF dept PT-1 Question Bank 21-22 by Poonam V Page 17


● alpha: alpha property of the view as a value between 0 (entirely transparent) and
1(Completely Opaque). [flag]

● auto link: Controls whether links such as urls and email addresses are automatically
found and converted to clickable links.[flag]

● gravity: The gravity attribute is an optional attribute which is used to control the
alignment of the text like left, right, center, top, bottom, center_vertical,
center_horizontal etc

● text: text attribute is used to set the text in a text view. We can set the text in xml as
well as in the java class.

● textColor: textColor attribute is used to set the text color of a text view. Color value is
in the form of “#argb”, “#rgb”, “#rrggbb”, or “#aarrggbb”.

● textSize: textSize attribute is used to set the size of text of a text view. We can set the
text size in sp(scale independent pixel) or dp(density pixel).

● textStyle: textStyle attribute is used to set the text style of a text view. The possible
text styles are bold, italic and normal. If we need to use two or more styles for a text
view then “|” operator is used for that.

● background: background attribute is used to set the background of a text view. We


can set a color or a drawable in the background of a text view.

● padding: padding attribute is used to set the padding from left, right, top or bottom.

ImageButton:

Syntax :

<ImageButton

android:id="@+id/imageButton"

android:layout_width="<width value>"

android:layout_height="<height value>"

app:srcCompat="<image source from drawable folder "/>

CO-IF dept PT-1 Question Bank 21-22 by Poonam V Page 18


Attributes/Properties of ImageButton:

● id: id is an attribute used to uniquely identify a image button. Below is the example
code in which we set the id of a image button.

● src: src is an attribute used to set a source file of image or you can say image in your
image button to make your layout look attractive.

● background: background attribute is used to set the background of an image button.


We can set a color or a drawable in the background of a Button.

● padding: padding attribute is used to set the padding from left, right, top or bottom of
the ImageButton.

Note: All the programs from Experiment 4 to 6 are part of Question Bank.

CO-IF dept PT-1 Question Bank 21-22 by Poonam V Page 19

You might also like