Nothing Special   »   [go: up one dir, main page]

Important Questions

Download as pdf or txt
Download as pdf or txt
You are on page 1of 45

Full Stack Development

1. a. Explain how digital transformation has brought revolution in teaching learning


process with an example.

 Digital transformation in the education industry helps improve the learning experience
for both students and teachers, as well as other people involved in the process.
 Such changes focus on improving engagement and accessibility through interactive and
customizable learning.
 As a result, online education gets cheaper, more comprehensive, and more inclusive.
Managing admissions
 Uploading your enrollment application to universities or schools online is more
convenient.
 You pick all the institutions of interest and send the respective documents at once.
 This is a time-savvy option that wouldn't just accept your documents but also process
them faster.
Minimizing risks
 Whether a child is sick or the classes were canceled due to harsh weather conditions,
online learning can handle it all.
 Now, to maintain excellent attendance rates and not miss an important lesson, you can
simply click on the "Join" button of the meeting tool or just read through the material
uploaded on the cloud.
Improving learning outcomes
 With interactive lessons and implementing high-tech solutions, you can motivate students
and, as a result, improve their learning skills.
 The more attention they pay to what's going on, the more relevant information they'll be
able to absorb at once.
Evaluating performance
 Students will get faster access to tests and their grades through online systems.
 E-learning systems allow submitting papers, doing instant plagiarism checks, and
tracking attendance.
 All these factors form students' performance levels that you can easily measure via a
digital platform.

Dept. of CSE, JSSPM Page 1


Full Stack Development

1. b. Diagnostic imaging procedures are cutting-edge technology, but at the same time they
are an unpleasant experience for patients – and even more for paediatric patients. Explain
how design thinking helped Doug Dietz, an industrial designer, create a scanner experience
that children loved.

 Diagnostic imaging has revolutionized healthcare, yet GE Healthcare saw a problem in


how pediatric patients reacted to procedures.
 Many children were observed crying during long procedures in cold, dark rooms with
flickering fluorescent lights.
 Considering this, GE Healthcare’s team observed children in various environments,
spoke to experts, and interviewed hospital staff to gain more insight into their
experiences.
 After extensive user research, hospital pilots, and reiteration, GE Healthcare launched the
“Adventure Series.” This redesign initiative focused on making magnetic resonance
imaging (MRI) machines more child-friendly.
 For example, the “Pirate Adventure” transforms MRI machines from dark, black holes to
pirate ships with scenery of beaches, sandcastles, and the ocean.
 By empathizing with children’s pain points, GE Healthcare was able to craft a creative
solution that was not only fun but increased patient satisfaction scores by 90 percent.
 This also yielded unexpected successes, including improved scan quality of pediatric
patients, and ultimately saved customers time and resources.

2. a. Identify the tasks involved in the process of receiving Admission Ticket for semester
exams in your college. Which of the identified tasks can be automated and illustrate
automation of one task
Identified task in the process of receiving Admission Ticket
1. Student Register:
To register students have to just provide their Personal Details like Name, Address,
Phone No, etc., and a photo, to the enroll himself into the System.

Dept. of CSE, JSSPM Page 2


Full Stack Development

2. Admin Login:
Admin can view who has enrolled into the system, and can see all the new enrollment
on his login
3. Send Email:
After creating the hall ticket, the system mails the link of soft copy to every student
who have registered.

4. Student Login:
Students can use their credentials provided by admin to login into the system

5. View and Update Details:


System allows registered students to view and modify/update the personal details like
Phone number, email-id, etc.

Automation of Student Registration

1. Automation of Registration Process

 Automation of Admission Form


 Students can fill Admission Form on Mobile App, Web, Tablet
 Ability to Edit Application Form for Correction
 Accept Enrollment Documents like mark-sheet, certificate, category documents online

2. Accept Form Fee Online

 Support to Accept Form Fee Online using Credit/ Debit Card/ Mobile Wallets/ UPI
 Instant Generation of Form Fee Receipt

3. Accept Course Fee Online

 Automatically issue Admission Acceptance Based on Academic


 Accept Course Fee Online
 Get Detailed Analysis of Online Fee Payment

Dept. of CSE, JSSPM Page 3


Full Stack Development

2. b. Identify the following cloud service types and list their characteristics and advantages.
Cisco WebEx Google App Engine, Amazon EC2.

Cisco WebEx
Cisco Webex Meetings is a software-as-a-service (SaaS)

Google App Engine


Google App Engine in cloud computing is a PaaS, Platform as a Service model.

Amazon EC2
Amazon Elastic Compute Cloud (Amazon EC2) is a good example of IaaS.

Characteristics of PaaS
 PaaS offers browser based development environment. It allows the developer to create
database and edit the application code either via Application Programming Interface or
point-and-click tools.
 PaaS provides built-in security, scalability, and web service interfaces.
 PaaS provides built-in tools for defining workflow, approval processes, and business
rules.
 It is easy to integrate PaaS with other applications on the same platform.
 PaaS also provides web services interfaces that allow us to connect the applications
outside the platform.

Advantages

Dept. of CSE, JSSPM Page 4


Full Stack Development

 Lower administrative overhead


 Lower total cost of ownership
 Scalable solutions
 More current system software

