You are on page 1of 4

National Textile University, Faisalabad

Mid Exam: Fall-2017 (Objective)


Name: ___________________________________ Registration No.: ____________
Course Title: Mobile Application Development Course Code: CSE-407
Class: BSCS Semester: 7th
Date: 23/11/2017 Marks: 12
Time: 25 Minutes Department: Computer Science

NOTE: • This part of the paper is to be solved on the question paper


• Cutting and overwriting will not be rewarded.

Question # 01. Tick/Encircle most appropriate option given against each statement 12 Points

SECTION - I
I. Which android system component exposes hardware capabilities to programmers
A. HAL B. Android Runtime C. Linux Kernel D. Java API
II. ___________ management is not supported by JAVA API
A. Notification B. Activity C. Activity Lifecycle D. Content providers
III. Each app runs in its own process with its own instance of the _________________
A. Java API B. C/C++ library C. Android Runtime D. Fragment
IV. ___________ is an interface to global information about an application environment
A. Context B. Java API C. Fragment D. Service
V. The base class for layouts and view containers is
A. Layout B. ViewGroup C. View D. BaseView
VI. You can use _______ and ________ HTML tags for formatting in text views
A. All HTML tags B. <b>, <i> C. All except <ul> D. <b>, <i>, <u>, <a>
VII. Which of the following is not a valid activity state?
A. Created B. Started C. Resumed D. Invisible
VIII. ________ is called after activity has been stopped, immediately before it is started again
A. onRestart() B. onStop() C. onResume() D. onCreate()
IX. _________ is a UI mode that lets you replace parts of the normal UI interactions temporarily
A. ActionMode B. Action Call back C. Action Layout D. Linear Layout

Suppose, you have a ‘aed.jpg’ image file stored in SD card. The correct way to set this image file
X. data in an intent i is
A. i.setData( B. i.Data(
Uri.fromFile(new File("/sdcard/aed.jpg"))); Uri.fromFile(new File("/sdcard/aed.jpg")));
C. i.setData( D. i.setData(
Uri(new File("/sdcard/aed.jpg"))); Uri.fromFile(new File("aed.jpg")));

XI. An activity A sends data to B in the form of Extras, How can we get the data sent by A in the B
A. Extras extras = intent.getExtras(); B. Bundle bundle = intent.getExtras();
C. Bundle bundle = intent.getExtra(); D. Extras extra = intent.getExtra();

Suppose, we want to show an option menu as shown in the given figure. To


XII. display icons on Menu bar. The correct attribute for <item> element would be

Flip the Page Page 1 of 2


A. showAsAction B. showAsIcon C. showIcon D. this.ActionShow
XIII. Suppose we have an XML menu file (cm.xml). To inflate this menu, the code would be
A. getMenuInflater.inflate(R.menu.cm.xml, menu); B. inflate(R.menu.cm, menu);
C. getMenuInflater.inflate(R.menu.cm); D. getMenuInflater.inflate(R.menu.cm, menu);
Suppose we have implemented Recycler View with data fetched from database. The class that
XIV. would contain the clickable elements to which data may be assigned to prepare one view is
A.
RecyclerView.ViewHolder B. View.Holder C. Holder.ViewHolder D. View.ViewHolder
Inside a overrided method (such as onOptionItemSelected()) the most appropriate way to get
XV. the context of app is
A. getApplicationContext B. this C. this.context() D. getAppCtx
Suppose you write an Activity that edits user’s data such as account name. This data must be
XVI. saved before the application exists. In which lifecycle method you should normally save this data?
A. onDestory() B. onPause() C. onResume() D. onStop()
Suppose, against a button click, we want to dial a phone number to call someone. This call can be
XVII. handled by some other app that we don’t know. The type of intent we will start is
A. implicit B. Explicit C. Both A & B D. Fragment
A contacts app can store and display hundreds of contacts with different contact details. The most
XVIII. recommended view to display the contacts is
A. Fragment Layout B. Recycler View C. Adaptor View D. Scroll View

Page 2 of 2
National Textile University, Faisalabad
Mid Exam: Fall-2017 (Subjective)
Name: ___________________________________ Registration No.: ____________
Course Title: Mobile Application Development Course Code: CSE-4075
Class: BSCS Semester: 7th
Date: 23/11/2017 Marks: 18
Time: 65 Minutes Department: Computer Science

NOTE: • Attempt all questions. Each question should be attempted continuously on the answer sheet.
• Attempt all the questions on answer sheet. Do not write anything on question paper other than name
and roll no.
• Use last page of your answer sheet for rough work.
• The paper is sufficiently self-explanatory, queries for sake of queries are strongly discouraged to ask.

SECTION I
Question # 02. Briefly answer the below given questions 04(2*2) Points

i. Android System is based upon a stack with 5 fundamental layers/blocks. Name each layer,
and explain the functionality of each layer. Draw figures if necessary.
ii. What is Recycler View. With the help of examples describe the situation and benefits
according to situation to use a Recycler View.

Question # 03. Write the required code accordingly 06(4*1.5) Points

a) In an App we have two activities namely ‘MainActivity’ and ‘SecondActivity’. Initially,


MainActivity is the launcher activity. Write the XML for android manifest file to set
SecondActivity as the launcher activity.
b) Write XML code for layout file to insert a disabled edit text.
c) Write the Java code to register onLongClick event listener on a button. Button id is “button”.
If a user long clicks the button, the app should exit.
d) Write Java code to overturn the behavior of back button. Upon clicking back button instead of
closing activity, it should display a toast that the back button is disable.

SECTION II

Question # 04. 04 Points


Let’s suppose, we have two activities (‘One.java’ and ‘Two.java’). ‘One.java’ is the main activity with
the layout as shown in below figure. Write the Java code to perform below given behavior.
• If user clicks on SEND PHONE NUMBER, it sends a sample contact number in the form of
URI. The activity TWO receives this contact number and returns TRUE to activity One.java
if received number start with 92, otherwise returns FALSE and exists. Upon receiving the
value from activity Two, activity One display toast to user accordingly.

Flip the Page Page 1 of 2


Question # 05. 04 Points
Suppose in an App, we have three different screen that we want to display in single activity. To
accomplish this task, format layout in the form of fragments and attach the fragments to view pager
could be considered a good option. For this, 4 fragments with names A.java, B.java, C.java and D.java
has been created. In the MainActivity, TabLayout and ViewPager are inserted (as shown in figure)
You are required to write java code to attach the fragments in the said view pager, so that a view like
given in the left figure could be achieved.

One Two Three Four TabLayout


(id:tabLayout)

Page for One


ViewPager
Desired Output (id:viewPager)

Layout of MainActivity

Wishing you lots of luck!

Page 2 of 2

You might also like