Escolar Documentos
Profissional Documentos
Cultura Documentos
examine your coding style and process. Several parts of these questions are intentionally
vague and you should explain any assumptions you make in order to solve these problems.
Question 1: SQL
Design two SQL tables. One should hold company information, including its name, and
the other should include employee information, including the employee's name, status
and which company he works for. Provide the SQL to create these tables.
ANSWER:
CREATE TABLE company_info (
company_id bigint(20) NOT NULL AUTO_INCREMENT,
company_name varchar(20) NOT NULL,
company_info varchar(20) NOT NULL,
PRIMARY KEY (company_id)
)
If necessary, alter your tables so that employee names can be printed as "Lastname,
Firstname" as well as "Firstname Middlename Lastname Suffix."
ANSWER:
ALTER TABLE employee_info
DROP FOREIGN KEY fk1,
CHANGE name first_name VARCHAR(20) NOT NULL,
ADD last_name VARCHAR(20) NOT NULL AFTER name,
ADD middle_name VARCHAR(20),
ADD suffix VARCHAR(20);
Write an SQL query that would retrieve all the companies who have inactive
employees. (Inactive employees will have status == 2)
ANSWER:
select c.company_name from company_info c,employee_info e where
c.company_id=e.company_id and e.status=2;
Create a query to get all inactive employees. Retrieve the following information: the
resource name and the employee's name in "Lastname, Firstname" format.
select concat(e.last_name," ",e.first_name) as name from company_info
c,employee_info e where c.company_id=e.company_id and e.status=2;
RETURN return_value;
Bonus: Assume you are using MySQL 5. Create maintainable stored proceedures for
both of the above.
try {
Class.forName("com.mysql..jdbc.Driver");
con =
DriverManager.getConnection("jdbc:sqlserver://MYSERVER;databaseName=raviteja",
"root", "pichilan");
proc_stmt.setInt(2, "status");
rs = proc_stmt.executeQuery();
if (rs.next()) {
String companyName = rs.getString(2);
System.out.println("Inactive Companies: " + companyName );
} else {
System.out.println("Stored procedure couldn't get company Name");
}
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
} catch (SQLException ex) {
ex.printStackTrace();
} finally {
try {
rs.close();
proc_stmt.close();
con.close();
Bonus: Explain how you would optimize any of the above. What information would you
need?
Question 2: JAVA
Design Java classes that would represent the above tables.
Zipped files attached
Design Database Access Object (DAO) that utilizes the queries you wrote on question
1.
Bonus: Adapt your objects to each of the two frameworks you suggested. Use the
examples to explain your previous suggestions.
Bonus: Utilizing the J2EE6 stack, design the above interface again. Evaluate the pros
and cons of this solution compared to yours. (If your preferred framework is J2EE6,
pick another framework and do the same with it.)
What java technologies are your particularly excited about? These do not need to be
web specific technologies.
What java technologies have you used that you dislike? What did you dislike about
them? What would you use instead? These do not need to be web specific
technologies.
Question 5: Networking
What are two types of files systems used in Linux?
ext2, ext3
What is a good secure and easy to maintain OS for a network server? What do you like
best about it?