Characteristics of IaaS
 On-demand availability of resources.
 Allows to store copies of particular data at different locations.
 The computing resources can be easily scaled up and down.
 Highly flexible and highly scalable.
 Accessible by multiple users.
 Cost-effective.

Advantages
 Full control of the computing resources through administrative access to VMs.
 Flexible and efficient renting of computer hardware.
 Portability, interoperability with legacy applications.

Characteristics of SaaS
 SaaS makes the software available over the Internet.
 The software applications are maintained by the vendor.
 The license to the software may be subscription based or usage based. And it is billed on
recurring basis.
 SaaS applications are cost-effective since they do not require any maintenance at end user
side.
 They are available on demand.
 They can be scaled up or down on demand.
 They are automatically upgraded and updated.
 SaaS offers shared data model. Therefore, multiple users can share single instance of
infrastructure. It is not required to hard code the functionality for individual users.

Dept. of CSE, JSSPM Page 5


Full Stack Development

Advantages
 Modest software tools
 Efficient use of software licenses
 Centralized management and data
 Platform responsibilities managed by provider
 Multitenant solutions

3. a. eCab is an online Cab booking application that helps its users to book cab across
Karnataka. This application allows users to log in for eCab Application. Users can find the
cab in a specific locality. Once found, user can check the availability of a cab for specific
dates and time. Users can book a cab for required duration. Once booked, user can get the
booking details. Identify and write the user stories for this application.

User story

Summary: Booking cab

Description:

As a customer

I want to have a cab booking functionality

So that I can successfully book a cab and use infycab application

“scope”

Build a cab booking page

Customer validation

Customer should be able to choose vehicle type

It should work in all the browsers

It should also work in mobile

Dept. of CSE, JSSPM Page 6


Full Stack Development

Pre condition:

Customer should have registered or login in a infycab software

Acceptance criteria:

Scenario 1: Customer can successfully book a cab

Given I am on booking cab page

To start a ride and enter my pickup location

I need to mention the complete address

Else I can enable the location access in my mobile

After that , I enter my drop location

Then I can successfully book a cab

Scenario 2: Customer can’t successfully book a cab

Given I am on booking cab page

To start a ride and entered my incorrect pickup location

And I did not to mention the complete address

Else I can disable the location access in my mobile

I didn’t mention the drop location

Then I can’t successfully book a cab

Summary: Get booking details

Description:

As a customer

I want to have a get booking details functionality

Dept. of CSE, JSSPM Page 7


Full Stack Development

So that I can successfully confirm the riding information

“scope”

Build a get booking details page

Check the availability of vehicle

Customer should able to get confirmation of the driver and its details on our mobile

Pre condition:

Customer should able to choose the form of ride.

Scenario 1: Customer can get booking details

Given I am on booking details page

I need to selecting a cab ,there will be two options to choose from ride later and ride now option

I will instantly get confirmation details

Scenario 2: Customer cannot get booking details

Given I am on booking details page

I didn’t select the two form of rides option

And I didn’t enter any correct information on booking cab page

Then I didn’t receive the booking details information

Summary: cancel booking

Description:

As a customer

I want to have a cancel booking functionality

So that I can successfully cancel the booking cabs in infycabs software

Dept. of CSE, JSSPM Page 8


Full Stack Development

“scope”

Build a cancel booking page

Customer should be able to cancel the booking cab

It works on any browser and also mobiles

Scenario 1: Customer can successfully cancel booking cab

Given I am on booking cancel page

Tap on the cancel ride option

Then I select a reason for cancellation

And I receive the cancellation message like “your booking with “xxxx” has been cancelled
successfully

3. b. Write test cases for the above application

Test
Test Case Actual Pass/
Case Test Steps Test Data Expected Results
Description Results Fail
ID
TU01 Check Customer Go to App Userid = guru99 User should Login As Expected
Login with valid Enter UserId Password = into an application
Data Enter Password pass99 Pass
Click Submit

TU02 Check Customer Go to App Userid = guru99 User should not As Expected
Login with invalid Enter UserId Password = Login into an
Data Enter Password glass99 application Pass
Click Submit

TU03 Check Cab Select Specific Location: Select User can get As Expected
Availability for Location current location Facility
Pass
Specific Location within
Karnataka

Dept. of CSE, JSSPM Page 9


Full Stack Development

TU04 Check Cab Select Specific Location: Select User cannot get As Expected
Availability for Location current location Facility
Pass
invalid Location outside
Karnataka
TU05 Check a Cab for Enter Specific Location: Select User can book cab As Expected
desired location & Location destination Successfully
Date Select Specific Date location within Pass
& Time Karnataka
Mention Date
TU06 Check a Cab for Enter Specific Location: Select User cannot book As Expected
desired location & Location destination cab Successfully
required Date Enter Specific Date
location outside Pass
& Time Karnataka
Mention Date
4.a. Myntra is an online shopping application that helps its users to buy variety of
products. This application allows users to log in for buying product. Users can search for a
product, sort the product list based on rating or price. Users can select the items and add
them to the cart. Once the selection is done, users can go to the cart page for payment.
Identify and write the user stories for this application.

