0% found this document useful (0 votes)
6 views

2015-mobile-scheme

Uploaded by

yogefe4885
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

2015-mobile-scheme

Uploaded by

yogefe4885
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

SLIATE

SLIATE
SRI LANKA INSTITUTE OF ADVANCED TECHNOLOGICAL EDUCATION
(Established in the Ministry of Higher Education, vide in Act No. 29 of 1995)

Higher National Diploma in Information Technology


Second Year, Second Semester Examination - 2015
HNDIT2417 - Mobile Application Development

Instructions for Candidates: Time: Three ( 03) hours


Answer any five (05) Questions No of pages : 06

Question 01
[Total Marks=20]
i. Mention three android versions with their code names (3 Marks)
ii. Identify the following widgets (4 Marks)

a. c.

b. d.

iii. What is the purpose of AndroidManifest.xml file? (3 Marks)


iv. What are the two orientations supported by Linear Layout (2 Marks)
v. Sketch the output of the following code (8 Marks)

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<Button
android:id="@+id/btnButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button 1"/>

<Button
android:id="@+id/btnButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button 2"
android:layout_toRightOf="@+id/btnButton1"/>

<Button
android:id="@+id/btnButton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button 3"
android:layout_below="@+id/btnButton1"/>

<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/btnButton3"
android:layout_marginTop="94dp"
android:text="User :"
android:textAppearance="?android:attr/textAppearanceLarge" />

<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/textView1"
android:layout_toRightOf="@+id/btnButton3" />

<Button
android:id="@+id/btnSubmit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/editText1"
android:text="Submit" />

</RelativeLayout>

Question 02
[Total Marks=20]
i. Define what is an Android Activity. (2 marks)

ii. The following user interface has been created with Android Studio. When the user
clicks on the submit button after entering the correct username and the password
program redirects to home page which is another activity called CompanyHome. In
the case of incorrect username or password, toast message will be displayed as
“Username or password invalid”.

HNDIT 2417 - Mobile Application Development – 2015 2nd Semester 2|P a ge


Fill in the blanks of this code in MainActivity.java (15 marks)

public class MainActivityextends Activity {


//declare variables
private ……………………………… ……………………………; (1 mark)
private ……………………………… ……………………………; (1 mark)
private ……………………………… ……………………………; (1 mark)

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

//read the text values and buttons set in XML file


………………………………=(Button)……………………………………………(R.id.btnSubmit); (1 mark)
………………………………=(EditText)…………………………………………… (R.id.txtUsername); (1 mark)
………………………………=(EditText)…………………………………………… (R.id.txtPassword); (1 mark)

………………………….setOnClickListener(new View. …………………………………………………() { (2 marks)

@Override
public void onClick(View v) {

String un=……………………… .getText().toString(); (1 mark)


String pw=……………………… .getText().toString(); (1 mark)
if (…………………………… .equals("abc")&& ………………………… .equals("123")){ (1 mark)

//redirects toCompanyHome
………………………………. in1=new Intent(getApplicationContext(),……………………………………………);
startActivity(…………………………………); (2 marks)
}else {

//show toast message


Toast. ……………………………………(v.getContext(), "…………………………………………………………………",
Toast.LENGTH_SHORT).show(); (2 marks)
}
}
});
}

iii. Explain the purpose of setOnClickListener() method mentioned in the above code?

(3 marks)

HNDIT 2417 - Mobile Application Development – 2015 2nd Semester 3|P a ge


Question 03
[Total Marks=20]
i. Briefly explain the purpose of R.java file in android project. (03 marks)

ii. What is the purpose of strings.xml file in an Android Project? (03 Marks)

iii. “Development of mobile application is difficult than developing a software to a Personal


Computer” Do you Agree/ Disagree for the above statement. Give two reasons for your
answer. (04 marks)

iv. What is the purpose of match_parent and wrap_content in following code . (04 marks)
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

v. Following table shows hardware configurations for two mobile devices. From the following
two devices, which device will you select to purchase? Briefly explain why you have selected
that device. (06 marks)

