Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
227 views
18 pages
MAD Question Paper
MAD questions
Uploaded by
zain.shariff.redmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save MAD Question Paper For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
227 views
18 pages
MAD Question Paper
MAD questions
Uploaded by
zain.shariff.redmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save MAD Question Paper For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save MAD Question Paper For Later
You are on page 1
/ 18
Search
Fullscreen
Mavgh / April 2023 PG Examinations usN [_] 20MCA32 RV COLLEGE OF ENGINEERING” (An Attonomios Institution affiiated to VEU Belngav TIL Semester-Master of Computer Applications MODERN APPLICATION DEVELOPMENT Time: 03 Hours ‘Maximum Marks: 100 Instructions to candidates: 1. Each unit consists of two questions of 20 marks cach. 2. Answer FIVE full questions selecting one from each unit. UNIT-1 a With a neat diagram explain Android system platform architecture and its layers. b | List and explain the key building blocks of an Android application. c Write about the Android studio /DE used for developing android based mobile apps with illustrations. OR a With a neat diagram explain logical representation of an android app. b List and explain the activity lifecycle in Android application. c Write about the different layout used in developing android based mobile apps with illustratior 08 UNIT-2 a Explain the different types of intents in the android activity. 08 b With an example explain the event registration and handling process in android app. 04 c Device a program to demonstrate the passing of values between the activities in which one activity accepts the name and address and another activity displays the same. 08 OR a Explain the common listener objects used in android based event handling process. 08 b With an example explain the activity class in android app. 04 c Demonstrate fragment in android program for replacing one fragment with another fragment in a single activity. 08 UNIT-3 a Explain the most common errors which occur during debugging in android programming. 05 b Infer the steps for creating and monitoring Geo fencing in android application. 05: c | Devise a program to receive the latitude and longitude coordinates of a mobile device with proper process of permissions and capture the details. 10 ORExplain the implementation of U/ threads in android application, 6 a + 1 . b List and explain the types of testing used in android app 05 5 development. ¢ | Design an android app to accept the name as ; “V7U" and message 4% ©" RV COLLEGE OF ENGINEERING” to store in SQLite data hase with it) steps. — ~ — — UNIT-4 7a | With a neat diagram explain the service worker life eyele methods and | working. 5 b _| List and explain the different audits available in lighthouse, 0s c Design and develop a program for inventory web site with the following: i) Manifest file(with at least 10 attributes) ii) Index page with proper imports and html tags. 10 b oR 8 a ___| With a neat diagram explain the service worker architecture. 0s b | Differentiate an android based mobile app with a progressive web application. 0s c | Design and develop a program with proper code in service worker lifecycle methods to cache files and fetch during the time of offline, (files to be cached are-'pirates.htm?’, ‘/styles/j css’, ‘/styles/ pirates.ti?, ‘/images/i-love-pirates. jpg’, ‘pit 12.png’) 10 UNIT-5 9 a Illustrate with an example the architecture of caching the App shell in progressive wed app. 06 b __| Draw and explain the push notification architecture to show the steps performed. 06 @ c |Demonstrate web notifications for displaying the “welcome message” during the time of page load following to be demonstrated: i) Permission for web notification ii) Enable notification when service worker installs, 08 oR 10 a Illustrates the steps to convert the normal web app to a PWA app long with manifest. 06 b | Explain the measuring app shell performance with an example. 06 c Demonstrate push notification for displaying the “news update”: Following to be shown: i) Permission for push notification, ii) __ Sync of key and send push notification. 08tro) SCHEME AND SOLUTION Vrogramme: MCA Course Code with Title: 20MCA32-MODERN APPLICATION DILVISLOPMENT. Q. Marks UNIT- ‘heat diogiam explain Andron form Architecture and i) i pinata | seer Cao presi [_ Cea) Geer) Greet I = : eralical explanation sh contain with the below points ‘An O8 does threo things: + Manages hardware on behalf of applications. « Provides services to ‘applications like networking, security, memory management, and so forth. « applications, time, bb | List and expinin the Key building blocks of an Andrord Applications foln: Manages execution of this is the part that allows us to run multiple applications (seemingly) almost at the same Activity: An Activity is where we put together things thatthe user can see. t's a focused thing ‘hat a user can do, Yor example, an Activity can be made to a user ean view a single email ot maybe fll ‘up a form, In Figure 5-1, inside the Activity, thers are Views and Fragments. Views are classes that draw ‘content to the screen; some examples of View object are Buttons and TextViews. A Fragment is similar {oan Activity in a way that it's alzo.a composition unit but a smaller one. Like Activities, they also hold View objects, . Services, With Services, we can run program logic behind the ecenes, without freezing the user interface. Services run inthe background; they can be very useful when your app is supposed to dawnload a fle u fiom the Web or maybe play musi. BrondeastHecelvers: With BroadcastReceivers, out app can listen to messages from other spplications or from the Android Runtime itself sample usecase for this might be if you want to display a warming b message when the battery dips to below 10%, ContentProviders: lets you write apps that can share data to other apps without exposing the 1 Lunderbellies of your apps? SQL structure. I manages access to some sort of central data repository. The details of database access are completely hidden from other app. An example ofa prebuilt application that in ContenProvide i the “Contacts” app in Android. ©, | Waite about the Android Studio IDE used Yor developing Android based mobile appa with Uartations soln: ‘ 1) Main menu bar, You can navigate Android Studio in various ways. Often, there's more thea one ‘way t0 doa tas, but the primary navigation is dane inthe main menu bar. I'you're on Linx or ‘Windows, the main menu bar sits directly atthe top of the IDE; if you're on macOS, the main ‘menu bari disconnected from the IDE (whichis how all macOS software works), 2). Navigation bar, This bar lets you navigate the project files. I's a horizontally arranged collection ‘of chevtons that resembles some sort of breadcrumb navigation, You can open your project files cither through the navigation bar ofthe Project tool window.Toolbar. This lets you do a wide range of actions (e.g, save files, run the app, open the AVD ‘manager, open the SDK manager, undo, redo actions, etc ‘Main editor window. This is the most prominent window and has the most screen real estate. ‘The editor window is where you can create and modify project files. It changes its appearance ‘depending on what you are editing. Ifyou're working on a program source fie, this window will show just the source files. When you are editing layout files, you may see either the raw XML file ora visual rendering ofthe layout. '5)_ Project too! window. This window shows the contents ofthe project folders; you'll be abe to see ‘and Launch all your project assets (source code, XML files, graphics, etc.) from here, 6). Tool window bar. The too! window ber runs along the perimeter of the IDE window. It contains the individual buttons you need to activate specific tool windows, for example, TODO, Logeat, Project window, Connected Devices, and so on. * Show/hide tool window. It shows (or hides) the tool window bar. I's a toggle. Tool window. You will find tool windows on the side bottom of Android Studio workspace. ‘They're secondary windows that let you lock at the project from different perspectives. They also let you access the typical tools you need for development tasks, for example, debugging, integration with version control, looking atthe build logs, inspecting Logeat dumps, looking at ‘TODO items, and so on. Here are a couple of things you can do with the tool windows: ‘a. + You can expand or collapse them by clicking the tool's name in the tool window bar. ‘You can also drag, pin, unpin, attach, and detach the tool windows. b. + Youcan rearrange the tool windows, but if you feel you need to restore the tool ‘window to the default layout, you can do so from the main menu bar, click Window > Restore Default Layout. Also, if you want to customize the “Default Layout,” you rearrange the windows to your liking; then, from the main menu bar, click Window > Store Current Layout as Default. ‘OR 2a. With a neat diagram explain Logical representation of an Android app soln: Explanation: __ Activities, _ Services, 44327 ®for exampl Intent intent = new Intent; intent setAction(Intent ACTION_VIEW); intent.setData(Uri parse("https://apress.com")); startActivity(intent); ‘With an example explain the event registration and handling process in android app soln: Registering a listener means you tell the Android framework which method to call when the user interacts with the View object. Figure 7-2 shows an annotated code for registering a listener objec. Sgoverriae: Public vedd onClick(View view) ¢ i ‘System owesprinetn( Heuer) i jow View onctickListener OC Figure 7-2. Annotated event registration and handling Device a program to demonstrate the passing of values between the actvit ‘accepts the name and address and another activity displays the same. Sol: for example program: Design of activity and xm! file based on view: -
Vv tuning a tsk tn the background, a broadcasting at event so that interested applications enay espn ‘Mocks of an application, They ave hi it classes with very specific behavior, and ve se them by toe. Coens ve yes Fel ccs wth ey Fic Piistandeapinin the Activity Wifey in And appication 3 Peet ate pte Activity lifecycle 2 ‘When the Android Runtime launches the app it calls the onCreateQ) method of the é rain Activity which brings the state of the Activity to “created,” You ean use this method to perform iniaiztion routines like preparing event hanling coves anil $0 00. ‘The Activity proceeds to the next state Which is "states the Act but is not yet ready for ineraction, The next state is “resume interacting with the user Ifthe wser clicks anything tht takes the focus away from the Activ (answering a phone call o launching anther app) the runtime pauses the eurent Activity and itenters the “paused” state. From there, ithe user goes back to the Activity, the oaResunie( function is called, and the Activity runs again. On the other hand if the user deciles to open a different app Android Runtime may “Stop” and eventually “estoy” the application. © | Arte about the different Inyout used in developing Android based mobile apps with ilustations| soln: Explanation should contain: Layouts: There are mumber of Layouts provided by Androit which you will use in almost all the u Android applications to provide different view, look an fee 1) LinearLayout isa view group that aligns al chiren in a single direction, vertically or horizontal. . 2) Relative Layout: RelativeLayout i a view group that displays child views in relative po i 3) Table Layout: TableLayout isa view hat groups views into rows and columns, 4) Absolute Layout: AbsoluteLayout enables you to specify the exact location ofits children, = 5) Frame Layout: The FrameLayout isa placcholder on screen that you ean use to display a single 6) List Vie view group that displays alist of srolable items. 1) Grid View: GridView is 0 ViewGroup that displays items in a two-dimensional, scrollable grid. UNE Soa, | Explain the different iypes af ntens are Ta the android activity To launch an Activity, we need to create an Intent object, tel this Intent object what we want to astivate, and then launch it After that the Android Runtime tries to resolve the Inte, and ifsuecessl the target | component gets activated, In code it looks lke this: Intent intent = new Intent(content, target; startActivityinten)s where scontext—Is a reference tothe component that wants to initiate oF lunch the Intent. stags a class object thsi the component you want to launch, Implicit Intent: ‘The purpose of implicit Intent is for you to use a functionality that doesn’t exist within your app, besause | 4 the feature exists within your app, you would have used explicit Intent inthe fist pees Using an implicit Intent is a way to ask the Android Runtime to find an application somewhere onthe device that can service your request. In an explicit Intent, we tll he Intent which specific component to activate In an implicit Intent, we tll the Intent what we'd like todo instead,won asn ann p fa, ‘androids constraintlayout.widget,ConsteaintLayout™ Activity program: Mandroid file with imports ‘button setOnClickListener(new View.OnClickListener() ( @ Override public void onClick(View view) ( Antent intent=now Intent(Intent.ACTION_VIEW, * intent putlxtra(*name",name); intent putlxtra(*address" address); startActivity(intent); y_2.class);, 1 adroid file with imports and two ui elements to displaying. Intent intent = getIntent0; ‘String name = intent getStringExtra(*name"); String address = intent.getStringExtra(‘address");, Use the string to the activity view components for textview in another android xml file. 342 10 ‘OR ta Explain the common listener objects used in android based event handling process Wimecliauineee wit) dageveasiwernean abe ‘tnweneravpion ean enone be NEY Minnonungdletistene elencte)—dnatneeme madi eto om Wimofemnonngtistenr enachogt)_senimaneete neat Wimcoraanistner —extmn() iene an, mecineer mao (Shean ueopbotane With an example explain the Activity class in android app soln: ‘An Activity class must inherit from android app. Activity, either direetly or indirectly, but we usually don't inherit from this class dcectly; instead, we extend the AppCompatActivity class to run the app on older versions of Android but still use ‘modern UI elements. Listing 6-2. MainActivity java import androids.appcompat.app.AppCompatActivity; import android.os.Bundle; class MainActivity extends AppCompatActivity { de @Override— protected void onCreate(Bundle savedlnstanceState) { super.onCreate(savedinstanceState); setContentView(R layout activity. main); @ } ) ‘We inherit from AppCompatActivity, which is a child class of android app. Activity class. All Activity classes must inherit from android app.Activity one way or another, but as you can see, the project creation wizard gave us AppCompatActivity. This is the recommended superclass for an Activity ‘The @Override annotation tells the compiler that we intend to override the method immediatelyv, Logie error ‘peofencel.ist.add(new Geofence..uilder() 4) Geo fence triggers: private GcofencingRequest getGeofencingRequest) { Tafa ie anor sods ofthe Activity class, The Android Meuntime calls aCyente() tw ane of the Iifecyele met ol Rumtine cal Fedde he user auch The op ‘This is # good place to write initializat cues Wo call the on “The setContentView method selects Deemonsirato fragment In Ai wctivity tol is the xml and Java fies oo tobe written with tho xm and 3 stp yea mn java ie for a figment witha viewgroup of Hinear layout and a text view f frogment 1 Hep wale file of xl and java witha view group of finer Iayout and a text view of fragment 2 ‘epi waite w Java file forthe fragment interchange: ‘eximple ent FragmentTransaction fl=fm,beginTransaction(), Aad. f1 new feaglO): ‘Toast.makeText(this, "Fragment is addedtt!11", Toast.LENGTH_SHORT) show); Aad ToBbackstaek(nul}); Aeon 1 perce (AppCompatactvi). / at) net in ret apy when the tivity becomes visible to ‘a single cat with another fragment UNIT Tipline moat common ervors occur during debugging in android program sol: ‘Tho three most common ertors you'l face in programming are sSiyniax errons: are exactly what you think they ar, errors inthe syntax. It happens beceuse you wrote fomething in the code that’s not allowed in the set of rules of the Java compiler. Runtime errors: Runtime error happens when your code hits a situation it docsn't expect. As the name Implies, this error happens only when your program is running. It's not omething you'll see during compilation, Java has two types of Exception, checked and unchecked Logic errors ae te hardest wo find. As its name suggests, it’s an eror on your logic. fer the ep for renting a monitoring Go fing in ended piston soln: Permission; application andold:allowBackup="truc"> “recelver androld:name=".GeofenceBroadcastPecciver"/>
2) Location services: ‘geofencingClient = LocationServi '3) Geo fence objects creations: +, getGeofencingClientthis); i/Set the request ID of the geofence. This isa string to identify this M geofence, -seiRequestld(entrygetKey()) .setCircularRegion( centry.getValue() atitude, centry.getValue()Jongitude, Constants, GEOPENCE_RADIUS_IN_METERS ) ‘setExpirationDuration( Constants. GEOFENCE_EXPIRATION_IN_MILLISECONDS) “setTransition Types(Geofence. GEOPENCE_TRANSITION_ENTER | ‘Gcofence, GEOFENCE_ TRANSITION EXIT) build GeofencingRequest. Builder builder = new GeofencingRequest Builder); builder.setInitial Trigger(GcofencingRequest.INITIAL_TRIGGER_ENTER); builderaddGeofences(geofencel ist), — ~ return builderbuild(; 15 =8) Add Geoences: geofencingClient.addGeofences{getGeofencingRequest(, getGeofeneePendinglatent()) -addOnSuccessListenen(this, new OnSuccessListener
4) { Override public void onSuccess{ Void aVoid) Ui Geotences adie Wow , » -AddOnFaitureListener(this, new OnFaitureListener() { Override public void onFaiture(@NonNull Bxception ¢) { Failed to add geofences u with explanation, Devise a program to receive the latitude and longitude coontinates of a mobile device with proper process of permissions and capturing the details. Soln: ‘example code samples: xml layout is detined below: .0* encoding="uth-8"?> -
‘
2) The MainActivity java class is defined below. package com journaldev.gpslocationtracking; Tixaports * import static android. Manifest permission. ACCESS_COARSE_LOCATION; ‘impor static android. Manifest permission.ACCESS_FINE_LOCATION; public class MainActivity extends AppCompatActivity { private ArrayList permissionsToRequest; private ArrayList permissionsRejected = new ArrayList; private ArrayList permissions = new ArrayListQ; private final static int ALL, PERMISSIONS_RESULT = 101; LocationTrack locationTrad @Override protected void onCreate(Bundle savedlnstanceState) { superonCreate(savedinstanceState) setContentView(R.layout.activity_ main); per .add(ACCESS_FINB_LOCATION); permissions.add(ACCESS COARSE LOCATION):: escent aeofenves(geCeofeoingeqen, gtCeeteyeetentigTneu) even ier SuecessListenorthis, now Onsicesstistoner= VKl"() [ Override Pris vit onSuccess(Vol aD [ D ssonmdiareListener(his, new OntaitaoListone” ( public voi onFaiture(@NowNull ixception 0) { add goofences with explanation, Devise a progeam to recep the latinule and longitinle coordinates. af a mobile leviow with proper process of permissions andl caring the details Soln: example code samples: ‘The actvity_main.xml layout is dined below, -
“
<
4) Forgetting the last known location, we could use GoogleServices API itself. 3 googleApiClient = new GoogleApiClient Buider(this) “addApi(LocationServices.API) ‘addConnectionCallbacks(this) saddOnConnectionFailedListener(this) build) =10 | OR 6a. | Explain the implementating UI threads in android application development soln: ‘The UI thread, also known as the main thread, is responsible for launching the main A activity and inflating the (XML) layout file. Inflating the layout file means turing all the View elements into actual Java objects, for example, Butons, TextViews, and so on. In shor, the main thread is responsible for displaying the Ul. Example code snippet for showing the run on ui threads: unOaUiThread(new Thread( { & 5 public void runQ) { Log.d(TAG, "runOnUiThread"); ‘tetUserInfo.setText(jsonreader. toString! ) vi: ‘| Listand explain the types of testing used in android app development Is5=5 ENGINEERING" to store in SQLite data base with its step.Sol: ‘step 1: ereate a xml and java file of containing a ‘same and message as text view andl elt text and 2: utton to store the values into the database a ‘ep 2: create an sqlite helper class for erenting database and wtoring a ‘example code: SQLiteDatabase sald, public DBUnndler(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase,CursorFactory factory, int version) ( super(contert, name, fuetory, version @Override ‘public void onCreate(SQLiteDatabnse sqLiteDatnbase) ( sqld*sqLiteDatabase; sqLiteDatabase.exeeSQL("ereate table myilatabase(id number primary key," + “name text,message text)" } @Override public void onUpgrade(SQLiteDatabase sqLiteDatabase, inti, int il) ( sqLiteDatabase.cxeeSQL«("drop table if exists login"); ) public void insert(String username, String password){ ContentValucs ev = new ContentValues() evpui(*name", name); ev.put(*message” message), long |= this.getWritableDatabase(.insert("mytable"nll,ev; Log.d{"inserted into the table","™1; ) 2 step 3: call the sqlite helper class in the activity for storing and retriving the information =10 “mydata" null, 1); sdb.insert('VTU","message"); sdb display; UNIT-V, Ta, | with aneat diagram explain the service worker life eyele methods and working. Sol: 3 Register the Service Worker The first thing you do to create your first service worker is register it. This will download your service worker script. Registration and downloading + stallation + Waiting (sometimes) + Activation i L 2 1 — =5 [oa ‘and explain the different audits available in Lighthousea, % ia ak EM tern ae ae Fo gee UU Ay DI a ae tat yew oan TON en ww ae vase att tha the al yp ateyeboper AUTRE, PFOA Apes eva gate the Glog ag TE ostentatious, A CONVO thes cava 0a toyota AAT a TY ye aglow nab tants, Aes websles hae content and see ane teva opus wh AEG the range of typloat Users, _ mM Ne ong tt tha feet Ma he Dest ination goerally aoeeptet Un wet kesigy ayo WHAT AACS BAHAY US ‘Vee Lighthouse ait ies 0 ie Lanka Geotovaton permissions Wheader oe ota er aH PUsTE [ESPON Troupe aspect ation at otras ae the aerate cose tatlon Dati hast Mt hSTYNS Apatsation gashes avascrig ibaties ‘Taouse of deprevatel AUT Drotonta! fonts J Pesignant devetay a prngea te inventory Wed site with he Fatonwings 1 manitest file vith at east 10 tbat) index page with pooper inyponts aA NHL LABS Aug sot example oats ‘mnamttest Mer 4 Same’ May_fist manifest’, short name st manlfese, § tart ts tit, Naisplay"s tlscreen, “Rech clr ATM lesciption"s "A sinapte applicationtoe manifestation’, “Scan pte aN eheme, cole’ ROSE, const [ Sere Moonee JOEANNE, Se syne Timageypag™ m Tadex page nithe x bt tanger" seta charset UTES | sretahergui"NUA.Compae contented meta namne="wiew pot” content= Wwidh=stevioevidh,iitiabscae=1 0" Sopa sidthraevigeowithiitalscale=L.0"> “link rel="manifet®href=Minaniest json . stead
SEE essere Username:
inside the tml page with manifest . Sboly> ttm =10ta. OR ‘With aneat diagram explain the service worker architeture sol 2®@ ; a — @ tec explanation should contain the points - A service worker Is 2 4 script that runs in the background of your web application, It doesn’t necd the DOM and in fact doesn’t even have access to the DOM. Service workers run in a separate thread from the Ul, so they 5 don't block o feze the UI while they proces The whole point of sevice works tha itl at intermediary between your app and the Internet. It then performs whatever function you've set it up to perform and finaly communtats some sl bac o Your ap by passing Mensa, b | Listand explain the advantages of using progressive web application over native app Sol: solton should contin the flowing points 4 Blldng «progressive web appl cheaper than developing a anivo opp I5=5 progressive web apis iter to build and update + PWA bypases the cumbersome App Store requirements. All the asers need is web browser anda URL Unlike Native apps, PWA works like any website so it canbe indexed in search engines 4 Aa assets naa wens Beene they ae tn under TTS Design and develop «progam with proper code service wotkerliteyele methods cache files and fetch during the time of offline. (ies to, be. cached are ~ ‘pirates, ‘stylesiprateses,Ytylefpratesat, Mimogest love pirates pe ‘piatescariblan2.pog) be txample olution Stop {manifest le needed example code manifest Mer 3 show mame stat "background _color" "desert "A simple aplcationfor manifestation’ "orientation" "portal-pinary, theme, color P219629", Neon { ‘ar "iconsivee_logo.p", index page with ‘shtml lang="en"> Shend> “nea chase"UTE-S°>
Document 3