Note: Students can assume and write the user stories for above application

4. b. Write test plan and test cases for the above application.
1. Analyze the product:
2. Design the Test Strategy
3. Define the Test Objectives
4. Define Test Criteria
5. Resource Planning
6. Plan Test Environment
7. Schedule & Estimation
8. Determine Test Deliverables

Test Test Case Actual Pass/


Test Steps Test Data Expected Results
Case Description Results Fail

Dept. of CSE, JSSPM Page 10


Full Stack Development

ID

TU01 Check Customer Go to App Userid = guru99 User should Login As Expected Pass
Login with valid Enter UserId Password = into an application
Data Enter Password pass99
Click Submit
TU02 Check Customer Go to App Userid = guru99 User should not As Expected Pass
Login with invalid Password = Login into an
Enter UserId
Data glass99 application

Enter Password

Click Submit
TU03 Check for product Enter product name Product name User can view As Expected Pass
Availability Sort based on price =XYZ products
&ratings based on price
Click Submit and rating
TU04 Check for Un Enter product name Product name Products not found As Expected Pass
Available product Click Submit =XYZ

5 a. Create a Spring Boot application to maintain Patient details such as Pid, Patient name,
Address and perform the following database operations.

 Insert a new patient detail


 Remove patient details based on pid
 Search patient based on name or pid

Patient.java
//import required packages and dependencies
@Entity

Dept. of CSE, JSSPM Page 11


Full Stack Development

@Table(name="patient")
public class Patient
{
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long pid;
private String pname;
private String paddress;

public Patient() {
}
// Call Getter & Setter
// Call Constructor
}

PatientRepository.java
//import required packages and dependencies
@Repository
public interface PatientRepository extends JpaRepository<Patient,Long>
{
}

PatientController.java
//import required packages and dependencies
@RestController
@RequestMapping("/patient")
public class PatientController
{
@Autowired

Dept. of CSE, JSSPM Page 12


Full Stack Development

private PatientRepository patientRepo;

@GetMapping
public List<Patient> getAllPatient()
{
return this.patientRepo.findAll();
}

@GetMapping("/{id}")
public User getPatientById(@PathVariable(value="id") long pId) {
return this.patientrRepo.findById(pId).orElseThrow();
}

@PostMapping
public Patient createPatient(@RequestBody Patient patient)
{
return this. patientRepo.save(user);
}

@PutMapping("/{id}")
public Patient updatePatient(@RequestBody Patient patient,@PathVariable("id") long
pId)
{
Patient p=this. patientRepo.findById(pId).orElseThrow();
p.setPname(patient.getPname());
p.setPaddress(patient.getPaddress());
return this. patientRepo.save(p);
}

@DeleteMapping("/{id}")
public ResponseEntity<Patient> deletePatient(@PathVariable("id") long pId)

Dept. of CSE, JSSPM Page 13


Full Stack Development

{
Patient p=this. patientRepo.findById(pId).orElseThrow();
this. patientRepo.delete(ex);
return ResponseEntity.ok().build();
}
}

b. Build user authentication flow and authorization using Spring Security


SecurityController.java

//import required packages and dependencies

@RestController
public class SecurityController
{
@GetMapping("/")
public String welcome() {
return ("<h1>Hello Everyone, Welcome to SpringBoot Security</h1>");
}
@GetMapping("/user")
public String welcomeUser() {
return ("<h1>Hello User, Welcome to SpringBoot Security</h1>");
}
@GetMapping("/admin")
public String welcomeAdmin() {
return ("<h1>Hello Admin, Welcome to SpringBoot Security</h1>");
}
}
SecurityConfiguration.java
//import required packages and dependencies

@SuppressWarnings("deprecation")

Dept. of CSE, JSSPM Page 14


Full Stack Development

@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter
{
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("Gagan").password("ABC").roles("USER")
.and().withUser("Deep").password("XYZ").roles("ADMIN");
}

@Bean
public PasswordEncoder getPasswordEncoder() {
return NoOpPasswordEncoder.getInstance();
}

@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/admin").hasRole("ADMIN")
.antMatchers("/user").hasAnyRole("USER","ADMIN")
.antMatchers("/").permitAll()
.and().formLogin();
}
}
6 a. Create a Feedback form using React Js

Home.js
import { useState } from 'react';
import './App.css';
export default function Form()
{
const [name, setName] = useState('');
const [regno, setRegno] = useState('');

Dept. of CSE, JSSPM Page 15


Full Stack Development

const [feedback, setFeedback] = useState('');


const [submitted, setSubmitted] = useState(false);

const handleName = (e) => {


setName(e.target.value);
};

const handleRegno = (e) => {


setRegno(e.target.value);
};

const handleFeedback = (e) => {


setFeedback(e.target.value);
};

const handleSubmit = (e) => {


e.preventDefault();
if (name === '' || regno=== '' || feedback === '') {
alert("Please enter all the fields");
} else {
setSubmitted(true);
}
};
// Showing success message
const successMessage = () => {
if(submitted)
return (
<div className="success" >
<h1>User {name} feedback successfully recorded</h1>
</div>
);

Dept. of CSE, JSSPM Page 16


Full Stack Development

};
return (
<div className="form">
<div>
<h1>Student Feedback Form</h1>
</div>
{/* Calling to the methods */}
<div className="messages">
{successMessage()}
</div>
<form>
<label className="label">Name</label>
<input className="input" value={name} type="text"
/><br></br>
<label className="label">Regno</label>
<input className="input" value={regno} type="text"
/><br></br>
<label className="label">Feedback</label>
<input className="input" value={feedback} type="text"
/><br></br>
<button className="btn" type="submit">
Submit
</button>
</form>
</div>
);}
b. Compare the database communication through JDBC and ORM.

