0% found this document useful (0 votes)
125 views5 pages

Interview JAVA TEST 3.2

This document outlines 4 programming problems. Problem 1 asks to calculate the 1000th member of a mathematical series. Problem 2 asks to replace characters in a file according to rules. Problem 3 asks to create a basic web application for online shopping with features like login, add/edit/delete products while following security rules. Problem 4 asks to enhance this with a RESTful API to return product info in JSON, securing the API for only authorized mobile app access. The problems should be solved in Java code.

Uploaded by

Aaron Abinson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
125 views5 pages

Interview JAVA TEST 3.2

This document outlines 4 programming problems. Problem 1 asks to calculate the 1000th member of a mathematical series. Problem 2 asks to replace characters in a file according to rules. Problem 3 asks to create a basic web application for online shopping with features like login, add/edit/delete products while following security rules. Problem 4 asks to enhance this with a RESTful API to return product info in JSON, securing the API for only authorized mobile app access. The problems should be solved in Java code.

Uploaded by

Aaron Abinson
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Introduction

This section outlines some programming problem set. Please complete ALL the problem
set and email the code to us. Should you have any question, feel free to email to us. Be
sure to include your contact information in your email.

All code should be written in Java programming language. You must use version at least
1.7 of Java. Please include a suitable number of comments in your code as well. We
want to see the way you would normally write the code. If a trivial solution does exist to
one of the problems (i.e. there is an API call that does it), try to avoid to use it as it will
give us very little to go gauge your skills.

Problem Set
Problem 1
Problem 2
Problem 3
Problem 4
Problem 1
Bob and Alice are two people who really like mathematics. One day, Bob wanted to test
Alice’s knowledge on number series. The rule is simple, Bob will provide a series of
numbers, and Alice is asked to write the n member of the next series.

Consider the following example:


Series : 1 2 3 4 5 6 7 8 9 10
Bob : What is the 20th member of the series (n=20)?
Alice : 20

Bob is giving another series:


1 2 5 20 25 150 157 1256 …

Now, Bob wants Alice to tell him what is the 1000 th member of this series. It’s gonna
take a lot of time for Alice to calculate manually, hence she asked you for help to create
a simple application to help her calculate the result.

Please help Alice and tell her what the 1000th member of that series is.

Code 1
Problem 2
Say I give you a file, inside contains a lot of characters, especially character ‘a’. Your
application will base on some rules and replace the ‘a’ with something else, and display
on the console.

RULE 1: if you found a single ‘a’, replace it with ‘#’


RULE 2: if you found an ‘a’ follow by another ‘a’, do not replace the first ‘a’, but replace
the subsequent ‘a’ with ‘$’

For example, a file contains the following characters set:


abcdaabcdeabaaacbfaaaabcab
123aabcaabca35aa

The sample output should look like below:


#bcda$bcde#ba$$cbfa$$$bc#b
123a$bca$bc#35a$

NB: This application MUST be case-insensitive.

Code 2
Problem 3
After graduation, Alice is going to establish a new online shopping company. To support
this, they have hired you as their freelance programmer. Your task is to develop a simple
baseline web application for them so that they can continue their work based on what
you have done.

In these very first criteria, they want you to build a simple website which contains the
following functionalities:
● Login
● Add product (only need to provide name and price)
● Update product (can only edit the name and price)
● Delete product
● Logout

They require you to use the following technologies and tools below:
● JSF
● Hibernate
● jQuery
● Jboss/GlassFish/Tomcat 6.0
● Netbeans or Eclipse

Furthermore, as a graduate majoring in computer security, Alice realises that data


security is very important. Hence, she came out with the following rules:
● User’s password must be stored in a hash value (using SHA256)
● Product price must be encrypted (using AES-256, you can hardcode the
encryption key for now)

NB: For simplicity, the first admin data (username and password) can be
inserted directly to the database.

Code 3
Problem 4
Alice online business have growth and decide to move to mobile world, hence she have
engage third party to develop the mobile application.

The minimum requirement of the mobile application developer is to provide a web


service that able to return product information in JSON format.

Alice requires you to enhance the web application (Problem 3) by adding a simple
RESTful web service features that able to return the object in JSON format by using
technologies below:
● Jersey
● Gson/Jackson

The return object should contain as below structure:

{
“name”:”product name”,
“price”:”product price”
}

Furthermore, as a graduate majoring in computer security, Alice realises that data


security is very important and this API should only allow access by the mobile application
only. Hence, she asks you to implement any method to SECURE the REST API from
unauthorized person.

Code 4

You might also like