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

Android Assignment Set 1

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)
16 views3 pages

Android Assignment Set 1

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);‬
‭lru.put(1, 1);‬
‭lru.put(2, 2);‬
‭lru.get(1);‬
‭lru.put(3, 3);‬
‭lru.get(2);‬
‭lru.put(4, 4);‬
‭lru.get(1);‬
‭lru.get(3);‬
‭lru.get(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;‬
‭obj.put(1, 10);‬
‭obj.put(2, 20);‬
‭obj.get(1);‬
‭obj.get(3);‬
‭obj.put(2, 30);‬
‭obj.get(2);‬
‭obj.remove(2);‬
‭obj.get(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‬

You might also like