Database communication through JDBC


1. Import the Packages
2. Register the drivers using DriverManager
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver())

Dept. of CSE, JSSPM Page 17


Full Stack Development

3. Establish a connection using the Connection class object


Connection con = DriverManager.getConnection(url,user,password)
4. Create a statement
Statement st = con.createStatement();
5. Execute the query
// user Queries
String sql = "select * from emp";
6. Close the connections
con.close();
Database communication through ORM
Step1: Create a new maven project
Step2: Add required Dependencies:
Spring Web, Spring Data JPA, MySQL Driver
Step3: Create 3 Packages and 3 class with the following names entity, controller and
repository
Step4:
Create User.java class use appropriate annotations
public class User {
private int id;
private String name;
}
Create Usercontroller.java use appropriate annotations
public class Usercontroller {
private UserRepository userRepository;
public List<User> getAllUser()
{
return this.userRepository.findAll();
}}
UserRepository.java interface use appropriate annotations
public interface UserRepository extends JpaRepository<User,Long>{
}

Dept. of CSE, JSSPM Page 18


Full Stack Development

Step5: Write your database connection string with in application.properties file


spring.datasource.url=jdbc:mysql://localhost:3306/emp
spring.datasource.username=root
spring.datasource.password=root
spring.jpa.hibernate.ddl-auto = update

7.a. Illustrate the use of different annotation used in spring boot application.

Annotations
Annotations are used to provide supplemental information about a program.
 Annotations start with ‘@’.
 Annotations help to associate metadata (information) to the program elements i.e. instance
variables, constructors, methods, classes, etc.
 Annotations basically are used to provide additional information, so could be an alternative
to XML and Java marker interfaces.
Spring Annotations List
@Service: Annotate all your service classes with @Service. All your business logic should
be in Service classes.
@Service
public class CompanyServiceImpl implements CompanyService {
...
}
@Repository: Annotate all your DAO classes with @Repository. All your database access
logic should be in DAO classes.
@Repository
public class CompanyDAOImpl implements CompanyDAO {
...
}

Dept. of CSE, JSSPM Page 19


Full Stack Development

@Component: Annotate your other components (for example REST resource classes) with
@Component
@Component
public class ContactResource {
...
}

@Autowired: Let Spring auto-wire other beans into your classes using @Autowired
annotation.
@Service
public class CompanyServiceImpl implements CompanyService {
@Autowired
private CompanyDAO companyDAO;
}
@Transactional: Configure your transactions with @Transactional spring annotation.
@Service
public class CompanyServiceImpl implements CompanyService {
@Autowired
private CompanyDAO companyDAO;
@Transactional
public Company findByName(String name) {
Company company = companyDAO.findByName(name);
return company;
}
}
@Scope: To change default behavior, use @Scope spring annotation.
@Component
@Scope("request")
public class ContactResource {
}

Dept. of CSE, JSSPM Page 20


Full Stack Development

7.b. Converting monolithic application to microservices architecture.

Step 1: Split the code.


Step 2: Split the database.
Step 3: Define a standalone Delivery Service.
Step 4: Use the standalone Delivery Service.
Step 5: Remove the delivery management functionality from the FTGO monolith.
Step 1: Split the code

The first step is to split the code and convert delivery management into a separate, loosely
coupled module within the monolith.

Step 2: Split the database

Dept. of CSE, JSSPM Page 21


Full Stack Development

The second step is split the database and define a separate database schema for the ftgo-
delivery-service module.

Step 3: Define a standalone Delivery Service

The third step of the refactoring process is to define a standalone Delivery Service and deploy
it. The service does not, however, handle production traffic. Instead, it can, for example, be
tested in production.

Step 4: Use the standalone Delivery Service

The fourth step of the refactoring process is to use the standalone Delivery Service.

Dept. of CSE, JSSPM Page 22


Full Stack Development

Step 5: Remove the delivery management functionality from the FTGO monolith

The fifth step of the refactoring process is to remove the now obsolete delivery management
logic from the monolith.

8.a. Create a RESTcontroller class to perform CRUD operations on product and


corresponding request and response DTOs. The product class should contain three data
members product name, product category, price. Use proper SpringBoot annotations.
Note: Create Rest API for Product
8.b. Writing Junit test cases for CRUD operations.
Download JUnit from https://junit.org/junit4/
Goto download & install
Find Plain-old Jar & Download the following
 junit.jar
 hamcrest-core.jar
 Create a folder in any drive by giving relevant name, copy and paste both jar files to the
folder.
 Create a project in eclipse
 Right click on project select build path, click on configure build path
 Select java build path, Click on Libraries and click on class path in libraries, go to Add
