Java Hyd Team
746 subscribers
986 photos
39 videos
670 files
690 links
https://teamhydteam.my.canva.site/

Can visit us on our website 😊
Still working on it 😊
Download Telegram
Do you guy's want to give a Java test regarding programming
Anonymous Poll
86%
Yes
14%
No
React programming and MCQ tests
Anonymous Poll
95%
Yes
5%
No
Sunday i will take test depending upon your response only without response no tests nothing
https://interview.leetcode.com/interview/detail/9v5GyT/ To minimize technical difficulties during the interview, please use a computer with a camera and microphone. Also, update to the latest version of Chrome.
java questions
Java Hyd Team
Do you guys need good Lpa or 3lpa is enough if yes ping us so that we can refer you for good package in next 10-15 day's
Out of 141 people 41 people voted for salary more than 3lpa ( good package) and you guy's are not joining for interview what you guy's are expecting
Why are you guys not attending this interview??
Random questions they are asking out of 18 questions
I think it's a good opportunity for you guys rest is all your choice
Java Hyd Team pinned Β«https://interview.leetcode.com/interview/detail/9v5GyT/ To minimize technical difficulties during the interview, please use a computer with a camera and microphone. Also, update to the latest version of Chrome.Β»
package com.Aman;
import java.util.Scanner;
public class Staircase {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Input: n = ");
int n = sc.nextInt();
sc.close();
System.out.println("Output: " + countWays(n));
}nth stair
static int countWays(int n){

if(n == 1)
return 1;
if (n == 2)
return 2;
return countWays(n - 1) + countWays(n - 2);
}
}
public class CountSubstrings {
public static int countSubstringsWithKDistinctChars(String str, int k) {
int count = 0;
int n = str.length();
for (int i = 0; i < n; i++) {
for (int j = i; j < n; j++) {
if (countDistinctChars(str.substring(i, j + 1)) == k)
count++;
}
}
return count;
}

public static int countDistinctChars(String str) {
int[] count = new int[256];
int distinctCount = 0;
for (int i = 0; i < str.length(); i++) {
if (count[str.charAt(i)] == 0)
distinctCount++;
count[str.charAt(i)]++;
}
return distinctCount;
}

public static void main(String[] args) {
String str = "abc";
int k = 2;
System.out.println("Number of substrings with exactly " + k + " distinct characters in " + str + " is "
+ countSubstringsWithKDistinctChars(str, k));
}
}
What Is A Single Page Application?
A Single Page Application (SPA) is a web application that is designed to be displayed as a single, static page.

This approach makes the application more user-friendly and easier to navigate, as users can see the entire application at once.

With a traditional web application, users are redirected to a new page every time they make a change to their data, which can be frustrating if they want to edit information in multiple places.

In contrast, SPA-based applications are completely focused on one thing at a time, allowing users to work through each step in a consistent manner.
πŸ‘1
Single Page Application vs Multi Page Application
Lets compare these two kinds of application;

Single Page Application
UI/UX: Single Page Applications (SPA) are a great way to create a fantastic user experience on mobile devices.

They consist of a single web page that loads all content using JavaScript. They request the markup and data independently and render pages straight to the browser.

Reloading: Single-page applications are web pages that only require a single HTML page to load.

They are generally used to perform actions that would take too long to load via traditional web pages, such as downloading files or rendering images.

A single-page application comprises HTML and JavaScript, usually including a server-side language (such as PHP) that processes data and returns the results.

Multiple Page Applications
UI/UX: Multi-page applications are helpful because they allow users to access more information in one place.

However, the user experience can be limited because the user must load multiple pages and navigate between them. This cannot be very clear to the user.

Reloading: The multi-page application (MPA) design pattern is a common approach to building web applications. It provides an easy way for users to navigate multiple pages without re-submit their data each time.

The example of MPA is our React Admin Dashboard Template

Advantages of SPAs
A single page application has several advantages over traditional web applications. Here are some of the most notable:

Simplicity: SPAs are easier to develop and maintain than traditional web applications. Developers only need to build a single HTML file for the SPA. No server-side changes are necessary.

Reusability: You can reuse the same JavaScript, CSS, and HTML code for multiple pages, and there are tools that allow developers to package these components into reusable modules.

Security: SPAs make it easier to secure web pages, because they can be protected by a firewall or require login credentials.
πŸ‘1
Creating Single Page Application With React
You have to follow the steps below for building a react single page application;

Use your desired location to create the react app with the command below;
npx create-react-app app-name
App-name directory to be built in the following default files:

app-name
β”œβ”€β”€ README.md
β”œβ”€β”€ node_modules
β”œβ”€β”€ package.json
β”œβ”€β”€ .gitignore
β”œβ”€β”€ public
β”‚ β”œβ”€β”€ favicon.ico
β”‚ β”œβ”€β”€ index.html
β”‚ β”œβ”€β”€ logo192.png
β”‚ β”œβ”€β”€ logo512.png
β”‚ β”œβ”€β”€ manifest.json
β”‚ └── robots.txt
└── src
β”œβ”€β”€ App.css
β”œβ”€β”€ App.js
β”œβ”€β”€ App.test.js
β”œβ”€β”€ index.css
β”œβ”€β”€ index.js
β”œβ”€β”€ logo.svg
β”œβ”€β”€ serviceWorker.js
└── setupTests.js
Execute the following command to install react-router-dom:
npm install react-router-dom
Wrapping The App Component
React Router has 2 types of routers: BrowserRouter and HashRouter. We’re using BrowserRouter in this example because it makes the URL’s look like example.com/about rather than example.com/#/about. React Router uses a hash (hash) at the end of the URL to determine what page to load.

You must include the code below in your src.index.js:

import React from "react"
import { render } from "react-dom"
import { BrowserRouter } from "react-router-dom"
import App from "./App"
render(
<BrowserRouter>
<App />
</BrowserRouter>,
document.querySelector("#root")
)
The following code should be used to create a file named src/pages/HomePage.js:
import React from "react";
export default function HomePage() {
return (
<>
<h1>Hey from HomePage</h1>
<p>This is your awesome HomePage subtitle</p>
</>
);
}
The following code should be used to create a file named src/pages/UserPage.js.
import React from "react";
import { useParams } from "react-router-dom";
export default function UserPage() {
let { id } = useParams();
return (
<>
<h1>Hello there user {id}</h1>
<p>This is your awesome User Profile page</p>
</>
);
}
Route and switch group all routes together to make sure that they take precedence over each other.
The following routes should be there in your App.js file:

import React from "react"
import { Route, Switch } from "react-router-dom"
// We will create these two pages in a moment
import HomePage from "./pages/HomePage"
import UserPage from "./pages/UserPage"
export default function App() {
return (
<Switch>
<Route exact path="/" component={HomePage} />
<Route path="/:id" component={UserPage} />
</Switch>
)
}
You can link to a page inside the SPA.
import React from "react"
import { Link } from "react-router-dom"
export default function HomePage() {
return (
<div className="container">
<h1>Home </h1>
<p>
<Link to="/your desired link">Your desired link.</Link>
</p>
</div>
)
}
πŸ‘1
When not to use single-page applications?
While SPA does have its advantages, there are certain cases when it is not suitable to use it:

SEO: It is difficult and tricky to optimize SPA for SEO since its content is loaded by AJAX (Asynchronous JavaScript and XML). Hence SPAs are not suitable for cases where SEO is critical for business success.
Javascript: It requires users to enable Javascript for proper application and action loading. So it is not suitable for instances where JavaScript might be disabled on the user side.
Security: SPA is also less secure in comparison to MPA, making it unsuitable for highly sensitive applications. SPA has a cross-site scripting (XSS) and allows attackers to inject client-side scripts into the web application.
Slow: While the user experience of SPAs on runtime is fast, it is slower to download and can also be slowed down if there are memory leaks in JavaScript. It is hence not suitable for very large applications with a lot of data.
πŸ‘1