Device A Device B
NETWORK Technology GSM / HSPA / LTE GSM / HSPA
3G Network HSDPA 850 / 900 / 1900 / 2100 HSDPA 900 / 2100
4G Network LTE band 1(2100), 2(1900), 3(1800),
4(1700/2100), 5(850), 7(2600), 8(900),
17(700), 20(800)
Speed HSPA, LTE HSPA
LAUNCH Announced 2015, July 2015, March
BODY Dimensions 198.6 x 134.8 x 5.6 mm (7.82 x 5.31 x 0.22 191.8 x 107 x 8.5 mm (7.55 x 4.21
in) x 0.33 in)
Weight 265 g (Wi-Fi) / 272 g (LTE) (9.59 oz) 278 (9.81 oz)
SIM Nano-SIM Micro-SIM
DISPLAY Type Super AMOLED capacitive touchscreen, IPS LCD capacitive touchscreen,
16M colors 16M colors
Size 8.0 inches (~74.0% screen-to-body ratio) 7.0 inches (~67.2% screen-to-
body ratio)
Resolution 1536 x 2048 pixels (~320 ppi pixel density) 600 x 1024 pixels (~170 ppi pixel
density)
PLATFORM OS Android OS, v5.0.2 (Lollipop) Android OS, v4.4.2 (KitKat)
MEMORY Card slot microSD, up to 128 GB microSD, up to 32 GB
Internal 32/64 GB, 3 GB RAM 8 GB, 1 GB RAM
CAMERA Primary 8 MP, autofocus 2 MP
FEATURES Sensors Fingerprint, accelerometer, gyro, proximity, Accelerometer
compass

HNDIT 2417 - Mobile Application Development – 2015 2nd Semester 4|P a ge


Question 04
[Total Marks=20]
i. What is the purpose of using Fragments in an Activity? (04 Marks)
ii. Give two ways to add a fragment to an Activity? (04 Marks)
iii. List out Three methods available in the Fragment life cycle? (06 Marks)
iv. Assume Orange is a fragment class and consider the following code fragment to answer the
following question.

Orange fr=new Orange();


FragmentManager fm=getFragmentManager();
FragmentTransaction ft=fm.beginTransaction();
ft.replace(R.id.fragmentplace,fr);
ft.commit();

Explain the purpose of the following statements (06 marks)


a. ft.replace(R.id.fragmentplace,fr);
b. ft.commit();

Question 05
[Total Marks=20]
i. Android has number of APIs. Which API is used when you want to save data using
key-value pairs (04 marks)

ii. What is the difference between getSharedPreferences() and getPreferences()


methods? (04 marks)

iii. Which methods are calling to retrieve Integer and String values from a shared
preferences file (02 marks)

iv. Following program is written to save Student record using key value pairs. Fill in the
blanks in following program segment. (10 marks)

String StudentName= “Pradeep Sanjaya”;


Boolean male= true;
String StudentAddress= “No 34, Samagimawatha, Thildeniya”;
int telephone= 071234567;
String courseCode= “Programming with Android”;
floatcourseFee= 12500.00;
(a).………………….sp = getSharedPreferences("mydata", Context.MODE_PRIVATE);
(b)……………………….. ed = sp.(c)………..;
ed.(d)………..("sName",StudentName );

HNDIT 2417 - Mobile Application Development – 2015 2nd Semester 5|P a ge


ed.(e)………..("sMale",male );
ed.(f)………..("sAddress", StudentAddress);
ed.(g)………..("sTelephone", telephone);
ed.(h)………..("sCourseCode", courseCode);
ed.(i)………..("sCourseFee", courseFee);
ed.(j)………..;
Question 06
[Total Marks=20]
i. What is the role of SQLite in Android applications? (03 marks)

ii. Write the necessary import statement to use SQLite in an Android application?
(03 marks)
iii. Give the purpose of the following statement. (04 marks)
db=openOrCreateDatabase("StudentDB", Context.MODE_PRIVATE, null);

iv. Explain the first and second arguments of the method openOrCreateDatabase(… , … , …)
(02 marks)

v. What is the difference between db.execSQL(<SQL>) and db.rawQuery(<SQL>)


(04 marks)
vi. Consider the following table and answer the question. (04 marks)
Table Name: Student
SID Name Marks
1 Kumar 56
2 Ravi 78
3 Lal 23
4 Ann 90
5 Peter 70

Consider the following code fragment:


Cursor C=db.rawQuery("SELECT * FROM student where Marks>56", null);
Int P=C.getCount();

After execution of above code fragment, what will be the value of the variable P? (Assume
all necessary declarations and initializations were done correctly)

-------End of Paper-------

HNDIT 2417 - Mobile Application Development – 2015 2nd Semester 6|P a ge

You might also like