External JAR’s, select junit.jar and hamcrest-core.jar files, click on apply and then apply
and close.
 Goto src/test/java folder find default package and Testclass
 Write the below code

Dept. of CSE, JSSPM Page 23


Full Stack Development

// Import required packages & Dependencies


@SpringBootTest
class SpringbootFirstAppApplicationTests {
@Autowired
UserRepository userRepo;
@Test
public void testCreate()
{
User u=new User();
u.setId(3L);
u.setFirstname("Kavya");
u.setLasttname("shree");
userRepo.save(u);
}
@Test
public void testReadAll()
{
List<User> list=userRepo.findAll();
assertThat(list).size().isGreaterThan(0);
}
@Test
public void testUpdate()
{
User u=userRepo.findById(902L).get();
u.setFirstname("Murthy");
userRepo.save(u);
assertNotEquals("Niranjan",userRepo.findById(902L).get().getFirstname());
}
@Test
public void testDelete()
{
userRepo.deleteById(852L);
assertThat(userRepo.existsById(852L)).isFalse();

Dept. of CSE, JSSPM Page 24


Full Stack Development

}
}

9 a. Discuss the Components of Docker container.

Docker container
Docker containers are the live, running instances of Docker images. While Docker images are
read-only files, containers are life, ephemeral, executable content. Users can interact with them,
and administrators can adjust their settings and conditions using Docker commands.

Docker client
Docker client is an application for Mac or Windows that includes Docker Engine, Docker CLI
client, Docker Compose, Kubernetes, and others. It also includes access to Docker Hub.

Docker daemon
Docker daemon is a service that creates and manages Docker images, using the commands from
the client. Essentially Docker daemon serves as the control center of your Docker
implementation. The server on which Docker daemon runs is called the Docker host.

Docker image
Docker images contain executable application source code as well as all the tools, libraries, and
dependencies that the application code needs to run as a container. When you run the Docker
image, it becomes one instance (or multiple instances) of the container.

Docker registry
A Docker registry is a scalable open-source storage and distribution system for Docker images.
The registry enables you to track image versions in repositories, using tagging for identification.
This is accomplished using git, a version control tool.

Dept. of CSE, JSSPM Page 25


Full Stack Development

9. b. Draw the CI/CD build process flow diagram for an online footwear store
application and explain each component

Login View Product Cart


User

Failed Failed Not Ok

Reset Password Search Delete / Billing


or Other Update
Product No
Sign Up
Not Ok

Update Pay Bill Verify


Failed Product &
Admin
Bill

Components

1. User: Refers to the Customers who buy product


2. Login: Application helps to login by using Id & Password & New user can
Signup
3. Product: Displays the List of available Product, Price, Ratings & Review
4. Cart: Customer can add product, delete the product or update the product
5. Billing: Total Cost based on purchase
6. Admin: Responsible for Update product, Billing, User quires & Manage
Application

Dept. of CSE, JSSPM Page 26


Full Stack Development

10 a).Create a form to add a new product detail to the product catalogue using React.

import { useState } from "react";


import "./App.css";
function App()
{
const [list, setList] = useState([]);
const [value, setValue] = useState("");
const addToList = () => {
let tempArr = list;
tempArr.push(value);
setList(tempArr);
setValue("");
};

const deleteItem = (index) => {


let temp = list.filter((item, i) => i !== index);
setList(temp);
};
return (
<div className="App">
<h>Add Product to List</h><br></br>
<input type="text" value={value} => setValue(e.target.value)}/>
<button Click to Add </button><br>
<h>Product Catalog</h><br>
<ol>
{
list.map((item, i) => <li => deleteItem(i)}>{item} </li>)
}
</ol>
<h>Click on Product to Delete</h><br></br>
</div>

Dept. of CSE, JSSPM Page 27


Full Stack Development

);
}
export default App;
b) CRUD Operations on document using MangoDB

Creating a Table.
To create collections/tables, createCollection(name, options) method is used.
Syntax: db.createCollection(name, options)
Example: db.createCollection("student")
{ ok: 1 }
show tables
student

insert() Method
To insert data into MongoDB collection, insert() or save() method is used.
Syntax: db.collectonName.insert(document)
Example: db.student.insert({"id":1,"name":"chandru","mark":300})

db.student.insertMany([{"id":1,"name":"chandru","mark":300},
{"id":2,"name":"suman","mark":290}])

View data from Table.


To view/display the documents, find() method is used
Syntax: db. collectonName.find({})
Example: db.student.find({})

Update.
To Update documents, update() method is used
Syntax: db. collectonName.update({})
Example: db.student.update({"name":"chandru"},{$set:{"name":"sekar",id:5}})

Delete only one data.


Dept. of CSE, JSSPM Page 28
Full Stack Development

To Delete documents, deleteOne()/deleteMany() method is used


Syntax: db. collectonName.deleteOne({})
Example: db.student.deleteOne({"name":"sekar"})
Example: db.student.deleteMany({"name":"sekar"})
Model Question paper 2

1. Process involved in enterprise application

Five main steps involved in the process of organizing an enterprise.

1. Determining Activities
 The first step in organizing is to identify and enumerate (to specify one after another) the

