Mobile Computing, Past Papers, UOS Main Campus

Mobile Computing Past Paper 2016 (Paper B) – MSc IT 4th Term UOS (IT-4545)

ProgramMSc IT
Term4th
Year2016
Course codeIT-4545
AnswersSolved ✓

University of Sargodha Mobile Computing (IT-4545) paper for MSc IT 4th term, 2016 exam (80 marks, 2:30 hours). This is the second of two different 2016 Mobile Computing papers on this site. The full paper is below, followed by solved answers for every question.

University of Sargodha
M. Sc. 4th Term Exam 2016
Subject: I.T
Paper: Mobile Computing (IT-4545)
Maximum Marks: 80
Time Allowed: 2:30 Hour

Objective Part (Compulsory)

Q.1. Write short answers of the following in 2-3 lines each. (16*2)

i. What is the importance of mobile strategies in the business world?
ii. What is Metro design language?
iii. What is a QR code and why it is used?
iv. What is a JSON format? Explain with the help of an example?
v. What is the difference between a simulator and emulator and when they are used?
vi. What is cleanup stack in Symbian OS?
vii. Define event-based programming?
viii. What is GPS?
ix. In threads what is meant by message passing technique?
x. What is xCode?
xi. Draw a sequence diagram of the sequence of events in between pressing a key on the keyboard to displaying it on display screen?
xii. What is a checkpoint security-related design pattern?
xiii. What is a Relative Layout?
xiv. What is Energy Management?
xv. Name the tools needed to create mobile applications on android?
xvi. What is a port?

Subjective Part (4*12)

Q.2. We know that Java hides the implementation of threading model from user but some of its details can become visible to the programmer. So what are the issues that developers must consider?

Q.3. What are different design patterns for limited memory?

Q.4. What is the workflow for application development?

Q.5. Briefly explain the security features in MIDP Java? Also discuss the problems with them?

Q.6. Discuss any four basic android UI elements with code?

Q.7. Describe in detail on web services languages?

Solved answers

Q1 – Short answers (16 × 2)

i. Importance of mobile strategies in business: Customers use phones more than computers, so a clear mobile strategy (app, mobile site, payments, notifications) helps a business reach customers anytime, increase sales, improve service and stay ahead of competitors.

ii. What is Metro design language? Microsoft’s design style (Windows Phone 7/8, Windows 8) based on clean typography, flat coloured “live tiles”, simple icons and content-first layouts without decoration. Later renamed “Modern UI”.

iii. What is a QR code and why is it used? A two-dimensional barcode that stores URLs, text or payment data. It is used because a phone camera can read it instantly – for opening links, payments, tickets and product information.

iv. JSON format with example: JSON (JavaScript Object Notation) stores data as name/value pairs in objects { } and lists in arrays [ ]. Example: {"student":"Ahmed","semester":4,"subjects":["OS","DB"]}.

v. Simulator vs emulator: A simulator imitates the software behaviour of a device but runs on the computer’s own CPU (e.g. iOS Simulator) – fast, good for UI testing. An emulator imitates both hardware and software of the device (e.g. Android Emulator) – slower but closer to the real phone, used for testing hardware-level behaviour before testing on a real device.

vi. Cleanup stack in Symbian OS: A mechanism to avoid memory leaks: pointers to heap objects are pushed on the cleanup stack (CleanupStack::PushL); if a function “leaves” (exception) the objects are destroyed automatically, otherwise they are popped normally (Pop/PopAndDestroy).

vii. Event-based programming: Program flow is driven by events (tap, key press, timer, incoming data); the program registers handlers/listeners that execute when the event occurs.

viii. What is GPS? Global Positioning System – a satellite navigation system; the phone’s GPS receiver calculates its latitude, longitude and altitude from satellite signals. Used in maps, tracking and location-based apps.

ix. Message passing in threads: Threads communicate by sending messages to a queue; the receiving thread handles them one at a time (e.g. Android Handler/Looper), avoiding shared-data conflicts.

x. What is Xcode? Apple’s IDE for macOS used to develop iOS and macOS apps in Swift/Objective-C, with Interface Builder, debugger and iOS Simulator.

xi. Sequence of events from key press to display: User → Keypad (interrupt) → Keyboard driver (scan code) → OS / window server (key event to focused app) → Application handler (updates text) → Display driver (redraw) → Screen shows the character.

xii. Checkpoint security design pattern: All requests pass through a single checkpoint component that enforces the security policy – authentication, authorisation and input checking – before access to the protected resource is allowed, and it logs violations.

xiii. What is a RelativeLayout? An Android layout in which child views are positioned relative to each other or to the parent, e.g. layout_below, layout_toRightOf, layout_alignParentBottom. It reduces nested layouts.

xiv. What is energy management? Reducing battery use of an app: switch off GPS/sensors when not needed, batch network calls, avoid wake-locks and unnecessary background work, lower screen brightness/refresh.

xv. Tools needed for Android apps: Java JDK (or Kotlin), Android Studio IDE, Android SDK with build tools, Android Emulator (AVD) and Gradle; a real device with USB debugging for testing.

xvi. What is a port? A numbered logical endpoint (0–65535) that identifies a service or process on a device, e.g. HTTP 80, HTTPS 443, FTP 21.

