Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

Student Declaration

I___Muhammad SAAD___________________ Registration No._17-Arid-5630_________,

hereby declare that by attempting the paper for the course Mobile Computing___________, I

will not be involved in any kind of cheating/copying/plagiarizing in solving the short

questions-based paper of Final Term Examination 2020. I take full responsibility of my

conduct. If I found involved in any kind of such activity of cheating/copying/plagiarizing,

then Institute reserves the right to take any disciplinary action against me.

Student Signature
Final Exam / Fall 2020 (Paper Duration 24 hours)
(Online Assignment Based Question Paper)
Course No.: ………CS-471 ……………Course Title: ……Mobile Computing…….
………………….
Total Marks: ………20…………………Date of Exam: ……08-02-2021….…………….................
Degree: ………BSCS, BSIT ……………Semester: …………….......7th…………………..……....
Section: …………………………………
Marks
Q. No. 1 2 3 4 5 6 7 8 9 10 Obtained/
Total Marks
Marks
Obtained
Total Marks in Words:
Name of the teacher: Rana M. Amir Latif
Who taught the course: Signature of Teacher / Examiner:

To be filled by Student

Registration No.: …17-Arid-5630………… Name: …Muhammad SAAD………………

(PRACTICAL EXAMINATION)

Answer the Following Questions

1. Briefly Explain the Activity life cycle? (3 Marks)


______________________________________________________________________________
______________________________________________________________________________
2. Difference between Linear Layout and Relative Layout? (3 Marks)
______________________________________________________________________________
______________________________________________________________________________
3. What shared Preference, also explain and write the code store the data into share preference, and
also get the data from shared preference? (3 Marks)
______________________________________________________________________________
______________________________________________________________________________
4. Difference between gravity and padding? (3 Marks)
______________________________________________________________________________
______________________________________________________________________________
5. How to pass data from one activity to other using intent write the code? (3 Marks)
______________________________________________________________________________
______________________________________________________________________________
6. Draw the moqups /Use Case of your Final Year Project? (5 Marks)
______________________________________________________________________________
______________________________________________________________________________

Note:
Hand written paper will not be acceptable?
Pledger should be less than 10%
Final Exam / Fall 2020 (Paper Duration 24 hours)
(Online Assignment Based Question Paper)
Course No.: ………CS-471 ……………Course Title: ……Mobile Computing…….
………………….
Total Marks: ………20…………………Date of Exam: ……08-02-2021….………………..............
Degree: ………BSCS, BSIT ……………Semester: …………….......7th, 7th …………………..……....
Section: …………………………………
Marks
Q. No. 1 2 3 4 5 6 7 8 9 10 Obtained/
Total Marks
Marks
Obtained
Total Marks in Words:
Name of the teacher: Rana M. Amir Latif
Who taught the course: Signature of Teacher / Examiner:

To be filled by Student

Registration No.: ……17-Arid-5630…………… Name: …Muhammad SAAD……………………

(PRACTICAL EXAMINATION)

Answer the Following Questions

7. Briefly Explain the Activity life cycle? (3 Marks)


______________________________________________________________________________
______________________________________________________________________________
8. Difference between Linear Layout and Relative Layout? (3 Marks)
______________________________________________________________________________
______________________________________________________________________________
9. What shared Preference, also explain and write the code store the data into share preference, and
also get the data from shared preference? (3 Marks)
______________________________________________________________________________
______________________________________________________________________________
10. Difference between gravity and padding? (3 Marks)
______________________________________________________________________________
______________________________________________________________________________
11. How to pass data from one activity to other using intent write the code? (3 Marks)
______________________________________________________________________________
______________________________________________________________________________
12. Draw the moqups /Use Case of your Final Year Project? (5 Marks)
______________________________________________________________________________
______________________________________________________________________________

Note:
Hand written paper will not be acceptable?
Pledger should be less than 10%
Q1:
there are some activity life cycles are as follow:

1. onCreate()
This activity is starting but this activity cannot be visible to the user.
2. onStart()
This activity can be visible to the user but this activity is not ready for the communication of
user.
3. onResume()
Now the activity is in foreground and ready to communicate with the user.
4. onpause()
In this case this activity is paused by the user and go in the background and another activity is
appear in same screen.
5. onStop()
In this case the activity is no longer available for the user.
6. onDestroy()
In this case the finish() in this activity is triggered and system wants to free up some space.
7. onRestart()
In this case it is called when the activity has stop once and then start again.

Q2:

Linear Layout:

Linear layout establish the elements the single line. We can also specify the line is horizontal or
vertical by using orientation property. By default the orientation is horizontal.

A horizontal linear layout have the only one single row of elements in the screen and vertical linear
layout have only one single child in the row.

There are various properties of the linear layout but when it about linear layout weight keep in mind
as weight is larger it will occupy more space in screen.