activities required to achieve the objectives of the enterprise.

 The activities will depend upon the nature and size of the enterprise.

 For instance, a manufacturing concern will have production, marketing and other.

2. Grouping of Activities
 The various activities are then classified into appropriate departments and divisions on

the basis of functions, products, territories, customers etc.

Dept. of CSE, JSSPM Page 29


Full Stack Development

 Similar and related activities may be grouped together under one department or division.

 Grouping of activities helps to secure specialization. Each department may be further sub

divided into sections and groups.

3. Assigning Duties
 The individual groups of activities are then allotted to different individuals on the basis of

their ability and aptitude.

 The responsibility of every individual should be defined clearly to avoid duplication of

work and overlapping of effort.

 Each person is given a specific job best suited to him and he is made responsible for its

execution.

4. Delegating Authority:
 Every individual is given the authority necessary to perform the assigned task effectively.

 An individual cannot perform his job without the necessary authority or power.

5. Coordinating Activities:
 The activities and efforts of different individuals are then synchronized. Such co-

ordination is necessary to ensure effective performance of specialized functions.

2. How to create project plan

The software plan prevents hurdles that tend to crop up during the project’s
execution. It also ensures optimal utilization of every allotted resource and time.

1. Define your scope:


 A project's scope describes the goals needed to complete the project
successfully.
 Defining your scope, consider project aspects like outcomes, tasks, budget, time
frame and deliverables.
 You can define these by writing them in sentences or creating a bulleted
list within your software project plan document.

Dept. of CSE, JSSPM Page 30


Full Stack Development

2. Define and coordinate your requirements:


 Identify appropriate resources that will help you to meet the objectives.
 Define the other aspects of the project such as equipment, budget for software
development, team, skills, and timeline.

3. Understand your constraints:


 Project may encounter unexpected events that may adversely affect it. Such as
increase in costs, delayed results, technical and business etc.
 Such hurdles include support from the management, appropriate schedule,
appropriate budget, and skilled software developers.

4. Map your business processes:


 Business process mapping is a powerful technique to visually depict process
steps and show how a process should function from start to finish.

5. Estimate your budget:


 The estimates will help you get an idea of the money and time you need.

6. Draw up your staged deliverables:


 Next task is to draw software development milestones to give room for testing
and feedbacks at each phase.
 Milestones ensure the software development team focuses on specific
functionality aspects.
 When planning tasks and features to be done at the various phases, concentrate
more on achieving original targets.

7. Create a team:
 Project management requires one or several teams of professionals with the
right experience and skills.
 If your company lacks these individuals, you may hire from outside or outsource
the recruitment process to a company that will put together the teams for you.

8. Discuss quality and progress:

Dept. of CSE, JSSPM Page 31


Full Stack Development

 Your planning is not yet over until you include the progress checks and quality
testing.
 Testing your stages ensures you’re meeting your milestone goals.

3. How to rendering multiple components in reactJS (List &Keys) with an example.

List: The list is used to display data in an ordered format and is traversed using the map()
function.

import React from 'react';


import ReactDOM from 'react-dom/client';
function NumberList(props) {
const numbers = props.numbers;
const listItems = numbers.map((number) =><li>{number}</li>);
return (
<ul>{listItems}</ul>
);
}
const numbers = [1, 2, 3, 4, 5];
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<NumberList numbers={numbers} />);
Keys: Keys are used to identify which items have changed, are added, or are removed.
import React from 'react';
import ReactDOM from 'react-dom';
function App(props) {
const numbers = props.numbers;
return (
<div>
<ul>
{numbers.map((number) =>
<li key={number.toString()}>{number}</li>
)}
</ul>

Dept. of CSE, JSSPM Page 32


Full Stack Development

</div>
);}
const numbers = ['Indore', 'Mumbai', 'Pune', 'Hyderabad', 'Banglore'];
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<App numbers={numbers} />);
export default App;
4. About type script with example

Control flow statement


TypeScript control statements:
1. If Statement
2. If else statement
3. if else if statement

TypeScript If Statement:
If statement is used to execute a block of statements if specified condition is true.
if(condition){
….
}

TypeScript If Else Statement:


If condition is true then if block will execute otherwise else block will execute.
if(condition){
….
}else{
….
}

TypeScript If Else If Statement:


If condition1 is true then block of statements1 will be executed, else if condition2 is true block of
statements2 is executed and so on. If no condition is true, then else block of statements will be
executed.

Dept. of CSE, JSSPM Page 33


Full Stack Development

if(condition1){
...
}else if(condition2){
...
}else{
...
}

Example
var num:number = 2;
if(num==1){
console.log("TypeScript Statement 1");
}
else if(num==2){
console.log("TypeScript Statement 2");
}
else{
console.log("TypeScript Statement n");
}
TypeScript - for Loops
1. for loop
2. for..of loop
3. for..in loop
for Loop
The for loop is used to execute a block of code a given number of times, which is specified by
a condition.
for (first expression; second expression; third expression ) {
// statements to be executed repeatedly
}
Example:
for (let i = 0; i < 3; i++) {

Dept. of CSE, JSSPM Page 34


Full Stack Development

console.log ("Block statement execution no." + i);


}

