Allegient Interview Question for Java Developers


Country: United States
Interview Type: Written Test




Comment hidden because of low score. Click to expand.
0
of 0 vote

2 possible classes :
Student - id, name
-
Course - id, name, maxslots

Registration - Student, Course
- register(StudentId, CourseId)
- deregister(StudentId, CourseId)
- getRegisteredStudents(CourseId)

- spr June 02, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

This is very simple.You would have two classes Student and Course.Student class
would have reference to Course which tells you that particuar Student has registed
to this Course and Course class would also have one maxAllocated property to store
the value of max students can be allocatedto this Course.
There would be one more class for Registration which would two methods registerCourse(String studentId, String courseId )
and degisterCourse(String studentId, String courseId ).

class Student {
	String Id;
	String Name;
	String Email;
	Address address;
	String Mobile
	List<Course> registerdCourses;
}

class Course {
	String Id;
	String Name;
	int maxSlot;
}

public interface IRegistration {
       public boolean registerCourse(String studentId, String courseId)
       public boolean degisterCourse(String studentId, String courseId);
}

class Registration implements IRegistration {
      IDataServices dataServices;
      public void Registration(IDataServices dataServices){
      this.dataServices = dataServices;
 }
     public boolean registerCourse(String studentId, String courseId){
     	dataServices.register(studentId, courseId); 
    }
    
    public boolean degisterCourse(String studentId, String courseId){
        dataServices.deregister(studentId, courseId); 
    }
}

- Anonymous November 18, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

How does the IDataServices interface look like ?
How to run the above class

- dum June 27, 2018 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More