0% found this document useful (0 votes)
5 views3 pages

Android Development Assignments Guide

The document outlines an Android assignment consisting of three tasks: implementing a Least Recently Used (LRU) Cache and a simplified HashMap, and developing a Book Review App using Java with specific architectural and feature requirements. Additionally, it includes a task to create a solar system visualization using OpenGL, detailing rendering, shader implementation, and user interaction. Each task has constraints and examples to guide implementation, with a submission deadline of three days and requirements for a GitHub repository with source code and documentation.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Android Development Assignments Guide

The document outlines an Android assignment consisting of three tasks: implementing a Least Recently Used (LRU) Cache and a simplified HashMap, and developing a Book Review App using Java with specific architectural and feature requirements. Additionally, it includes a task to create a solar system visualization using OpenGL, detailing rendering, shader implementation, and user interaction. Each task has constraints and examples to guide implementation, with a submission deadline of three days and requirements for a GitHub repository with source code and documentation.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

‭Android Assignment‬

‭Set 1‬
‭Try to solve any Three‬
‭ 1.‬‭Design and implement a Least Recently Used (LRU)‬‭Cache. A cache has a fixed capacity, and when it exceeds that capacity,‬
Q
‭it must evict the least recently used item to make space for the new one.‬
‭Implement the following operations:‬

‭‬
● ‭ et(key): Return the value of the key if it exists in the cache, otherwise return -1.‬
g
‭●‬ ‭put(key, value): Update or insert the value. If the cache is full, remove the least recently used item before inserting.‬

‭Function Signatures:‬
c‭ lass LRUCache {‬
‭public:‬
‭LRUCache(int capacity);‬
‭int get(int key);‬
‭void put(int key, int value);‬
‭};‬
‭Constraints:‬

‭‬
● ‭ <= capacity <= 3000‬
1
‭●‬ ‭0 <= key, value <= 10^4‬
‭●‬ ‭Maximum number of operations: 10^5‬
‭●‬ ‭All operations must be done in O(1) time complexity.‬

‭Example:‬
I‭ nput:‬
‭LRUCache lru(2);‬
‭[Link](1, 1);‬
‭[Link](2, 2);‬
‭[Link](1);‬
‭[Link](3, 3);‬
‭[Link](2);‬
‭[Link](4, 4);‬
‭[Link](1);‬
‭[Link](3);‬
‭[Link](4);‬

‭Q2.‬‭Problem Statement:‬
‭ ou are required to implement a simplified version of a HashMap (also known as an unordered map or dictionary), without using‬
Y
‭built-in hash table libraries like unordered_map, map, dict, or similar.‬

‭Design a data structure that supports the following operations in average-case O(1) time:‬

‭‬
● ‭ ut(key, value) → Insert or update the value by key.‬
p
‭●‬ ‭get(key) → Return the value associated with the key. If not found, return -1.‬
‭●‬ ‭remove(key) → Remove the key from the map.‬
‭Function Signatures:‬
c‭ lass MyHashMap {‬
‭public:‬
‭MyHashMap();‬
‭void put(int key, int value);‬
‭int get(int key);‬
‭void remove(int key);‬
‭};‬
‭Constraints:‬

‭‬
● ‭ ll keys and values are integers.‬
A
‭●‬ ‭0 <= key, value <= 10^6‬
‭●‬ ‭Keys are unique within the map.‬
‭●‬ ‭Maximum operations: 10^5\‬
‭●‬ ‭Do not use built-in hash maps or dictionaries.‬

‭Example:‬
I‭ nput:‬
‭MyHashMap obj;‬
‭[Link](1, 10);‬
‭[Link](2, 20);‬
‭[Link](1);‬
‭[Link](3);‬
‭[Link](2, 30);‬
‭[Link](2);‬
‭[Link](2);‬
‭[Link](2);‬

‭ 3.‬‭"You’ve been hired as a mobile developer for a‬‭startup building a Book Review App. Your task is to implement a minimum‬
Q
‭viable product (MVP) version of the app that allows users to browse, view details, and save books locally for offline access."‬
‭Requirements & Features:‬

‭1. Architecture (must use Java):‬

‭‬
● ‭ se either MVVM or Clean Architecture.‬
U
‭●‬ ‭Separation of layers: UI, domain, data.‬
‭●‬ ‭Use ViewModel, Repository, UseCase (if using Clean Architecture).‬

‭2. Core Features:‬

‭●‬ ‭Book List Screen‬


‭○‬ ‭Fetch list of books from a fake API (you can provide JSON file or a mock endpoint).‬
‭○‬ ‭Show title, author, and thumbnail.‬
‭●‬ ‭Book Detail Screen‬
‭○‬ ‭Show full description, rating, and image.‬
‭●‬ ‭Save to Favorites‬
‭○‬ ‭User can "favorite" a book.‬
‭○‬ ‭Saved books are stored using Room (SQLite).‬
‭●‬ ‭Offline Mode‬
‭○‬ ‭Bookmarked books can be viewed offline.‬

‭3. Tech Stack & Constraints:‬

‭‬
● J‭ ava only (no Kotlin).‬
‭●‬ ‭Use Retrofit for networking (or manual JSON parsing to test parsing skills).‬
‭●‬ ‭Room for persistence.‬
‭●‬ ‭LiveData or Observables for reactive UI.‬
‭●‬ ‭No external libraries for image loading (simulate loading via placeholders).‬