for...of Loop
TypeScript includes the for...of loop to iterate and access elements of an array, list, or tuple
collection.
let arr = [10, 20, 30, 40];
for (var val of arr) {
console.log(val);
}
for...in Loop
Another form of the for loop is for...in. This can be used with an array, list, or tuple.
let arr = [10, 20, 30, 40];
for (var index in arr) {
console.log(index);
console.log(arr[index]);
}

TypeScript - while Loop


The while loop is another type of loop that checks for a specified condition before beginning
to execute the block of statements. The loop runs until the condition value is met.
while (condition expression) {
}
Example:
let i: number = 2;
while (i < 4) {
console.log( "Block statement execution no." + i )
i++;
}

do..while loop

Dept. of CSE, JSSPM Page 35


Full Stack Development

The do..while loop is similar to the while loop, except that the condition is given at the end of
the loop. The do..while loop runs the block of code at least once before checking for the
specified condition.
do {
// code block to be executed
}
while (condition expression);
Example:
let i: number = 2;
do {
console.log("Block statement execution no." + i )
i++;
} while ( i < 4)
5. Authentication service
SecurityController.java

//import required packages and dependencies


@RestController
public class SecurityController
{
@GetMapping("/")
public String welcome() {
return ("<h1>Hello Everyone, Welcome to SpringBoot Security</h1>");
}
@GetMapping("/user")
public String welcomeUser() {
return ("<h1>Hello User, Welcome to SpringBoot Security</h1>");
}
@GetMapping("/admin")
public String welcomeAdmin() {
return ("<h1>Hello Admin, Welcome to SpringBoot Security</h1>");
}

Dept. of CSE, JSSPM Page 36


Full Stack Development

SecurityConfiguration.java
//import required packages and dependencies
@SuppressWarnings("deprecation")
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter
{
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("Gagan").password("ABC").roles("USER")
.and().withUser("Deep").password("XYZ").roles("ADMIN");
}

@Bean
public PasswordEncoder getPasswordEncoder() {
return NoOpPasswordEncoder.getInstance();
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/admin").hasRole("ADMIN")
.antMatchers("/user").hasAnyRole("USER","ADMIN")
.antMatchers("/").permitAll()
.and().formLogin();
}
}

6. Crud operation on Book using MangoDb

Step 1: Create a Spring Boot project.


Step 2: Add the following dependency
 Spring Web

Dept. of CSE, JSSPM Page 37


Full Stack Development

 MongoDB
 Lombok
 DevTools
Step 3: Create 3 packages and create some classes and interfaces inside these packages
 entity
 repository
 controller
Step 4: Inside the entity package create a Book.java file.
//import required packages & Dependencies
@Data
@NoArgsConstructor
@AllArgsConstructor
@Document(collection = "Book")
public class Book {
@Id
private int id;
private String bookName;
private String authorName;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getBookName() {
return bookName;
}
public void setBookName(String bookName) {
this.bookName = bookName;
}
public String getAuthorName() {
return authorName;

Dept. of CSE, JSSPM Page 38


Full Stack Development

}
public void setAuthorName(String authorName) {
this.authorName = authorName;
}
}
Step 5: Inside the repository package
Create a simple interface and name the interface as BookRepo. This interface is going to
extend the MongoRepository
//import required packages & Dependencies
public interface BookRepo extends MongoRepository<Book, Integer>
{
}

Step 6: Inside the controller package. Inside the package create one class named
as BookController
//import required packages & Dependencies
@RestController
public class BookController {
@Autowired
private BookRepo repo;

@PostMapping("/addBook")
public String saveBook(@RequestBody Book book){
repo.save(book);
return "Added Successfully";
}
@GetMapping("/findAllBooks")
public List<Book> getBooks() {
return repo.findAll();
}
@DeleteMapping("/delete/{id}")
public String deleteBook(@PathVariable int id){
repo.deleteById(id);
return "Deleted Successfully";

Dept. of CSE, JSSPM Page 39


Full Stack Development

}
}
Step 7: Below is the code for the application.properties file
server.port:8989
spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017
spring.data.mongodb.database=jss

7. About pom.xml

 POM stands for Project Object Model. It is fundamental unit of work in Maven. It is an
XML file that resides in the base directory of the project as pom.xml.
 The POM contains information about the project, goals, plugins and various
configuration detail used by Maven to build the project(s).
 Some of the configuration that can be specified in the POM are following
 project dependencies
 plugins
 goals
 build profiles
 project version
Before creating a POM, we should first decide the project group (groupId),
its name (artifactId) and its version as these attributes help in uniquely identifying the project in
repository.
POM Example
<project xmlns = "http://maven.apache.org/POM/4.0.0"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.companyname.project-group</groupId>
<artifactId>project</artifactId>

Dept. of CSE, JSSPM Page 40


Full Stack Development

<version>1.0</version>
</project>

Sr.No. Node & Description

1 Project root
This is project root tag. You need to specify the basic schema settings such as apache
schema and w3.org specification.

2 Model version
Model version should be 4.0.0.

3 groupId
This is an Id of project's group. This is generally unique amongst an organization or a
project. For example, a banking group com.company.bank has all bank related projects.