Q2 – Java threading issues developers must consider (12)

  • Race conditions / shared data: when two threads update the same variable the result is unpredictable; use synchronized blocks, locks or atomic classes.
  • Deadlock: two threads each wait for a lock held by the other; avoid by acquiring locks in a fixed order and holding them briefly.
  • Thread scheduling and priorities: the JVM/OS decides which thread runs; priorities behave differently on different devices, so code must not depend on a particular order.
  • UI thread rule: only the main/UI thread may update the screen; long tasks (network, file, database) must run in background threads and post results back (e.g. runOnUiThread, Handler), otherwise the app freezes (ANR).
  • Visibility of changes: one thread’s changes may not be seen by another without volatile or synchronisation.
  • Resource limits: each thread uses memory and battery; mobile devices should use a small thread pool (ExecutorService) instead of creating many threads.
  • Stopping threads safely: Thread.stop() is deprecated; use a flag or interrupt() and let the thread finish cleanly.

Q3 – Design patterns for limited memory (12)

  • Linear data structures: keep data in contiguous arrays rather than many small linked objects – less overhead and fragmentation.
  • Basic data structures / data packing: use the smallest suitable types (byte, short), bit-fields and compressed formats.
  • Small / static memory allocation: allocate fixed buffers at start-up and reuse them instead of frequent dynamic allocation.
  • Object pooling (memory pool): keep a pool of reusable objects (e.g. list rows, bitmaps) to avoid repeated creation and garbage collection.
  • Lazy loading / on-demand loading: load resources only when needed and release them when not visible.
  • Flyweight: share common data between many objects (e.g. one font or icon object used everywhere).
  • Cleanup / ownership patterns: clear rules for who frees memory (cleanup stack, smart pointers, ARC) to prevent leaks.

Q4 – Workflow for application development (12)

  1. Idea and requirements: define the problem, target users, features and platforms.
  2. Research and planning: study competitors, choose native or cross-platform, plan budget and timeline.
  3. Design: wireframes → mock-ups → interactive prototype; follow platform UI guidelines.
  4. Architecture: choose pattern (MVC/MVVM), database, APIs and back-end services.
  5. Development: code the front end and back end in iterations (sprints), using version control.
  6. Testing: unit, UI, performance, security and device testing on emulators and real phones; fix bugs.
  7. Deployment: sign the app and publish to Google Play / App Store with description and screenshots.
  8. Maintenance: monitor crashes and analytics, collect feedback, release updates.

Q5 – Security features in MIDP Java and their problems (12)

Features (MIDP 2.0, Java ME):

  • Sandbox model: a MIDlet runs inside the virtual machine and can only use the Java ME APIs; no direct access to memory or native OS.
  • Bytecode verification (pre-verification + on-device check) so invalid code cannot run.
  • Code signing and protection domains: MIDlet suites are signed with X.509 certificates; signed apps go into trusted domains (manufacturer, operator, third party), unsigned ones into the untrusted domain.
  • Permissions: sensitive APIs (network, SMS, file, location) need permissions declared in the JAD; the user is asked (blanket, session or one-shot).
  • Secure networking: HTTPS and SSL/TLS connections through HttpsConnection and SecureConnection.
  • Record Management System stores are private to a MIDlet suite unless shared explicitly.

Problems: too many permission prompts annoy users, who then just press “Yes”; certificates are expensive and differ between operators and manufacturers, so many apps stay unsigned; implementations vary across devices; limited cryptography APIs; RMS data is not encrypted; and the sandbox prevents useful security features such as access to the SIM or native key stores.

Q6 – Four basic Android UI elements with code (12)

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" android:padding="16dp">

    <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:text="Feedback" android:textSize="22sp" />

    <EditText android:id="@+id/etMsg"
        android:layout_width="match_parent" android:layout_height="wrap_content"
        android:hint="Your message" />

    <RadioGroup android:id="@+id/rgRate"
        android:layout_width="wrap_content" android:layout_height="wrap_content">
        <RadioButton android:id="@+id/rbGood" android:text="Good"
            android:layout_width="wrap_content" android:layout_height="wrap_content" />
        <RadioButton android:id="@+id/rbBad" android:text="Bad"
            android:layout_width="wrap_content" android:layout_height="wrap_content" />
    </RadioGroup>

    <Button android:id="@+id/btnSend"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:text="Send" />
</LinearLayout>
findViewById(R.id.btnSend).setOnClickListener(v -> {
    String msg = ((EditText) findViewById(R.id.etMsg)).getText().toString();
    Toast.makeText(this, "Sent: " + msg, Toast.LENGTH_SHORT).show();
});

TextView (label), EditText (input), RadioButton/RadioGroup (one choice from many) and Button (action).

Q7 – Web services languages (12)

  • XML – the base data language; structure defined with XML Schema (XSD).
  • SOAP – XML messaging protocol; a message has Envelope, Header, Body and Fault; usually sent over HTTP.
  • WSDL – XML description of a service: types, messages, port types (operations), bindings and service address, so clients know how to call it.
  • UDDI – directory where services are published and discovered (white, yellow and green pages).
  • REST + JSON – light-weight approach using HTTP methods (GET, POST, PUT, DELETE) on resource URLs, returning JSON or XML; most common for mobile apps because it is simple and uses less bandwidth.

Together: the service is described in WSDL, published/found in UDDI, and called with SOAP messages written in XML (or with REST/JSON).

Save this paper for offline studyDownload the question paper, or save the paper together with all solved answers as a PDF.
↓ Download Paper (JPG)

About Saif R

An educator and technology enthusiast passionate about empowering students through quality education and digital learning. Dedicated to making academic resources and opportunities accessible to everyone.