‭ 4.‬‭You are tasked with creating a mini solar system‬‭visualization using OpenGL (ES 2.0+ or 3.0) that demonstrates your‬
Q
‭understanding of the graphics pipeline, transformations, and shaders.‬
‭Requirements:‬

‭1.‬ ‭Render a simple solar system scene:‬


‭○‬ ‭A central Sun that remains static at the center.‬
‭○‬ ‭At least two planets orbiting the Sun at different speeds and distances.‬
‭○‬ ‭One of the planets must have a moon orbiting it.‬
‭1.‬ ‭Implement custom shaders:‬
‭○‬ ‭Write your own vertex and fragment shaders using GLSL.‬
‭○‬ ‭The Sun should use a shader-based glow or pulsing effect.‬
‭○‬ ‭Planets and moon can have textures or simple gradient coloring via shaders.‬
‭1.‬ ‭Apply transformations:‬
‭○‬ ‭Use matrix transformations to handle orbiting and rotation animations.‬
‭○‬ ‭Planets must rotate on their axis while orbiting the Sun.‬
‭1.‬ ‭User interaction:‬
‭○‬ ‭Implement camera controls:‬
‭■‬ ‭Rotate the view with mouse drag or touch input.‬
‭■‬ ‭Optional: Zoom in/out with mouse scroll or pinch.‬
‭1.‬ ‭Performance:‬
‭○‬ ‭The application should run smoothly (~30 FPS or higher).‬
‭○‬ ‭Use VBOs/VAOs or equivalent for rendering efficiency.‬

‭Submission Guidelines‬
‭Create a GitHub repository‬

‭Include all source code‬

‭Provide a comprehensive README‬

‭Submit repository link‬

‭Deadline:- 3 days‬

Common questions

Powered by AI

When implementing a HashMap from scratch, several considerations must be addressed: choosing an effective hash function to distribute keys uniformly for optimal performance, handling collisions through techniques like chaining or open addressing, and ensuring operations are executed in average-case O(1) time. Additionally, it's important to maintain dynamic resizing of the underlying array to handle load factors efficiently .

The recommended architectural design pattern for the development of a Book Review App is either the MVVM (Model-View-ViewModel) or Clean Architecture. They promote separation of concerns by organizing the code into distinct layers, improving testability and manageability. MVVM is particularly effective for binding user interfaces to models and handling dynamic data updates, while Clean Architecture further decouples the system's responsibilities into UI, domain, and data layers, enhancing maintainability and scalability .

Developing a cross-platform mobile application using OpenGL ES involves several challenges: ensuring compatibility with varying device capabilities concerning graphics processing power, managing performance optimizations to maintain smooth frame rates, and adhering to each platform's interaction models and input methods. Additionally, developers must write and manage shaders effectively, accommodate different screen resolutions, and ensure that the rendering process does not drain device resources excessively .

User interaction with a mini solar system visualization enhances the learning experience by allowing users to engage directly with the visualization, reinforcing their understanding of spatial transformations and user input handling. Implementing features like camera controls (rotate and zoom) offers learners practical experience with event handling, rendering dynamic scenes based on user input, and optimizes learning by providing immediate visual feedback based on interactions .

Using constant time complexity operations is essential in the design of an LRU Cache to maintain optimal performance especially under high workloads, like the maximum of 10^5 operations. This ensures quick retrieval and insertion of cache entries, thereby sustaining application responsiveness. Operations such as `get` and `put` must both execute in O(1) time which can be achieved by integrating a hash table for fast access and a linked list for tracking the order of items .

Java might be preferred over Kotlin for the Book Review App project due to several potential reasons: existing organizational expertise and resources focused on Java, the need for compatibility with older Android versions where Java support is guaranteed, existing Java-based legacy code integration, or simply to meet explicit project guidelines that mandate its use .

The Least Recently Used (LRU) Cache prioritizes the eviction of items based on their usage order. When the cache exceeds its fixed capacity, it evicts the least recently used item to make space for the new one. This is managed by keeping track of access order using data structures that support constant time complexity operations for access and updates, like a combination of a hash table and a double-ended queue (or linked list).

In an OpenGL mini solar system visualization, transformations apply mathematical operations to positions of celestial bodies, enabling them to animate. They include scaled, rotated, and translated matrix operations that simulate orbiting and rotational movements, ensuring that planets can rotate on their axes and orbit around the Sun realistically. These transformations are implemented in the graphics pipeline, often using shader programs to execute these calculations efficiently on the GPU .

Shader-based visual effects like a Sun's glow can be implemented using fragment shaders written in GLSL (OpenGL Shading Language). Shaders allow for dynamic changes in pixel properties to simulate lighting and glowing effects. The effect can be achieved by calculating the light intensity and attenuation based on distance from the center to produce a gradual decrease in brightness, optionally incorporating time-based variables to simulate pulsing. These computations are executed on the GPU for efficiency .

Room plays a critical role in managing data persistence by providing an abstraction layer over SQLite to allow for robust and efficient database access. It simplifies data handling and caching by managing local storage mechanisms, facilitating complex queries, and ensuring type safety and resource management efficiently. This enhances the application's ability to store and access 'favorited' books offline when implementing the Book Review App's features .

You might also like