4 artifactId
This is an Id of the project. This is generally name of the project. For example,
consumer-banking. Along with the groupId, the artifactId defines the artifact's location
within the repository.

5 version
This is the version of the project. Along with the groupId, It is used within an artifact's
repository to separate versions from each other. For example −
com.company.bank:consumer-banking:1.0
com.company.bank:consumer-banking:1.1.

8. . React props and state

What are props?


Props is short for properties and they are used to pass data between React components. React’s
data flow between components is uni-directional (from parent to child only).
import React from 'react';
import ReactDOM from 'react-dom/client';
class ParentComponent extends React.Component {
render() {
return (

Dept. of CSE, JSSPM Page 41


Full Stack Development

<ChildComponent name="First Child" />


);
}
}
const ChildComponent = (props) => {
return <p>{props.name}</p>;
};
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<ParentComponent />);

import React from 'react';


import ReactDOM from 'react-dom/client';

function Name(props) {
return <h2>My name { props.name }!</h2>;
}

function Display() {
return (
<>
<Name name="Niranjan" />
</>
);
}

const root = ReactDOM.createRoot(document.getElementById('root'));


root.render(<Display />);

What is state?
React has another special built-in object called state, which allows components to create and
manage their own data. So unlike props, components cannot pass data with state, but they can
create and manage it internally.

import React from 'react';


import ReactDOM from 'react-dom/client';

class Test extends React.Component {

Dept. of CSE, JSSPM Page 42


Full Stack Development

constructor(props) {
super(props);
this.state = {
id: 1,
name: "test"
};
}

render() {
return (
<div>
<p>{this.state.id}</p>
<p>{this.state.name}</p>
</div>
);
}
}
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<Test />);

9. Create student database with name rollno department percentage in mongoDB and
perform aggregate functions.
db.createCollection("student")

{ ok: 1 }

db.student.insertMany([{"roll no":1,"department":"cs","percentage":25},

{"roll no":2,"department":"mech","percentage":35},

{"roll no":3,"department":"ec","percentage":50}])

Aggregate Function:

db.student.aggregate([{$group : {_id : "roll no", sum : {$sum : "$percentage"}}}])

db.student.aggregate([{$group : {_id : "roll no", max : {$max : "$percentage"}}}])

db.student.aggregate([{$group : {_id : "roll no", min : {$min : "$percentage"}}}])

Dept. of CSE, JSSPM Page 43


Full Stack Development

db.student.aggregate([{$group : {_id : "roll no", last : {$last : "$percentage"}}}])

db.student.aggregate([{$group : {_id : "roll no", first: {$first : "$percentage"}}}])

db.student.aggregate([{$group : {_id : "roll no", average : {$avg : "$percentage"}}}])

10. Compare nosql with rdbms.

NoSQL RDBMS

Non-relational databases, often known as RDBMS, which stands for Relational Database
distributed databases, are another name for Management Systems, is the most common name
NoSQL databases. for SQL databases.

No declarative query language SQL stands for Structured Query Language.

NoSQL databases are horizontally scalable RDBMS databases are vertically scalable

One record stores all the query data. This Relational database models contain data in
simplifies finding matched records, which different tables, because of so many tables, the
speeds up queries. database's query time is slow.

NoSQL Database has no fixed schema. Relational Database has a fixed schema.

NoSQL databases can handle big data or NoSQL databases are used to handle moderate
data in a very high volume . volume of data.

NoSQL has decentralized structure. Relational database has centralized structure.

NoSQL database can manage structured, Relational database manages only structured
unstructured and semi-structured data. data.

NoSQL combines multiple database Traditional RDBMS systems use SQL syntax and
technologies.. queries to get insights from data.

11. Kubernet with deployment model.


Canary deployment

Dept. of CSE, JSSPM Page 44


Full Stack Development

Canary deployment is a technique to reduce the risk of updating software or introducing


new changes in the production environment by slowly rolling out the change to a small subset of
users before making the software functional for everyone.

Pros (Advantages)
 Allows enterprises to test in production with real users and use cases.
 Enables comparison of different service versions side by side.
 Cheaper than blue-green deployments because it does not require two production environments.
 DevOps team can rapidly and safely trigger a rollback to a previous version of an application.

Cons (Disadvantages)
 Scripting a canary release can be complex as manual verification or testing can sometimes
become time-consuming.
 Monitoring and instrumentation for testing in production may involve exhaustive research and
additional skills & knowledge.

Blue/green deployment
Blue/green deployment is a deployment technique to release new code into the
production environment. Blue/green deployments make use of two identical production
environments. One of these is active and the other environment is set to idle. New updates are
pushed to the active environment where it is monitored for bugs while the idle environment
serves as a backup where traffic can be routed in case an error occurs.
Pros
 Simple, fast, easy to understand and implement.
 Rollback is straightforward as teams need to simply flip traffic back to the old environment in
case any issue arises.
 Blue-green deployments are not as risky and vulnerable to losses as compared to other
deployment strategies.
Cons
 Cost is the major drawback to blue-green deployments.
Quality assurance and user acceptance testing may not be enough to identify all of the
regressions.

Dept. of CSE, JSSPM Page 45

You might also like