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

Android Assignment Set 2

The document outlines four Android assignment questions, each requiring different programming tasks. Q1 involves solving the n-queens puzzle by returning distinct board configurations, Q2 requires checking for circular dependencies in a module loader, Q3 focuses on creating a GPU-accelerated particle system using OpenGL, and Q4 details the development of a weather tracking app with specific features and architecture. Each question includes constraints, examples, and specific requirements for implementation.
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)
4 views3 pages

Android Assignment Set 2

The document outlines four Android assignment questions, each requiring different programming tasks. Q1 involves solving the n-queens puzzle by returning distinct board configurations, Q2 requires checking for circular dependencies in a module loader, Q3 focuses on creating a GPU-accelerated particle system using OpenGL, and Q4 details the development of a weather tracking app with specific features and architecture. Each question includes constraints, examples, and specific requirements for implementation.
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 2
Try to Solve any Three.
[Link] n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other.
Given an integer n, return all distinct solutions to the n-queens puzzle. You may return the answer in any order.
Each solution contains a distinct board configuration of the n-queens' placement, where 'Q' and '.' both indicate a queen and an
empty space, respectively.
Example 1:
Input: n = 4
Output: [[".Q..","...Q","Q...","..Q."],["..Q.","Q...","...Q",".Q.."]]
Explanation: There exist two distinct solutions to the 4-queens puzzle as shown above
Example 2:
Input: n = 1
Output: [["Q"]]
Constraints:
1 <= n <= 9

Q.2 You are building a module loader for a large software system. Each module may depend on one or more other modules.
Before loading, you must ensure that the dependencies do not contain any circular dependency, as that would lead to infinite
loading loops.
Given a list of N modules and their dependency relationships, determine if the dependency graph contains a cycle.

Function Signature:
bool hasCircularDependency(int n, vector<vector<int>>& edges);
Input:

●​ An integer n representing the number of modules labeled from 0 to n - 1.


●​ A list of edges edges, where each edge[i] = {a, b} means module a depends on module b.

Output:

●​ Return true if there is a circular dependency, otherwise return false.​

Constraints:

●​ 1 <= n <= 10^4


●​ 0 <= [Link] <= 10^5
●​ Dependencies form a directed graph
●​ Self-dependencies like {a, a} are valid and considered a cycle
●​ The graph can have multiple disconnected components​

Example 1:
Input:
n=4
edges = {{0, 1}, {1, 2}, {2, 3}}
Output:
false
Example 2:
Input:
n=4
edges = {{0, 1}, {1, 2}, {2, 0}}
Output:
True

Q3. Create a GPU-accelerated particle system using OpenGL (ES 2.0+ or 3.0) that simulates a fireworks display or magical
energy burst. Your goal is to demonstrate knowledge of OpenGL rendering, shader programming, animation, and performance
optimization.

Requirements:

1.​ Particle System Basics:


○​ Spawn particles from a central point or burst area.
○​ Each particle should have:
■​ Position
■​ Velocity
■​ Color (can change over time)
■​ Lifetime (fade out and disappear)
1.​ Shader Usage:
○​ Use vertex and fragment shaders to render particles.
○​ Implement additive blending or other visual effects.
○​ Optionally use point sprites or textured quads for particles.
1.​ Animation:
○​ Particles should move over time based on velocity and gravity (optional).
○​ Color and opacity should transition over time.
1.​ Interactivity:
○​ Allow user to tap or click to trigger a new burst at that position.
○​ Optional: add controls to change number of particles, gravity, or colors.
1.​ Performance:
○​ Efficiently handle hundreds or thousands of particles.
○​ Use VBOs or instancing if supported.

Q4. "You are developing a simple app called WeatherTrack for users who want to track daily weather stats in their city. The app
fetches current weather from a fake/mock API, stores it locally every 6 hours, and displays a daily summary. Users can view stats
like temperature trends over the week."

Feature Requirements:
1. Fetch Weather

●​ Get weather data (temperature, humidity, condition) from a mock API (or static JSON).
●​ Each fetch saves a record in the local Room database with a timestamp.

2. Auto Background Sync

●​ Schedule a job using WorkManager that runs every 6 hours and fetches + saves weather.
●​ Allow manual refresh button in the app.

3. Weekly Summary Screen

●​ Displays a graph/list of temperature changes over the past 7 days.


●​ Click on a day to see detailed weather info.

4. App Architecture

●​ Java + MVVM (or Clean Architecture).


●​ Separate layers: ViewModel, Repository, Data source.

5. Error Handling

●​ Show user-friendly messages when:


○​ No internet
○​ API errors
○​ Database errors

Submission Guidelines
Create a GitHub repository

Include all source code

Provide a comprehensive README

Submit repository link

Deadline:- 3 days

You might also like