Question:
Given the following table schemas and requirements, write an SQL query to obtain a combined list of assets (bonds and stocks) with their total cash flows or dividends.
Schemas
Table bonds
id (INT, Primary Key): Unique identifier for each bond.
name (VARCHAR): Name of the bond.
Table bond_payments
id (INT, Primary Key): Unique identifier for each bond payment.
bond_id (INT, Foreign Key): ID of the bond (references bonds.id).
cash_flow (DECIMAL): Amount of cash flow for the bond.
Table stocks
id (INT, Primary Key): Unique identifier for each stock.
name (VARCHAR): Name of the stock.
Table stock_payments
id (INT, Primary Key): Unique identifier for each stock payment.
stock_id (INT, Foreign Key): ID of the stock (references stocks.id).
dividend (DECIMAL): Amount of dividend for the stock.
Requirements
Calculate the total cash flows for each bond and the total dividends for each stock.
Include only those bonds and stocks where the total cash flows or dividends are greater than $2000.00.
Combine the results for both bonds and stocks into a single result set.
Ensure that the results include the name of the asset, the type of asset (either 'Bond' or 'Stock'), and the total cash flows or dividends rounded to two decimal places.
Order the final result set by the name of the asset in ascending order.
SQL Query
Write an SQL query to meet the above requirements.
Given the following table schemas and requirements, write an SQL query to obtain a combined list of assets (bonds and stocks) with their total cash flows or dividends.
Schemas
Table bonds
id (INT, Primary Key): Unique identifier for each bond.
name (VARCHAR): Name of the bond.
Table bond_payments
id (INT, Primary Key): Unique identifier for each bond payment.
bond_id (INT, Foreign Key): ID of the bond (references bonds.id).
cash_flow (DECIMAL): Amount of cash flow for the bond.
Table stocks
id (INT, Primary Key): Unique identifier for each stock.
name (VARCHAR): Name of the stock.
Table stock_payments
id (INT, Primary Key): Unique identifier for each stock payment.
stock_id (INT, Foreign Key): ID of the stock (references stocks.id).
dividend (DECIMAL): Amount of dividend for the stock.
Requirements
Calculate the total cash flows for each bond and the total dividends for each stock.
Include only those bonds and stocks where the total cash flows or dividends are greater than $2000.00.
Combine the results for both bonds and stocks into a single result set.
Ensure that the results include the name of the asset, the type of asset (either 'Bond' or 'Stock'), and the total cash flows or dividends rounded to two decimal places.
Order the final result set by the name of the asset in ascending order.
SQL Query
Write an SQL query to meet the above requirements.
---
3. REST API: Top Articles
Query a REST API to get a list of articles. Given an integer limit, return the top limit article names ordered by decreasing comment count, and then by decreasing alphabetical order for articles with the same comment count.
To access the collection of articles, make an HTTP GET request to:http://jemack.hascheccnck.com/api/articles?page=<pageNumber>where <pageNumber> is an integer. The total_pages field in the JSON response indicates the total number of pages available.
The response is a JSON object with the following fields:
page: The current page of the results.
per_page: The maximum number of records returned per page.
total: The total number of records on all pages of the result.
total_pages: The total number of pages with results.
data: An array of objects containing the records returned on the requested page.
Each record in data has the following schema:
title: The title of the article, may be null.
url: The URL of the article.
author: The username of the author of the article.
num_comments: The number of comments the article has, may be null.
story_id: An identifier of the story related to the article, may be null.
story_title: The title of the story related to the article, may be null.
story_url: The URL of the story related to the article, may be null.
parent_id: Identifier of the parent of the article, may be null.
created_at: The date and time the record was created.
Requirements:
1. Retrieve the article name.
- If the title field is not null, use title.
- Otherwise, if the story_title field is not null, use story_title.
- If both fields are null, ignore the article.
2. Sort the articles first by num_comments in decreasing order. If there are ties, sort alphabetically in decreasing order by article name.
3. Return a list of the top limit article names.
Function Signature:
java
public static List<String> topArticles(int limit) throws IOException, InterruptedException, ParseException;
Input Format for Custom Testing:
An integer limit on the first line.
Sample Input for Custom Testing:
2
Sample Output:
UK Votes to Leave EU
FCC Repeals Net Neutrality Rules
Explanation:
The limit value is 2, so return the names of the top two articles based on the number of comments. The top articles are:
1. Title: "FCC Repeals Net Neutrality Rules", Comments: 1397
2. Title: "UK Votes to Leave EU", Comments: 2537
Their names are their titles because they are not null. The article with more comments is listed first. In case of ties in comment count, titles are sorted alphabetically in descending order.
---
3. REST API: Top Articles
Query a REST API to get a list of articles. Given an integer limit, return the top limit article names ordered by decreasing comment count, and then by decreasing alphabetical order for articles with the same comment count.
To access the collection of articles, make an HTTP GET request to:http://jemack.hascheccnck.com/api/articles?page=<pageNumber>where <pageNumber> is an integer. The total_pages field in the JSON response indicates the total number of pages available.
The response is a JSON object with the following fields:
page: The current page of the results.
per_page: The maximum number of records returned per page.
total: The total number of records on all pages of the result.
total_pages: The total number of pages with results.
data: An array of objects containing the records returned on the requested page.
Each record in data has the following schema:
title: The title of the article, may be null.
url: The URL of the article.
author: The username of the author of the article.
num_comments: The number of comments the article has, may be null.
story_id: An identifier of the story related to the article, may be null.
story_title: The title of the story related to the article, may be null.
story_url: The URL of the story related to the article, may be null.
parent_id: Identifier of the parent of the article, may be null.
created_at: The date and time the record was created.
Requirements:
1. Retrieve the article name.
- If the title field is not null, use title.
- Otherwise, if the story_title field is not null, use story_title.
- If both fields are null, ignore the article.
2. Sort the articles first by num_comments in decreasing order. If there are ties, sort alphabetically in decreasing order by article name.
3. Return a list of the top limit article names.
Function Signature:
java
public static List<String> topArticles(int limit) throws IOException, InterruptedException, ParseException;
Input Format for Custom Testing:
An integer limit on the first line.
Sample Input for Custom Testing:
2
Sample Output:
UK Votes to Leave EU
FCC Repeals Net Neutrality Rules
Explanation:
The limit value is 2, so return the names of the top two articles based on the number of comments. The top articles are:
1. Title: "FCC Repeals Net Neutrality Rules", Comments: 1397
2. Title: "UK Votes to Leave EU", Comments: 2537
Their names are their titles because they are not null. The article with more comments is listed first. In case of ties in comment count, titles are sorted alphabetically in descending order.
---
π2
### Question:
You are tasked with querying a REST API to get a list of articles and processing this data to obtain the top article names based on their comment count.
#### API Specification
Base URL: https://jsonmock.hackerrank.com/api/articles
Endpoint Format: https://jsonmock.hackerrank.com/api/articles?page=<pageNumber>
Response Schema:
json
{
"page": <current_page_number>,
"per_page": <number_of_records_per_page>,
"total": <total_number_of_records>,
"total_pages": <total_number_of_pages>,
"data": [
{
"title": <article_title>, // may be null
"url": <article_url>,
"author": <author_username>,
"num_comments": <number_of_comments>, // may be null
"story_id": <story_id>, // may be null
"story_title": <story_title>, // may be null
"story_url": <story_url>, // may be null
"parent_id": <parent_id>, // may be null
"created_at": <creation_datetime>
}
]
}
#### Requirements
1. Fetch and process the data from all available pages of the API.
2. For each article:
- Use the title if it is not null.
- If the title is null, use the story_title if it is not null.
- Ignore the article if both title and story_title are null.
3. Sort the articles by the number of comments in descending order.
4. If there is a tie in the number of comments, sort the articles alphabetically by their title in descending order.
5. Return the names of the top limit articles based on the above sorting criteria.
#### Function Signature
java
public static List<String> topArticles(int limit) throws IOException, InterruptedException, ParseException;
#### Input
An integer limit representing the number of top articles to return.
#### Output
A list of strings where each string is the name of an article, sorted according to the criteria specified.
---
You are tasked with querying a REST API to get a list of articles and processing this data to obtain the top article names based on their comment count.
#### API Specification
Base URL: https://jsonmock.hackerrank.com/api/articles
Endpoint Format: https://jsonmock.hackerrank.com/api/articles?page=<pageNumber>
Response Schema:
json
{
"page": <current_page_number>,
"per_page": <number_of_records_per_page>,
"total": <total_number_of_records>,
"total_pages": <total_number_of_pages>,
"data": [
{
"title": <article_title>, // may be null
"url": <article_url>,
"author": <author_username>,
"num_comments": <number_of_comments>, // may be null
"story_id": <story_id>, // may be null
"story_title": <story_title>, // may be null
"story_url": <story_url>, // may be null
"parent_id": <parent_id>, // may be null
"created_at": <creation_datetime>
}
]
}
#### Requirements
1. Fetch and process the data from all available pages of the API.
2. For each article:
- Use the title if it is not null.
- If the title is null, use the story_title if it is not null.
- Ignore the article if both title and story_title are null.
3. Sort the articles by the number of comments in descending order.
4. If there is a tie in the number of comments, sort the articles alphabetically by their title in descending order.
5. Return the names of the top limit articles based on the above sorting criteria.
#### Function Signature
java
public static List<String> topArticles(int limit) throws IOException, InterruptedException, ParseException;
#### Input
An integer limit representing the number of top articles to return.
#### Output
A list of strings where each string is the name of an article, sorted according to the criteria specified.
---
Java Hyd Team
https://forms.gle/zfTvn5FKrrJz3baa7
Accenture refferal form !!
Those who filled this form let me know if all of you received the referral link
Be prepared guys for the system design also as now every MNC is going to ask
Check out this job at BeamX TechLabs Private Limited: https://www.linkedin.com/jobs/view/4022678829
Linkedin
BeamX TechLabs Private Limited hiring Junior Software Engineer in Hyderabad, Telangana, India | LinkedIn
Posted 10:19:51 AM. Job Code:BTL-2409123Job Title: Junior Python DeveloperExperience: 6 months - 1 yearsLocation:β¦See this and similar jobs on LinkedIn.
Looking for Angular developer with 2+ year experience in my team expected hike 20-30% hike on CTC
https://docs.google.com/document/d/1eRaRvq_PnrliO1OhP9TiQ31I4WMCus0layBj3NaugU0/edit?usp=sharing
Daily Job Application Strategy
Follow these steps to maximize your job search on all platforms like Naukri, Indeed, Monster, etc.:
Use a Standard Resume Template
Choose a clean, professional resume template.
Apply the same resume to all job portals (Naukri, Indeed, Monster, etc.) for consistency.
Keep a Word and PDF version handy for quick uploads.
Daily Resume Upload
Naukri and other platforms prioritize recently updated resumes.
Log in daily and re-upload or update your resume on Naukri and all other portals to stay on top of searches.
Ensure your profile is 100% complete to increase visibility.
Maximize Daily Applications
Apply to the maximum daily limit of jobs on all platforms to improve your chances.
Platforms like Naukri have daily application limits, so make sure you hit them every day.
Apply Relevant Experience Filters
Use precise filters related to your experience (e.g., 2-4 years, 5-7 years).
Set job roles, industry, and skills that align with your profile to filter out irrelevant roles.
Sort by Freshness & Apply to Recent Jobs
Always sort by "Freshness" on job portals.
Prioritize jobs posted within the last 15 days, with a focus on:
Last 7 days
Last 3 days
Yesterday
Applying early boosts your chances of getting noticed before the job is saturated with applicants.
Track Applications
Maintain an Excel sheet or Google Sheet to track:
Job title
Company name
Date of application
Job portal used
Any follow-ups required
This helps avoid applying for the same position twice and keeps your process organized.
Daily Job Application Strategy
Follow these steps to maximize your job search on all platforms like Naukri, Indeed, Monster, etc.:
Use a Standard Resume Template
Choose a clean, professional resume template.
Apply the same resume to all job portals (Naukri, Indeed, Monster, etc.) for consistency.
Keep a Word and PDF version handy for quick uploads.
Daily Resume Upload
Naukri and other platforms prioritize recently updated resumes.
Log in daily and re-upload or update your resume on Naukri and all other portals to stay on top of searches.
Ensure your profile is 100% complete to increase visibility.
Maximize Daily Applications
Apply to the maximum daily limit of jobs on all platforms to improve your chances.
Platforms like Naukri have daily application limits, so make sure you hit them every day.
Apply Relevant Experience Filters
Use precise filters related to your experience (e.g., 2-4 years, 5-7 years).
Set job roles, industry, and skills that align with your profile to filter out irrelevant roles.
Sort by Freshness & Apply to Recent Jobs
Always sort by "Freshness" on job portals.
Prioritize jobs posted within the last 15 days, with a focus on:
Last 7 days
Last 3 days
Yesterday
Applying early boosts your chances of getting noticed before the job is saturated with applicants.
Track Applications
Maintain an Excel sheet or Google Sheet to track:
Job title
Company name
Date of application
Job portal used
Any follow-ups required
This helps avoid applying for the same position twice and keeps your process organized.
Google Docs
Kanhaiya_Resume
Kanhaiya Ramlal Dharu JAVA FULL-STACK DEVELOPER Nanded, Maharashtra 431006 9075780974 officialkanhaiya121@gmail.com EXPERIENCE InfoSpoke Integrated Solutions, Hyderabad β Java Developer SEP 2024 - PRESENT Working on microservices-based architecture in theβ¦