Example of Linear Layout:

<Linear layout
android: orientation=”horizontal”

android: layout-with=”match-parent”

android: layout-height=”wrap-content”

>

<Button>

android: layout-with=”match-parent”

android: layout-height=”wrap-content”

android: text=”ok”

</Button>

<Textview>

android: layout-with=”match-parent”

android: layout-height=”wrap-content”

android: text=”Press OK

</Textview>

</Linear layout>

Relative Layout:

Android relative layout element depend on the relationship with parent and one another so that’s why
this layout is most complicated layout in android and we need different properties to make the layout
as we desire.

The main advantage of relative layout is that we can position a view to toLeftOf, toRightOf, above
and below to its siblings.

We can also position a view by using parent property like centered horizontal.
<RelativeLayout android:layout_width="match-parent" android:layout_height="wrap-content">

<Button

android:text="Back"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_id="@id/okbutton" >

</Button>

<TextView

android:text="OK"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_below="@id/okbutton">

</Textview>

</Relative layout>

Q3:
The android provide various ways to store the data of the application one of them is shared
preference. Basically the shared preference allow the user to save and retrieve the data in the
form of values and key pairs.
When user use the shared preference user have to call the method of sharedPreference() and
also return this method to the instance to this file which contains the data of your method.

For example:
Sharedpreferences sharedpreferences = getsharedpreferences(datapreferences,
context.MODE_PRIVATE);
There are also some other modes in the sharedpreferences:
1. MODE_APPEND
In this mode the new preferences with the preference which is already exist
2. MODE_MULTI_PROCESS
In this method it will check out modifications for the preferences it will check the
preference even is load.
3. MODE_PRIVATE
In this mode when user set this mode it will apply only when user call its application
4. MODE_WORLD_READABLE
Simple is that this mode the allow other application read the preferences.
5. MODE_WORLD_WRITABLE
Simple is that this mode allow other application to write the preferences.

Q4:

There is only little difference between gravity and layout.

Gravity:

Basically gravity is used to position the elements you can centered the elements according to its
parent, right to the parent, left to the parent, below the parent and top to the parent.

Padding:

Basically the padding create the distance of view and its content to the edges.

Q5:

First you have to create two activities in your project one activity is used to send data and second
activity used to save data.

1st activity name is MainActivity

2nd activity name is SeondActivity


MainActivity Java Code:

public class MainActivity extends AppCompatActivity {

EditText msgtxt;

public final static String msgtxt ="saadpc.senddata.message_key";

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

public void sendmessage (View view)

Msg_txt = (EditText) findViewById(R.id.msg_text);

String message = Msg_txt.getText().toString();

Intent intent= new Intent(this ,SecondActivity.class);

intent.putExtra(MESSAGE_KEY,message);

startActivity(intent);

finish();
}}

SecondActivirty Java Code:

public class SecondActivity extends Activity {

public final static String msg_txt ="saadpc.senddata.message_key";

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

Intent i = getIntent();

String message = i.getStringExtra(msg_txt);

TextView textView = new TextView(this);

textView.setTextSize(40);

textView.setText(msg);

setContentView(textView);

}
Q6:

There are several use cases in our Final Year Project:

1. Logging to the application


2. If don’t have an account go for signup
3. Enter into main screen and check notification
4. If blood required than search donor according to city and blood group in search bar
5. If blood required after 2 or 3 days then broadcast the request to the donors
6. Also see the Google maps to find the current location of the donor
7. Go for the different setting (if user want)
8. And the logout from the application
Logging to the application:
First user have to logging in our application there are two ways to logging into the application
by using the Facebook services and direct put its data in signup page and logging to the
device.
If don’t have an account go for signup
If user don’t have an account in our application then user have to create an account it totally
depend on the user if don’t want to use Facebook services and user have to go for signup page
and fill the signup page with its personal information with valid email and password and next
time user use this email and password to logging into the application.
Enter into main screen and check notification
When user successfully logging into the application it will enter in the main screen there is
option of notification where user get different notification from the application and other
donors and check them all.
If blood required than search donor according to city and blood group in search
Bar
If user required a blood in any case of emergency the user search the donor in the search bar
with required city and required blood group and find a suitable donor and contact with the
donor by it information giving in the application.
If blood required after 2 or 3 days then broadcast the request to the donors
If user required a blood after two or three days then user make a request and broadcast it to all
the donors of the application there also option to send the request to the specific donors of
specific city.
Also see the Google maps to find the current location of the donor
If user wants to know where donor is right now or want to meet the donor user can see the
Google maps to see the current location of the donor.
Go for the different setting (if user want)
There are different setting for the application if user want to go for the settings it will open the
setting page and apply different setting just like apply different themes, change fonts and
change password etc and then exit the application.
And the logout from the application
After all of these activities user can logout from the application.

You might also like