MAD IMP QUES SEM
2M
UNIT 1
1. WHAT ARE THE DIFFERENT MOBILE OS AVAILABLE
A Mobile OS is essential software that runs mobile devices like smartphones, tablets, and PDAs. It
manages hardware and enables features like messaging, email, WAP, and app synchronization. The
OS also controls which third-party apps can run on the device.
1. Android
•
•
•
Android is an open-source mobile OS developed by Google, based on the Linux kernel. It is
designed for touchscreen devices like smartphones and tablets.
Written in: C, C++, Java
OS Family: Unix
2. iOS
•
•
•
iOS is a closed-source mobile OS developed by Apple Inc. for Apple devices like the iPhone,
iPad, and iPod Touch.
Written in: C, C++, Objective-C, Swift
OS Family: Unix
3. Windows Mobile
•
•
•
•
Windows Mobile is a mobile OS developed by Microsoft for smartphones and Pocket PCs.
First Released: October 2010
Written in: C, C++
OS Family: Microsoft Windows
2. WHAT ARE THE TYPES OF MOBILE APPLICATIONS
Native Apps
•
•
Built for a specific platform (Android/iOS) and installed via app stores.
Can fully access device features like GPS, camera, and contacts.
Web Apps
•
•
Run on web browsers with internet connectivity, not installed on devices.
Developed using HTML, CSS, and JavaScript; examples: online banking, webmail.
Hybrid Apps
•
•
Combination of native and web apps, installed from app stores.
Use embedded browsers to display web content but can also access device features.
3. GIVE APPLICATIONS AND FEATURES OF ANDROID
Applications of Android
•
•
•
Android powers the majority of smartphones worldwide.
Used in Android tablets for reading, browsing, and media consumption.
Provides access to apps like YouTube, Netflix, and games on TVs.
Features of Android
•
•
•
Freely customizable by manufacturers and developers.
Millions of apps, games, and digital content available for download.
Supports running multiple apps at the same time efficiently.
4. WHAT ARE THE DIFFERENT ANDROID COMPONENTS
5. GIVE THE DIFFERENT TYPES OF LAYOUT IN ANDROID
•
•
•
•
•
•
•
LinearLayout – Arranges elements in a single row or column.
RelativeLayout – Positions elements relative to parent or other views.
TableLayout – Organizes elements into rows and columns.
AbsoluteLayout – Places elements using fixed x, y coordinates.
FrameLayout – Displays one view or overlaps multiple views.
ListView – Shows a scrollable list of items.
GridView – Shows items in a grid (rows & columns).
UNIT 2
1. DIFFERENTIATE BW ACTIVITIES AND INTENTS
ACTIVITIES
INTENTS
Activity provides a screen for users to interact
with (e.g., call, email, take photos).
Intents are message-passing mechanisms used
to communicate within or between Android
applications.
Each activity gets a window to draw its user
interface (UI).
They are used to activate components like
Activities, Services, and Broadcast Receivers.
The window usually fills the screen, but it can
also float over other windows.
Example: An intent can start an activity to send
an email or open a web page.
2. DEFINE LINKING ACTIVITY
Android Intent is an abstract description of an operation to be performed. It can be used with,
•
•
•
–A startActivity () to launch an Activity
–A sendBroadcast () to send it to any interested Broadcast Receiver components
–A startService (Intent) to communicate with a background Service
3. HOW TO CREATE ALERT DIALOG IN ANDROID. GIVE ITS SYNTAX
Steps:
•
•
•
Use AlertDialog.Builder to build the dialog.
Set title, message, and buttons.
Call show () to display it.
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder. setTitle ("Dialog Title");
builder. setMessage ("This is the message");
builder. setPositiveButton ("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick (DialogInterface dialog, int which) {
}
});
builder. setNegativeButton ("Cancel", null);
builder. show ();
4. HOW TO PUBLISH AN APP IN PLAYSTORE
Steps to Create a Google Play Developer Account:
•
•
•
•
•
•
Visit the Google Play Console.
Enter your developer details (name, email, etc.).
Accept the Developer Distribution Agreement.
Pay the $25 USD one-time registration fee.
Verify your email address.
Once approved, you can publish apps on Google Play.
Key Points About Android App Publishing:
•
•
•
Publishing is the final step in Android app development.
After development and testing, you can upload your app to Google Play for distribution.
You can also distribute your app manually (e.g., via your website or direct download).
5. DEFINE SQL-LITE
SQLite is a lightweight, serverless, open-source RDBMS used in Android to store data locally in a single
database file.
Features
•
•
•
•
•
Small size (~350 KB), simple API, easy to use.
Open-source, free, and cross-platform.
ACID-compliant and supports SQL queries.
Stores data in a single file (portable).
Low memory consumption, no server required.
Data Types in SQLite
•
•
•
•
•
NULL – Represents a missing value.
INTEGER – Whole numbers.
REAL – Floating-point numbers.
TEXT – Strings/characters (UTF-8/UTF-16).
BLOB – Binary data stored exactly as input.
UNIT 3
1. DEFINE OBJECTIVE C
•
•
•
Objective-C is a general-purpose, object-oriented programming language that adds Smalltalkstyle messaging to the C programming language.
This is the main programming language used by Apple for the OS X and iOS operating systems
and their respective APIs, Cocoa and Cocoa Touch.
Initially, Objective-C was developed by NeXT for its NeXTSTEPOS from whom it was taken over
by Apple for its iOS and Mac OS X.
2. WHAT ARE THE CLASSIFICATIONS OF TOKENS
•
•
•
•
•
Keywords – Reserved words with special meaning.
Identifiers – Names given to variables, functions, classes.
Constants – Fixed values (e.g., numbers, characters).
String Literals – Sequence of characters in double quotes.
Symbols – Operators and special characters (e.g., +, -, ;).
3. WHERE THE BASE LAYER IS IMPLEMENTED
•
•
•
•
•
The base layer in Android is implemented in the Linux Kernel.
It provides core system services like memory management and process management.
It also handles security and power management.
The kernel includes important device drivers for hardware communication.
Thus, it acts as a foundation for the entire Android architecture.
4. GIVE THE DIFFERENCES BETWEEN STATIC AND DYNAMIC OBJECTS IN OBJECTIVE C
5. DIFFERENTIATE BETWEEN NSARRAY AND NSDICTIONARY
Aspect
Definition
Mutability
Syntax
(Literal)
Access
Use case
NSArray
Ordered collection of objects
(array).
Immutable (NSArray), mutable form
is NSMutableArray.
@[]
NSDictionary
Unordered collection of key–value pairs.
Accessed using index (0,1, 2,).
Store lists/sequences of objects.
Accessed using a key (unique identifier).
Store mappings/relationships between
objects.
Immutable (NSDictionary), mutable form is
NSMutableDictionary.
@{}
UNIT 4
1. DEFINE THE IOS AND GIVE ITS FEATURES
Apples mobile operating system considered the foundation of the iPhone Originally designed for the
iPhone but now supports iPod touch, iPad, and Apple TV It is updated just like Itune for iPods As of
Oct 2011 Apple contains over 500,000 iOS applications.
FEATURES
•
•
•
•
•
Grid of App Icons – Apps are organized in a grid layout for easy access.
Dock Bar – Fixed bottom row with essential apps: Phone, Mail, Safari, and iPod.
Status Bar – Displays time, signal strength, battery, and network info.
Built-in & Third-party Apps – Includes default apps (Camera, Messages) and installed apps
(Skype, Shazam, etc.).
Page Indicators – Dots above the dock show multiple app screens/pages.
2. WHERE THE ROTATING SCROLLABLE VIEW IS CONSIDERED
Rotating Scrollable View is considered in → ScrollView
•
•
•
•
•
ScrollView is a special layout in Android.
It allows vertical scrolling of content.
Can hold a single child view or layout.
Adjusts automatically when the screen is rotated.
Used when content is larger than the screen size.
3. WHAT IS ICLOUD
iCloud is Apple’s cloud storage and synchronization service that allows users to store, back up, and
sync data across all Apple devices (iPhone, iPad, Mac, etc.).
•
•
•
Auto Backup – Saves photos, app data, and settings automatically.
Data Syncing – Keeps contacts, notes, and more updated across devices.
Find My – Helps locate lost or stolen Apple devices.
4. WRITE QUERY TO CREATING AN SQLITE DATABASE AND ADD VALUES TP IT'
1. Create SQLite Database & Table
CREATE TABLE Students (
ID INTEGER PRIMARY KEY,
Name TEXT,
Age INTEGER
);
2. Insert Values
INSERT INTO Students (Name, Age) VALUES ('John', 20);
INSERT INTO Students (Name, Age) VALUES ('Alice', 22);
5. DEFINE MVC
MVC is a software architectural design pattern that separates an application into three main
components to improve modularity and code reusability.
Components:
Model
•
•
Manages application data and business logic.
Responds to requests from the controller.
View
•
•
Represents the user interface (UI).
Displays data from the model to the user.
Controller
•
•
Handles user input and events.
Updates the Model and refreshes the View accordingly.
Features
•
•
•
•
Clear separation of concerns (data, UI, logic).
Easy to maintain and test.
Supports code reusability and parallel development.
Commonly used in iOS, Android (with modifications), and web applications.
Flow:
•
User → Controller → Model → View → User (cycle of interaction).
UNIT 5
1. WHEN THE DEACTIVATED EVENT IS CALLED
•
•
•
•
Called when the app is sent to the background (user presses Start or switches apps).
Allows the app to save application state and release resources.
Helps in preserving user progress so it can be restored later.
Ensures smooth app suspension and resumption.
2. WRITE NOTES ON WINDOWS PHONE 8
•
•
•
•
•
Developed by Microsoft, based on Windows NT kernel.
Supports multi-core processors, high-resolution displays, and NFC.
Uses .NET framework, XAML, and Silverlight for apps.
Provides access to hardware features like camera, GPS, sensors, and accelerometer.
Includes Windows Phone Store for app distribution.
3. GIVE THE UI DESIGN GUIDELINES FOR WINDOWS PHONE 8
•
•
•
•
•
Follow Metro design principles: large typography, bold colours, minimal chrome.
Maintain a clean and consistent layout for all screens.
Use touch-friendly controls with enough spacing for fingers.
Ensure content-focused UI, keeping the user’s attention on data.
Design for responsive layouts across different screen sizes and orientations.
4. WHAT IS SILVER-LIGHT AND GIVE ITS TOOLS
•
•
•
Silverlight is a framework for building rich internet and mobile apps.
Uses .NET and XAML for UI and application logic.
Supports animations, multimedia, and interactive UI elements.
Tools for Silverlight development:
•
•
Visual Studio – Coding, debugging, and compiling apps.
Expression Blend – Designing UI, animations, and visual interactions.
5. HOW TO CREATE AN APP PACKAGE IN WINDOWS PHONE/UNIVERSAL WINDOWS APPS
•
•
•
•
•
In Visual Studio, right-click project → Store → Create App Packages.
Sign in with developer account and select the app name.
Choose architectures: x86, x64, and ARM for maximum device compatibility.
Select “Generate app bundle – Always” to create a single. appxupload file.
Click Create to generate the package ready for Windows Store submission.
16M
UNIT 1
1. EXPLAIN THE ANDROID ARCHITECTURE IN DETAIL
•
Android is an open-source, Linux-based operating system designed for mobile devices like
smartphones and tablets. It was developed by the Open Handset Alliance, led by Google.
• Android allows a unified development platform, meaning apps developed for Android can run
on various Android-powered devices.
• The first Android SDK (beta) was released in 2007, and the first commercial version (Android
1.0) came out in September 2008. In June 2012, Google introduced Android 4.1 (Jelly Bean),
focusing on UI performance and functionality.
• Android's source code is open-source:
1. Most under the Apache License 2.0.
2. Linux kernel parts under the GNU GPL v2.
Applications of Android
•
•
•
Android powers the majority of smartphones worldwide.
Used in Android tablets for reading, browsing, and media consumption.
Provides access to apps like YouTube, Netflix, and games on TVs.
Features of Android
•
•
•
Freely customizable by manufacturers and developers.
Millions of apps, games, and digital content available for download.
Supports running multiple apps at the same time efficiently.
Needs of Android
Components of Android
Categories of Android Applications
There are many android applications in the market. The top categories are:
•
•
•
•
•
•
•
•
•
Entertainment
Tools
Communication
Productivity
Personalization
Music and Audio
Social
Media and Video
Travel and Local etc
Architecture of Android
1. Linux Kernel (Base Layer)
•
•
•
Acts as the hardware abstraction layer.
Manages device drivers, memory, power, and process control.
Provides basic system functionalities like security and networking.
2. Libraries + Android Runtime
Native Libraries
•
•
Written in C/C++, used by Android system.
Examples:
1.
2.
3.
4.
SQLite – Database engine.
OpenGL – Graphics rendering.
SSL – Secure internet communication.
Media, Graphics, FreeType – Handle audio, video, fonts, etc.
Android Runtime
•
•
•
Includes Dalvik Virtual Machine (in older Android versions; now replaced by ART).
Runs apps using Java bytecode.
Provides core libraries for app development.
3. Application Framework
•
•
Provides higher-level services to applications.
Examples:
1.
2.
3.
4.
Activity Manager – Manages app lifecycle.
Window Manager – Manages windows and views.
Content Providers – For data sharing between apps.
Location Manager, Resource Manager – Handle location and resources.
4. Applications (Top Layer)
•
•
•
All the built-in and user-installed apps like:
Home, Contacts, Camera, SMS, etc.
These use APIs from the Application Framework.
Advantages of Android:
•
•
•
Customizable UI – Users and OEMs can fully personalize the interface.
Large App Ecosystem – Millions of apps available on Google Play Store.
Multi-Device Support – Runs on phones, tablets, TVs, smartwatches, etc.
Disadvantages of Android:
•
•
•
Fragmentation – Many versions in use lead to inconsistent user experience.
Security Risks – Open app policies can lead to malware if not careful.
Slower Updates – Device makers delay OS updates, unlike iOS.
2. A. EXPLAIN CELLULAR NETWORK IN ANDROID
•
•
•
•
•
A cellular network (or mobile network) is a type of wireless communication network where
the last connection link is wireless.
The service area is divided into cells, each served by a base station or cell tower.
Each cell uses a different frequency set than its neighbours to avoid interference.
By joining multiple cells, the network provides wide radio coverage.
This system allows mobile phones, pagers, and portable devices to communicate with each
other and with fixed networks.
Structure of Cellular Network
The mobile cellular network consists of the following subsystems:
Base Station Subsystem (BSS)
•
•
A group of base stations that provide radio coverage.
Responsible for transmission and reception of signals.
Core Circuit-Switched Network
•
Handles voice calls, SMS, fax services, billing.
Packet-Switched Network
•
Handles mobile data services like internet, email, apps.
Public Switched Telephone Network (PSTN)
•
Connects mobile subscribers to the wider telephone and internet network.
Functions of Mobile Switching Centre (MSC)
•
•
•
•
Call setup and release.
Routing of calls and SMS.
Managing conference calls, call hold, and handovers.
Interfacing with PSTN and Internet.
Additional Features of Cellular Systems
•
•
•
•
•
Provides very high capacity in limited spectrum.
Allows frequency reuse across different cells.
Supports handover when moving from one cell to another.
Ensures low interference levels.
Uses low-power transmitters for efficient communication.
Generations of Cellular Networks
1G (1980s)
•
•
Analog cellular telephony.
Only voice calls, poor security, low capacity.
2G (1990s)
•
•
•
Digital cellular telephony (GSM, CDMA).
Supported voice, SMS, MMS.
More secure than 1G.
3G (2000s)
•
•
High-speed data transfer + voice.
Video calling, internet browsing, multimedia.
4G (2010s)
•
•
•
IP-based technology.
High-speed voice, data, multimedia.
Better quality for streaming, gaming, social media.
Advantages of Cellular Network
•
•
•
•
•
Provides voice and data services even while roaming.
Connects both fixed line and mobile users.
Can be used in areas where cables cannot be laid.
Easy to maintain and upgrade.
Increases user capacity by dividing the area into smaller cells.
Disadvantages of Cellular Network
•
•
•
•
Lower data rate compared to wired networks (like fibre).
Signal loss due to multipath interference in large cells.
High infrastructure cost to set up base stations.
Coverage gaps may occur in rural or remote areas.
B. EXPLAIN GSM ARCHITECTURE
GSM is a standard developed to describe protocols for second-generation (2G) digital cellular
networks. The architecture of GSM consists of several components that work together to provide
seamless mobile communication.
1. Air Interface (MS to BTS)
•
•
MS (Mobile Station): Your mobile phone (with SIM).
Um Interface: Wireless interface between MS and BTS using radio signals.
2. Base Station Subsystem (BSS)
•
Manages radio communication and controls multiple BTS.
BTS (Base Transceiver Station):
•
•
Handles radio communication with mobile stations.
Each BTS covers one cell area.
BSC (Base Station Controller):
•
•
•
Controls multiple BTSs.
Manages handover, frequency allocation, and call setup.
A-bis Interface: Connects BTS and BSC.
3. Network Subsystem (NSS)
•
Handles call routing, authentication, subscriber location, and interfacing with PSTN (Public
Switched Telephone Network).
Key Components:
MSC (Mobile Switching Centre):
•
•
Routes calls and messages.
Connects to VLR, HLR, EIR, AUC, and PSTN.
GMSC (Gateway MSC):
•
•
Routes calls from GSM to external networks (PSTN).
Interfaces with HLR and other MSCs.
VLR (Visitor Location Register):
•
Stores temporary data of users roaming in that MSC area.
HLR (Home Location Register):
•
•
Central database of all subscribers.
Stores permanent info like IMSI, services, location.
AUC (Authentication Centre):
•
•
Provides security/authentication keys.
Prevents fraud.
EIR (Equipment Identity Register):
•
•
Tracks mobile devices via IMEI.
Detects stolen or blacklisted phones.
4. PSTN (Public Switched Telephone Network)
•
•
External traditional telephone network.
GMSC connects GSM network to PSTN to allow calls to landlines and other networks.
1. Telephony Services (Teleservices)
•
•
•
•
These use bearer services to transmit voice or text data.
Voice Calls: Basic mobile telephony including emergency calling.
Facsimile & Videotext: Support for fax (Group 3), videotext access, teletex, etc.
SMS (Short Message Service): Sending/receiving short text messages.
2. Data Services (Bearer Services)
•
•
•
Allow data transmission through the GSM network.
Basic Speed: Standard speed up to 9.6 kbps.
Enhanced Data: Improved by technologies like HSCSD and GPRS for faster data transfer.
Features of GSM
•
•
•
•
Supports international roaming
Provides high-quality voice calls
Allows SMS, MMS, and mobile data
Uses SIM card for user identity
3. HOW DO CREATE INTERACTIVE UI? EXPLAIN THE TYPES OF ATTRIBUTES WITH EXAMPLE
In Android, an interactive UI can be created programmatically in Java without using XML files. The UI
is built using View objects (e.g., Button, TextView, EditText) and ViewGroups (e.g., LinearLayout,
RelativeLayout) inside an Activity.
Steps to Create Interactive UI in Java
•
•
•
•
•
Create layout objects (e.g., LinearLayout).
Create UI controls/widgets (e.g., Button, TextView).
Set attributes (size, color, text, etc.) using Java methods.
Add event listeners (e.g., OnClickListener) to handle user interaction.
Use setContentView () to display the layout.
Example: Java Interactive UI
import android.app. Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Step 1: Create Layout
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
// Step 2: Create TextView
TextView textView = new TextView(this);
textView.setText("Hello User");
textView.setTextSize(20);
layout.addView(textView);
// Step 3: Create Button
Button button = new Button(this);
button.setText("Click Me");
layout.addView(button);
// Step 4: Add Event Handling
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this,
"Button Clicked!", Toast.LENGTH_SHORT).show();
}
});
// Step 5: Set the layout as content
setContentView(layout);
}
}
Types of Attributes in Java (with Examples)
1. Layout Attributes
Set width/height using constants:
LinearLayout.LayoutParams params =
new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
textView.setLayoutParams(params);
2. Text Attributes
Control text-related properties:
textView.setText("Welcome");
textView.setTextSize(22);
textView.setTextColor(0xFFFF0000); // Red
3. Image Attributes
Used in ImageView:
ImageView img = new ImageView(this);
img.setImageResource(R.drawable.logo);
layout.addView(img);
4. Control-Specific Attributes
Each widget has unique attributes:
CheckBox chk = new CheckBox(this);
chk.setText("Accept Terms");
chk.setChecked(true);
layout.addView(chk);
ToggleButton toggle = new ToggleButton(this);
toggle.setTextOn("Enabled");
toggle.setTextOff("Disabled");
layout.addView(toggle);
5. Event Handling
Add listeners to respond to user actions:
chk.setOnClickListener(v -> {
if (chk.isChecked()) {
Toast.makeText(this, "Checked!", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "Unchecked!", Toast.LENGTH_SHORT).show();
}
});
Advantages
•
•
•
Dynamic UI (runtime changes possible).
Full control using Java methods.
No XML required.
Disadvantages
•
•
•
More code, less readable.
Hard to maintain.
No design previews.
UNIT 2
1. A. DESCRIBE THE ACTIVITY LIFE CYCLE IN DETAIL
•
•
•
The life cycle of an Android application represents the steps an application goes through from
starting to finishing. It is slightly different from the normal Java program life cycle due to:
The way Android applications are defined (using Activities, Services, etc.).
The limited hardware resources of mobile devices.
Key Points
•
•
•
•
•
•
Each application runs in its own process.
Each Activity (screen) runs in the app’s process.
Processes are started and stopped as needed.
The system may kill inactive apps to free resources.
If killed, an app may be restored to its last state when the user opens it again.
Management is done automatically by Android OS using Activity Stack (last opened activity on
top).
1. Life Cycle Methods:
onCreate()
•
•
Called when the activity is first created.
You initialize your app here (set layout, variables, etc.).
onStart()
•
Called when the activity becomes visible to the user.
onResume()
•
Called when the activity starts interacting with the user.
onPause()
•
•
Called when the activity is partially hidden (e.g., another activity is opening).
Use it to save temporary data.
onStop()
•
Called when the activity is no longer visible.
onRestart()
•
Called when coming back to the activity after being stopped.
onDestroy()
•
Called before the activity is destroyed permanently.
2. State Management
Activities can save and restore UI state using onSaveInstanceState() and onRestoreInstanceState(),
especially useful during configuration changes like screen rotation.
3. Resource Optimization
Lifecycle methods allow releasing resources (like sensors, GPS, or listeners) when not needed
(onPause() or onStop()), helping conserve battery and memory.
4. Navigation Control
Understanding the lifecycle is key for managing navigation between activities, such as using the back
stack and ensuring a smooth user experience.
5. Configuration Handling
Activities can respond to changes in device configuration (like orientation) via lifecycle call-backs or
by handling them manually in the manifest.
1.
2.
3.
4.
Each app runs in its own process.
Android may kill or stop background apps to save resources.
The system uses an activity stack to manage screen transitions.
When needed, Android can restore a killed app to its previous state.
B. EXPLAIN THE CONCEPTS OF SERVICES IN MOBILE APPLICATIONS
A Service is a component that runs in the background to perform long-running tasks without user
interaction — even if the app is closed.
Types of Services
Started Service
•
•
Starts when startService () is called.
Runs in the background until manually stopped using stopSelf () or stopService ().
Bound Service
•
•
Starts when another component binds to it using bindService ().
Stops when all clients unbind.
Service Lifecycle Methods
•
•
•
Services do not have a user interface.
Used for music playing, file downloads, data sync, etc.
You create a service by extending the Service class.
1. Unbounded (Started) Service
Started using: startService()
Life Cycle Flow
•
•
•
•
•
•
•
Service is started → by calling startService()
onCreate() → Called once, when the service is first created
onStart() → Called each time the service is started
Service is running in the background
When the task is done, you stop the service manually using stopSelf() or stopService()
onDestroy() → Called to clean up resources
Service is shut down
2. Bounded Service
Started using: bindService()
Life Cycle Flow:
•
•
•
•
•
•
•
•
Service is created → by calling bindService()
onCreate() → Called once when service is created
onBind() → Called when a component binds to the service
Client interacts with the service
onUnbind() → Called when all clients have disconnected
If clients reconnect, onRebind() is called
onDestroy() → Called when service is no longer used
Service is shut down
2. DURING ACTIVITY INTERACTION WE MIGHT REQUIRED TO PASS DATA FROM ONE
ACTIVITY TO OTHER.
HOW DO YOU IMPLEMENT THIS WITH AN APP FOR SENDING DATA FROM ONE ACTIVITY
TO ANOTHER?
•
•
•
•
•
In Android, an application often contains multiple activities (screens). For example:
Activity A → Login screen.
Activity B → Home screen.
During interaction, we may need to send data from one activity to another (e.g., username,
email, ID).
This is implemented using Intents and Bundles.
1. What is an Intent?
•
An Intent is a messaging object used to request an action from another component.
It can be used to:
•
•
•
•
Start another Activity.
Start a Service.
Deliver a Broadcast.
We use Explicit Intent for starting another activity inside the same app.
2. Methods of Passing Data
•
•
•
Using Intent (putExtra / getExtra) – most common.
Using Bundle – package multiple values.
Using Serializable / Parcelable Objects – for complex data types.
3. Example App: Passing Data from Activity A → Activity B
Activity A (Sender Activity)
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class ActivityA extends Activity {
EditText edtName;
Button btnSend;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Layout in Java
edtName = new EditText(this);
edtName.setHint("Enter your name");
btnSend = new Button(this);
btnSend.setText("Send Data");
// When button is clicked
btnSend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String name = edtName.getText().toString();
// Create Intent to go to ActivityB
Intent intent = new Intent(ActivityA.this, ActivityB.class);
// Pass data using putExtra
intent.putExtra("username", name);
// Start Activity B
startActivity(intent);
}
});
// Set content view programmatically
setContentView(btnSend);
}
}
Activity B (Receiver Activity)
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;
public class ActivityB extends Activity {
TextView txtWelcome;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
txtWelcome = new TextView(this);
// Receive Intent
Intent intent = getIntent();
// Extract the data
String user = intent.getStringExtra("username");
// Display the data
txtWelcome.setText("Welcome, " + user + "!");
setContentView(txtWelcome);
}
}
4. Advantages of Passing Data via Intents
•
•
•
•
Simple and widely used.
Lightweight way to transfer small amounts of data.
Can pass primitive data, strings, bundles, or objects.
Maintains modularity (separates activities).
5. Limitations
•
•
•
Not suitable for very large data (e.g., images, videos).
Data passed is temporary (lost when activity is destroyed unless saved).
For persistent data, we should use SharedPreferences, Database, or Files.
3. CASE STUDY DEVELOP AN APP FOR PLACEMENT REGISTRATION
Introduction
A Placement Registration App is an Android application that allows students to register their details
for campus placement drives.
It demonstrates:
•
•
•
•
•
Form design using Android UI components.
User interaction through buttons.
Passing data between activities using Intents.
Display of registered information for confirmation.
This app is widely used in college placements, recruitment portals, and job registration
systems.
Components Used
•
•
•
•
•
•
•
Layouts – LinearLayout/RelativeLayout for arranging fields.
TextView – Labels like Name, Roll No, CGPA.
EditText – For user input.
Spinner/RadioButton – For selecting department, gender.
Button – To submit details.
Intent & Bundle – To send data to another activity.
TextView – To display the submitted details.
Working
•
•
•
Activity A (Form Activity) → Collects student details.
Submit Button → Sends details via Intent.
Activity B (Display Activity) → Displays submitted data for confirmation.
Java Code
Activity A – PlacementForm.java
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class PlacementForm extends Activity {
EditText edtName, edtRoll, edtDept, edtCgpa;
Button btnSubmit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Create fields
edtName = new EditText(this);
edtName.setHint("Enter Name");
edtRoll = new EditText(this);
edtRoll.setHint("Enter Roll No");
edtDept = new EditText(this);
edtDept.setHint("Enter Department");
edtCgpa = new EditText(this);
edtCgpa.setHint("Enter CGPA");
btnSubmit = new Button(this);
btnSubmit.setText("Submit");
// Button click listener
btnSubmit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent = new Intent(PlacementForm.this, PlacementDisplay.class);
// Put entered data into intent
intent.putExtra("name", edtName.getText().toString());
intent.putExtra("roll", edtRoll.getText().toString());
intent.putExtra("dept", edtDept.getText().toString());
intent.putExtra("cgpa", edtCgpa.getText().toString());
startActivity(intent);
}
});
// Set layout dynamically
setContentView(btnSubmit);
}
}
Activity B (PlacementDisplay.java)
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;
public class PlacementDisplay extends Activity {
TextView txtDetails;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
txtDetails = new TextView(this);
// Receive data from intent
Intent intent = getIntent();
String name = intent.getStringExtra("name");
String roll = intent.getStringExtra("roll");
String dept = intent.getStringExtra("dept");
String cgpa = intent.getStringExtra("cgpa");
// Display details
txtDetails.setText("Placement Registration Details:\n\n"
+ "Name: " + name + "\n"
+ "Roll No: " + roll + "\n"
+ "Department: " + dept + "\n"
+ "CGPA: " + cgpa);
setContentView(txtDetails);
}
}
Features of Placement Registration App
•
•
•
•
•
•
User-friendly Form – Simple interface to enter details.
Multiple Input Fields – Supports text, numbers, dropdowns.
Data Validation – Ensures only valid data is submitted (optional).
Activity Interaction – Demonstrates sending data between activities.
Confirmation Screen – Displays student details clearly.
Easily Extensible – Can be connected to a database or server.
Advantages
•
•
•
Practical Use
Demonstrates Core Concepts
Lightweight
Disadvantages
•
•
•
•
Data Not Stored Permanently
No Authentication
Basic UI
No Error Handling
UNIT 3
1. A. EXPLAIN OBJECTIVE C IN DETAIL AND EXPLAIN VARIOUS CONDITIONAL BRANCHING
AND LOOPING STATEMENTS IN OBJECTIVE C
What Is Objective-C?
•
•
•
•
A general-purpose, object-oriented programming language.
Adds Smalltalk-style messaging to C.
Main language used by Apple for iOS and macOS development.
Works with Cocoa (macOS) and Cocoa Touch (iOS) APIs.
Basic Program Structure
•
•
•
•
•
•
•
Pre-processor Commands
Interface (@interface)
Implementation (@implementation)
Methods
Variables
Statements and Expressions
Comments
Tokens in Objective-C
•
•
Smallest elements:
keywords, identifiers, constants, string literals, symbols
Each statement ends with a;
Data Types in Objective-C
Basic Types
•
•
Integers: int, short, long, char, etc.
Floating-point: float, double, long double
Special Types
•
•
void: Indicates absence of value (used for functions)
Derived: Arrays, pointers, structures, unions, functions
Enum: Named integer constants
Variables
•
•
•
Used to store data
Type determines memory size and operations allowed:
char, int, float, double, void (basic types)
Constants
•
•
Fixed values that don’t change
Examples:
42, 3.14, 'A', "Hello", enum Value
Classes & Objects
•
•
Objective-C adds object orientation to C.
A class is a blueprint for an object.
Defined with:
•
•
•
@interface (for declaration)
@implementation (for method definitions)
All classes inherit from NSObject.
Class Members:
•
•
•
Instance Variables: Hold data.
Methods: Define behavior.
Properties: Access instance variables.
Messaging & Methods
Objects receive messages (methods).
Syntax:
[object methodName];
Functions
•
Group of statements for a task.
Two parts:
•
•
•
Declaration: Name, return type, parameters.
Definition: Actual code.
Functions are used as methods in class contexts.
Benefits
•
•
•
Mature & Stable – Long-standing, reliable language used in Apple development.
C Compatibility – Works seamlessly with C and C++ code.
Dynamic Runtime – Flexible features like message passing and method swizzling.
Disadvantages
•
•
•
Verbose Syntax
Outdated
Harder for Beginners
CONDITIONAL BRANCHING AND LOOPING STATEMENTS
Objective-C, like C, supports decision-making (branching) and repetition (looping) statements for
controlling program flow.
1. Conditional Branching Statements
Used to take decisions based on conditions.
I) if statement
if(age >= 18) {
NSLog(@"Eligible to vote");
}
II) if-else statement
if(score >= 50)
NSLog(@"Pass");
else
NSLog(@"Fail");
III) else-if ladder
if(marks >= 90)
NSLog(@"Grade A");
else if(marks >= 75)
NSLog(@"Grade B");
else
NSLog(@"Grade C");
IV) switch statement
switch(choice) {
case 1: NSLog(@"Apple"); break;
case 2: NSLog(@"Mango"); break;
default: NSLog(@"Invalid choice");
}
2. Looping Statements
Used to repeat a block of code multiple times.
I) for loop
for(int i=1; i<=5; i++) {
NSLog(@"Number %d", i);
}
II) while loop
int i = 1;
while(i <= 5) {
NSLog(@"%d", i);
i++;
}
III) do-while loop
int i = 1;
do {
NSLog(@"%d", i);
i++;
} while(i <= 5);
Advantages
•
•
•
Makes program flexible.
Saves time by avoiding repeated code.
Clear control flow for decisions and repetition.
Disadvantages
•
•
•
Too many conditions/loops = complex code.
Infinite loop risk if condition is wrong.
Hard to debug in large programs.
2. A. EXPLAIN EXCEPTION HANDLING AND MEMORY MANAGEMENT IN OBJECTIVE C
EXCEPTION HANDLING
An exception is a special condition (like an error) that interrupts normal program flow.
Examples:
•
•
•
Dividing by zero
Accessing an invalid array index
Calling an undefined method
Exception Handling in Objective-C
Objective-C uses 4 keywords (called compiler directives) to handle exceptions:
Keyword
@try
@catch
@throw
@finally
Purpose
Code that may cause an exception is placed here.
If an exception occurs in the @try block, it is caught here.
Used to manually raise (throw) an exception.
This block always runs, whether there is an exception or not.
Example Code:
#import <Foundation/Foundation.h>
int main () {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSMutableArray *array = [[NSMutableArray alloc] init];
@try {
NSString *string = [array objectAtIndex:10]; // This will cause an exception
}
@catch (NSException *exception) {
NSLog (@"Exception Name: %@", exception.name);
NSLog (@"Reason: %@", exception. reason);
}
@finally {
NSLog (@"@finally Always Executes");
}
[pool drain];
return 0;}
What This Does:
•
•
•
•
•
@try: Tries to get the 11th item in an empty array → will cause an exception.
@catch: Catches the exception and prints:
Exception name (like NSRangeException)
Reason (like “index 10 beyond bounds”)
@finally: Always runs and prints "@finally Always Executes"
MEMORY MANAGEMENT
•
•
•
On mobile devices, memory is limited.
If your app uses too much memory, it may crash or run slowly.
So, we need to make sure we release objects we no longer need.
What Is Object Ownership?
•
•
•
•
Objects are created and stored in memory.
Each object has a reference count (a number that tracks how many things are using it).
If the count becomes zero, the object is destroyed (freed from memory).
Objective-C uses manual memory management with reference counting, unlike languages
with automatic garbage collection.
Key Methods
Method
alloc
retain
release
autorelease
dealloc
Purpose
Creates an object and sets its reference count to 1. You own this object.
Increases the reference count. You want to keep the object.
Decreases the reference count. If it hits 0, the object is destroyed.
Defers the release until later, often at the end of the current loop.
Called automatically just before the object is destroyed — used to clean up.
ARC = Automatic Reference Counting
•
•
•
It works just like Manual Retain-Release (MRR), but the compiler does the memory work for
you.
You no longer need to write retain, release, or auto release manually.
ARC helps avoid memory leaks and crashes caused by human error.
Benefits of ARC
•
•
•
•
No manual memory management code needed.
Fewer bugs related to memory (like over-releasing or not releasing at all).
You focus on writing logic, not memory handling.
It’s enabled by default in Xcode.
ARC and @property Attributes
strong (default)
•
•
Keeps a strong (owning) reference to the object.
As long as the strong reference exists, the object won’t be destroyed.
weak
•
•
•
Holds a non-owning reference.
Used to avoid retain cycles (like between a parent and child object).
If the object is destroyed, the weak reference becomes nil automatically.
copy
•
•
Makes a copy of the object and owns it.
Useful for immutable objects like NSString, so changes to the original don't affect the copy.
B. EXPLAIN THE FAST ENUMERATION TYPES NSARRAYAND NSDICTIONARY
Fast enumeration is a way to loop over collections (like arrays or dictionaries) quickly and safely.
Why use it?
•
•
•
Faster than traditional for loops.
Cleaner and easier to read.
Safe: It prevents changes to the collection during the loop.
NSArray
•
•
•
NSArray is an ordered, immutable collection of objects.
You can’t add/remove items once it's created.
Defined with literal: @[@"One", @"Two", @"Three"]
Fast Enumeration:
for (NSString *item in myArray) {
NSLog(@"%@", item);}
Benefits:
•
•
•
Faster than for loop
Cleaner syntax
Safe against changes during iteration
NSDictionary
•
•
•
•
•
Key-Value Collection
NSDictionary stores key-value pairs.
Keys are like labels; values are the actual data.
Immutable; for editable version use NSMutableDictionary.
Defined with literal: @{@"key1": @"value1", @"key2": @"value2"}
Fast Enumeration:
for (NSString *key in myDict) {
NSLog(@"%@: %@", key, [myDict objectForKey:key]);}
Extra:
•
count returns number of key-value pairs.
3. EXPLAIN THE REQUIRED TOOLS FOR IOS APPLICATION DEVELOPMENT
Introduction
•
•
To develop applications for iOS using Objective-C or Swift, developers need specialized tools
provided by Apple.
These tools help in writing code, designing UI, debugging, testing, optimizing performance,
managing memory, and using pre-built libraries.
1. XCode
•
XCode is Apple’s official Integrated Development Environment (IDE) for iOS and macOS
application development.
Explanation:
•
•
•
•
Provides code editor, debugger, and compiler.
Includes Interface Builder for designing user interfaces.
Manages files, resources, and libraries.
Provides real-time error checking and suggestions.
Advantages:
•
•
•
•
All-in-one IDE (coding, designing, debugging).
Provides automatic error detection.
Integrated with Simulator and Instruments.
Supports Objective-C, Swift, C, C++.
Disadvantages:
•
•
•
Available only on macOS.
Requires high system resources.
Large size → takes time to install.
2. iOS Simulator
•
The iOS Simulator is a tool in XCode that emulates iPhone, iPad, or Apple Watch on a Mac.
Explanation:
•
•
•
Allows developers to test apps without needing physical devices.
Supports gestures like taps, rotation, and scrolling using keyboard/mouse.
Helps in quick UI testing.
Advantages:
•
•
•
Saves cost (no need for multiple physical devices).
Quick testing of different screen sizes (iPhone, iPad, etc.).
Easy to use from within XCode.
Disadvantages:
•
•
•
Cannot simulate all hardware features (camera, sensors).
Slower compared to real device.
May behave differently than actual devices.
3. Instruments
•
Instruments is a performance analysis and testing tool in XCode.
Explanation:
•
•
Profiles apps for CPU, memory, energy, and network usage.
Detects memory leaks and performance bottlenecks.
Advantages:
•
•
Helps optimize app performance.
Detects issues early in development.
Disadvantages:
•
•
Time-consuming for small/simple apps.
May slow down the system during profiling.
4. ARC (Automatic Reference Counting)
•
ARC is a memory management feature in Objective-C/Swift that automatically allocates and
deallocates memory for objects.
Explanation:
•
•
Tracks references to objects.
Frees memory when objects are no longer needed.
Advantages:
•
•
Improves app performance and efficiency.
Prevents most memory leaks automatically.
Disadvantages:
•
•
Adds small performance overhead.
Developer has less manual control.
5. Frameworks
•
A framework is a collection of pre-built libraries, header files, and resources used in
application development.
Explanation:
•
•
The Foundation framework provides basic classes like NSString, NSArray, NSDictionary.
Supports Unicode strings, persistence, object distribution.
Advantages:
•
•
Saves development time with pre-built classes.
Reduces redundancy by reusing tested code.
Disadvantages:
•
Large frameworks increase app size.
UNIT 4
1. EXPLAIN THE MVC ARCHITECTURE IN DETAIL
MVC is a design pattern used in iOS to organize code cleanly and separate data, UI, and logic.
1. Model
Stores data and handles business logic.
Responsibilities:
•
•
•
Encapsulates application state.
Reads/writes data (from database, files, or memory).
Notifies views/controllers of data changes (via Observer pattern).
Example:
@interface Student: NSObject
@property NSString *name;
@property int age;
@end
2. View
Visual elements users see and interact with.
Responsibilities:
•
•
•
Display data (from Model).
Send user interactions (like taps) to the Controller.
Never store or change data itself.
Example: UILabel, UIButton, UITableView.
UILabel *nameLabel = [[UILabel alloc] init];
nameLabel.text = student.name;
3. Controller
Acts as the middleman between Model and View.
Responsibilities:
•
•
•
Gets data from the model.
Updates the view with model data.
Responds to user input and updates model/view accordingly.
Example:
- (void)viewDidLoad {
student.name = @"Alice";
nameLabel.text = student.name;}
MVC Flow
•
•
•
User interacts with View → Controller receives input.
Controller updates Model → Model changes.
Model notifies View (via Observer) → View updates UI.
Internal Design Patterns in MVC
Pattern
Used In
Composite View
Strategy
Observer
Description
Views are made up of subviews (e.g. buttons
inside a view).
Controller Controller defines interaction behavior for views.
Model
Views/Controllers observe model changes.
ViewController Types in iOS
Controller Type
Responsibility
View Controller
Manages views and their interaction.
Model Controller
Manages model data, handles saving/loading.
Coordinating Controller Manages app flow (NSWindowController, etc.)
Example: Simple Student App (MVC)
Model:
@interface Student: NSObject
@property NSString *name;
@property int age;
@end
Controller:
- (IBAction)changeName {
student.name = @"Bob";
nameLabel.text = student.name;}
Advantages of MVC
•
•
Separation of concerns (UI, data, logic).
Easier to manage, test, and update.
Disadvantages
•
•
Can become massive View Controller (too much logic in controller).
Not suitable for highly dynamic apps without using extensions like MVVM.
2. CONSTRUCT THE IOS ARCHITECTURE LIFE CYCLE WITH NEAT EXAMPLES
iOS Architecture Life Cycle
•
iOS architecture is based on Model-View-Controller (MVC) design pattern and revolves around
the application life cycle, which defines how an app moves from launch to termination.
1. iOS App Architecture Overview
iOS apps are structured around:
•
•
•
UIKit Layer – UI components (Buttons, TableViews, Views)
Core Services Layer – Data management, networking (Core Data, URLSession)
Core OS Layer – Low-level services (File system, memory management)
MVC Pattern in iOS:
•
•
•
Model: Manages data (e.g., User model, Database)
View: User interface elements (e.g., UILabel, UIButton)
Controller: Mediates between Model and View (e.g., UIViewController)
2. iOS App Life Cycle
•
The iOS app life cycle consists of states the app goes through, managed by the
UIApplicationDelegate.
States of iOS App
•
•
•
•
•
Not Running – The app is not launched or terminated.
Inactive – App is in foreground but not receiving events (e.g., phone call).
Active – App is running in foreground and receiving events.
Background – App is in background, executing limited code.
Suspended – App is in memory but not executing code.
3. iOS Application Life Cycle Methods
Method
Purpose
application(_:didFinishLaunchingWithOptions:) Called on app launch.
Initialize app settings,
models, services.
applicationDidBecomeActive(_:)
App moves to Active
state. Restart paused
tasks.
applicationWillResignActive(_:)
App will go inactive
(incoming call). Pause
ongoing tasks.
applicationDidEnterBackground(_:)
App enters background.
Save data.
applicationWillEnterForeground(_:)
App is coming back to
foreground. Prepare UI.
applicationWillTerminate(_:)
App is terminating.
Clean up resources.
Example
Setting up Core Data stack,
configuring Firebase
Restarting animations,
refreshing UI
Pausing a game, stopping
timers
Saving user progress, stopping
location updates
Refreshing dashboard data
Saving unsaved data, closing
database connections
4. Example Walkthrough
Scenario: A music app
Launch: User taps the app → didFinishLaunchingWithOptions
Initialize music library, load last played track.
Active: App starts playing music → applicationDidBecomeActive
Start animations, enable play/pause buttons.
Interrupt: User receives a call → applicationWillResignActive
Pause music playback.
Background: User switches to another app → applicationDidEnterBackground
Save playback position, reduce CPU usage.
Return: User comes back → applicationWillEnterForeground
Restore UI, load recent playlist.
Terminate: User closes app → applicationWillTerminate
Save app state, release resources.
5. Diagram
Not Running
|
v
didFinishLaunchingWithOptions
|
v
Inactive <--> Active
|
^
v
|
Enter Background |
|
|
Suspended <------|
Terminate
3. DESCRIBE SQL-LITE AND GIVE AN EXAMPLE FOR THE FOLLOWING
SQLite is a lightweight, serverless, self-contained SQL database engine. Unlike traditional database
systems such as MySQL or PostgreSQL, SQLite does not require a server to run—it's just a simple .db
file stored locally.
It is highly efficient for:
•
•
•
Embedded systems (mobile apps, IoT devices),
Small to medium-sized applications,
Prototyping or educational use.
Why Choose SQLite?
•
•
•
•
No server needed: It’s embedded directly into the application.
Portable: The database is stored in a single file.
Zero configuration: No setup or administration.
Reliable and fast for read-heavy workloads.
Key Characteristics
Why Use SQLite in Mobile Development (iOS/Android)?
•
•
•
•
Ideal for local storage of structured data.
Does not need internet or server connection.
Very fast for read-heavy operations.
Supported natively in iOS (via Core Data/SQLite) and Android (via Room/SQLite).
Advantages
•
•
Lightweight and portable.
No server or configuration needed.
Disadvantages
•
•
Not suitable for concurrent multi-user applications.
Limited advanced features compared to full DBMS.
USING SQLITE FOR A SMALL BUSINESS INVENTORY SYSTEM
Scenario
Business Name: GreenMart
Need: GreenMart wants a simple system to track products, sales, and inventory levels without
setting up complex servers.
Objective
•
•
•
•
Build a lightweight local inventory system using SQLite that allows:
Adding new products.
Recording sales.
Viewing stock levels.
Database Design
Tables:
Products
product_id (INTEGER, Primary Key)
name (TEXT)
category (TEXT)
price (REAL)
quantity_in_stock (INTEGER)
Sales
sale_id (INTEGER, Primary Key)
product_id (INTEGER, Foreign Key)
quantity_sold (INTEGER)
sale_date (TEXT)
SQLite Implementation
1. Create Tables
CREATE TABLE Products (
product_id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
category TEXT,
price REAL NOT NULL,
quantity_in_stock INTEGER NOT NULL
);
CREATE TABLE Sales (
sale_id INTEGER PRIMARY KEY AUTOINCREMENT,
product_id INTEGER,
quantity_sold INTEGER,
sale_date TEXT,
FOREIGN KEY (product_id) REFERENCES Products(product_id));
2. Insert Sample Data
INSERT INTO Products (name, category, price, quantity_in_stock)
VALUES
('Green Apple', 'Fruits', 0.50, 100),
('Whole Milk', 'Dairy', 1.20, 50),
('Bread Loaf', 'Bakery', 2.00, 30);
3. Record a Sale
INSERT INTO Sales (product_id, quantity_sold, sale_date)
VALUES (1, 5, '2025-08-02');
-- Update stock
UPDATE Products
SET quantity_in_stock = quantity_in_stock - 5
WHERE product_id = 1;
4. Check Inventory
SELECT name, quantity_in_stock FROM Products;
Sample Output
name
quantity_in_stock
Green Apple
95
Whole Milk
50
Bread Loaf
30
Benefits Realized by GreenMart
•
•
•
•
Easy to use and manage without IT staff.
Can run on a basic laptop or tablet.
All data is stored locally in a .db file.
Perfect for daily inventory and sales tracking.
UNIT 5
1. EXPLAIN THE UI DESIGN GUIDELINES FOR WINDOWS PHONE 8
•
•
Windows Phone 8 is Microsoft’s mobile operating system, introduced as a successor to
Windows Phone 7.
Unlike its predecessor, it was built on the Windows 8 kernel, giving it better performance,
security, and support for modern hardware.
Key highlights of Windows Phone 8:
•
•
•
•
•
•
Modern UI (Metro design style): flat, clean, and content-focused interface.
Hardware support: multi-core processors, higher screen resolutions (up to 1080p), microSD
storage, NFC, GPS, and sensors.
Deep integration: with Microsoft services such as Office, OneDrive (SkyDrive), Xbox, and
Skype.
Windows Runtime (WinRT): replaced old technologies (Silverlight, XNA) and enabled
development with C++, C#, and .NET APIs.
Updates: GDR1, GDR2, and GDR3 introduced improvements like better IE, FM radio, 1080p
display support, and Bluetooth/Wi-Fi enhancements.
Developer tools: Visual Studio and Windows Phone SDK for building and testing apps using
emulator and device debugging.
Windows Phone 8 applications follow Microsoft Design Style (Metro UI), which is based on simplicity,
flat design, and content-first approach. The UI guidelines ensure consistency, usability, and familiarity
across devices.
The important UI elements and guidelines are:
1. App Bar (Command Bar)
•
•
•
•
•
•
•
Provides quick access to most common tasks (navigation, context actions).
Divided into:
“See more” (…) button → shows labels and overflow menu.
Content area (left aligned).
Primary commands (right aligned).
Overflow menu (secondary commands).
Example: A photo app bar with Edit, Share, Delete.
2. Buttons
•
•
•
•
Trigger immediate actions.
Defined in XAML:
<Button Content="Submit" Click="SubmitButton_Click"/>
Used for submitting forms, navigation, etc.
3. Check Boxes
•
•
Allow multiple selection with three states: selected, unselected, indeterminate.
Example: “I agree to terms and conditions” check box before submitting a form.
5. Date Picker
•
•
Standardized control for selecting localized dates.
Example: Selecting Date of Birth in a registration form.
4. Calendar View
•
•
•
Always visible calendar with month, year, and decade view.
User can pick single or multiple dates.
Example: Booking an event date.
6. Time Picker
•
•
Standardized control for selecting time values.
Example: Choosing arrival time in a travel app.
7. Dialogs
•
•
Transient UI elements for notifications, warnings, or confirmations.
Example: “Do you want to permanently delete this file?”.
8. Hyperlinks
•
•
Navigate user to another page, another app, or open a URI in browser.
Example: “Learn More” link opens documentation page.
9. Images
•
•
Display graphics using the Image control.
Example: <Image Width="200" Source="logo.png"/>
10. Radio Buttons
•
•
Allow single selection from multiple options.
Example: Choosing Gender → Male / Female.
11. Text Box
•
•
Allows text input (single or multiline).
Example: “Enter your name”.
12. Password Box
•
•
Conceals characters entered for privacy.
Example: Login screen password field.
13. Auto-Suggest Box
•
•
Provides suggestions while typing.
Example: Search box with auto-suggestions.
14. Labels
•
•
Display names or titles for controls.
Example: “Username” label above a textbox.
15. Toggle Switch
•
Represents ON/OFF states.
2. A. EXPLAIN THE WINDOWS APPLICATION LIFE CYCLE
•
•
The following image illustrates the lifecycle of a Windows Phone application. In this diagram,
the circles are application states.
The rectangles show either application- or page-level events where applications should
manage their state.
1. Launching Event
•
•
Raised when a new instance of an app is started (from Start screen, Apps list, toast
notification, etc.).
Should load the UI quickly. Heavy tasks (file I/O, network) should run on background threads.
2. Running State
•
•
•
After launch, the app is in Running state.
Continues until the user navigates away or lock screen engages.
Apps should not provide a manual “Exit” button.
3. OnNavigatedFrom Method
•
•
•
Called when user leaves a page (to another page or app).
App should store page state so it can be restored later.
Exception: Backward navigation → no need to save state.
4. Deactivated Event
•
•
•
Raised when user presses Start button, launches another app, or lock screen engages.
App should save unsaved data in State dictionary or Isolated Storage.
OS may terminate the app after deactivation.
5. Dormant State
•
•
•
After deactivation, app may be placed into Dormant state.
All threads stop, no processing happens, but app stays in memory.
If reactivated, state is preserved automatically (fast resume).
6. Tombstoned State
•
•
•
•
If memory is needed, dormant apps are tombstoned (terminated).
OS preserves navigation state + state dictionary.
Up to 5 apps can be tombstoned.
If relaunched, app restores state using preserved data.
7. Activated Event
•
•
•
•
Raised when a dormant or tombstoned app is restored.
IsApplicationInstancePreserved property:
true → app was dormant (state intact).
false → app was tombstoned (restore from dictionary).
8. OnNavigatedTo Method
•
•
Called when navigating to a page (new, existing, or restored).
If it’s a new instance, use state dictionary to restore UI.
9. Closing Event
•
•
•
•
Raised when user navigates back past the first page (app exits).
No state is preserved automatically.
Developer should save persistent data.
Must finish tasks within 10 seconds, otherwise app is terminated.
Advantages
•
•
•
•
•
Simple and clean Metro UI.
Smooth performance (fixed hardware rules).
Strong security (Windows 8 kernel).
Integration with Office, OneDrive, Xbox, Skype.
Supports multi-core processors, NFC, GPS, HD screens.
Disadvantages
•
•
•
•
•
Fewer apps compared to Android/iOS.
No customization by vendors.
Came late to market → low popularity.
Compatibility issues with old WP7 apps.
Later discontinued, no long-term support.
B. EXPLAIN SILVERLIGHT
•
•
•
•
•
A browser plug-in (like Flash) developed by Microsoft.
Cross-browser, cross-platform (runs on IE, Firefox, Safari, etc. on Windows & Mac).
Used for rich interactive apps: ads, animations, videos, games.
Write once, run everywhere.
Provides features not available in plain HTML/AJAX.
Versions of Silverlight
Silverlight 1.0 (2007):
•
•
First release (RTM Sept 2007).
Code-behind supported only in JavaScript.
Silverlight 1.1 / 2 (2007–2008):
•
•
•
•
Based on .NET Framework.
Introduced .NET languages like C# for coding.
Partial .NET class library support.
Silverlight 2 Beta released at MIX08 (2008).
Comparing Client Platforms
Desktop side:
•
•
WPF (Windows Presentation Foundation): For Windows desktop rich apps.
Another old tech: WinForms, Win32, Win16.
Web side:
•
•
•
Silverlight: Microsoft’s rich web app platform.
Flash/Flex: Adobe’s rich web platform.
HTML/CSS/JavaScript/AJAX: Open standards for web apps.
Silverlight vs WPF
WPF (Windows Presentation Foundation):
•
•
•
Runs only on Windows.
Requires large .NET runtime (50–200 MB).
Steeper learning curve.
Silverlight:
•
•
•
Cross-OS, cross-browser.
Lightweight (4–5 MB download).
Reduced features compared to WPF.
3. A. DESIGN AND ILLUSTRATE THE DISPLAY OF MAP WITH LANDMARKS AND PEDESTRIAN
FEATURES
•
•
A map in Windows mobile apps visually represents geographic data, helping users navigate
locations and view points of interest like landmarks and pedestrian paths.
The platform provides built-in controls to enhance user experience through interactive
mapping features.
Features Overview
•
•
•
Map Control: Enables displaying maps using XAML or C# code.
Landmarks: Special icons/notations for notable locations (e.g. hospitals, monuments), visible
at higher zoom (≥ 16).
Pedestrian Features: Public footpaths, stairs, walkways—useful for navigation by foot.
Step-by-Step Implementation
1. App Manifest Configuration
•
•
Before using the map features, enable the map capability:
Select ID_CAP_MAP in the app manifest file.MAD-Unit-5.pdf
2. XAML: Adding a Map Control
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<maps:Map x:Name="MyMap"
Center="13.0810,80.2740"
ZoomLevel="16"
LandmarksEnabled="true"
PedestrianFeaturesEnabled="true" />
</Grid>
Center: Sets the initial location (latitude, longitude).
ZoomLevel="16": Required for visible landmarks and pedestrian features.
LandmarksEnabled="true": Shows landmarks such as public buildings.
PedestrianFeaturesEnabled="true": Displays pedestrian-only features.MAD-Unit-5.pdf
3. C#: Configuring the Map in Code
using Microsoft.Phone.Maps.Controls;
using System.Device.Location;
// Create map and set location
Map MyMap = new Map();
MyMap.Center = new GeoCoordinate(13.0810, 80.2740);
MyMap.ZoomLevel = 16;
MyMap.LandmarksEnabled = true;
MyMap.PedestrianFeaturesEnabled = true;
ContentPanel.Children.Add(MyMap);
4. Visual Output
•
•
•
•
When implemented, the app displays:
Streets, buildings, and neighborhood data.
Landmarks indicated (e.g. colleges, historical sites) with custom icons.
Pedestrian features such as stairs, footpaths, and zebra crossings—useful for walking
directions.
Diagram for Illustration
Features:
•
•
•
•
•
•
•
•
Maps are created via XAML/C# using the Map control.
Landmarks and pedestrian features require zoom ≥ 16 for visibility.
Enable features through properties: LandmarksEnabled, PedestrianFeaturesEnabled.
Map control is customizable (center, zoom, cartographic mode).
Visual illustration should include sample icons for landmarks and pedestrian paths.
Helps users find prominent places (landmarks) and pedestrian navigation aids in cities.
Essential for tourism, local navigation, and accessibility.
Useful in apps for walking, exploring cities, or navigating large campuses.
B. EXPLAIN HOW TO CREATE YOUR APP PACKAGE
•
•
An App Package is a compressed file (with .appx or. appxupload extension) that contains
everything needed to install and run a Universal Windows Platform (UWP) app.
It is used for sideloading (internal testing) or for publishing to Microsoft Store.
Steps to Create an App Package
•
•
•
•
•
•
•
•
•
Open Solution – In Visual Studio, open your UWP app project.
Start Packaging – Right-click project → Store → Create App Packages.
Choose Upload Option – Select Yes (to build for Store submission).
Sign In – Sign in with your Windows Dev Centre developer account and reserve/select app
name.
Configure Architectures – Select x86, x64, ARM and choose Always generate bundle → creates
one. appxupload file.
Symbols – Optionally include PDB symbol files for crash analytics.
Create Package – Click Create → Visual Studio generates the app package.
Validation – Run Windows App Certification Kit (WACK) locally or remotely to test.
Publish – If passed, upload the. appxupload file from AppPackages\[AppName]\ to the
Windows Store.
Features
•
•
•
•
•
Contains app code, resources, and assets.
Cross-architecture support (x86, x64, ARM).
Produces a single app bundle for all devices.
Validated by Windows App Certification Kit.
Can be sideloaded for testing or published to Store.
Advantages
•
•
•
•
Easy distribution via Store.
Supports multiple device architectures in one package.
Validation ensures quality (WACK tests).
Can be sideloaded for testing before publishing.
Disadvantages
•
•
•
•
Requires a developer account to publish to Store.
Validation can fail if app doesn’t meet certification rules.
More complex process compared to normal desktop apps.
Without bundling, separate packages needed for each architecture
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )