Está en la página 1de 118

Consider the class diagram given below. Identify which of the following options best describes the scenario.

Options: a) b) c) d) e)

Class B is tightly coupled Class B has strong cohesion Class B is loosely coupled Class B has weak cohesion None of the options

1. Consider the following code snippets class Borrower { private String ID; private String Name; public Borrower(String myName, String myID) { ID = myID; Name = myName; } boolean Check_Return_Date( Date_Slip dateSlip, Date today) { return (today.comparedate(dateSlip.get_return_date())); } } class LibraryBook { private String name; public ArrayList <Pages> pages = new ArrayList <Pages>(); LibraryBook(String name, int pgnumber) { this.name = name;

Pages NP = new Pages(pgnumber); pages.add(NP); } public void addPage(int pageNumber){ Pages newPage = new Pages(pageNumber); pages.add(newPage); } } class Pages{ private int pageNumber; private String text ; public Pages(int pageNumber){ this.pageNumber = pageNumber; } } class Date_Slip { Date issue_Date; Date return_Date; public Date_Slip(Date idate, Date rdate) { issue_Date = idate; return_Date = rdate; } Date get_return_date() { return return_Date; } } class Date { int day; int month; int year; public Date(int dd, int mm, int yy) { day = dd; month = mm; year = yy; } boolean comparedate(Date newdate) { if (day <= newdate.day && month <= newdate.month && year <= newdate.year) return true; else return false; } } Identify the relationship between Borrower and Date_Slip >> Aggregation 2. Which of the following code describes uni-directional association of A towards B? a. class A{ String title; b. class A{ String title;

B my_B; A(){ //constructor code; } } class B{ String name; B(){ //constructor code; } } c. class A{ String title; A(){ //constructor code; } } class B{ String name; B(){ //constructor code; } } e. class A{ String title; A(){ //constructor code; } } class B{ String name; B(A my_A){ //constructor code; } }

A(){ //constructor code; } } class B{ String name; A my_A; B(){ //constructor code; } } d. class A{ String title; A(B my_B){ //constructor code; } } class B{ String name; B(){ //constructor code; } }

3. Which of the following code describes bi-directional association of A and B? a. class A{ String title; B my_B; A(){ //constructor code; } } class B{ String name; A my_A; B(){ //constructor code; } } c. b. class A{ String title; A(){ //constructor code; } } class B{ String name; A my_A; B(){ //constructor code; } } d.

class A{ String title; A(){ //constructor code; } } class B{ String name; B(){ //constructor code; } } e. class A{ String title; A(){ //constructor code; } } class B{ String name; B(A my_A){ //constructor code; } }

class A{ String title; A(B my_B){ //constructor code; } } class B{ String name; B(){ //constructor code; } }

4. Identify the relationship between class A and B from the following code snippet. class A{ String title; A(){ //constructor code; } } class B{ String name; B(){ //constructor code; } } a) unidirectional association b) bidirectional association c) dependency d) aggregation e) composition f) None of these 5. Refer the code snippet given below class A { private int aField; private String sField; A(String sField, int aField) { this.aField=aField; this.sField=sField; }

public String get_sField() { return sField; } } class B { private ArrayList <A> aFieldList ; private int bField; B(int bField, String s, int c) { this.bField=bField; aFieldList = new ArrayList <A>(); aFieldList.add(new A(s,c)); } //other member functions// } Identify the option that most accurately describes relationship exists between class B and class A. a) Aggregation b) Composition c) Association d) unidirectional association e) bi-directional association 6. A Student can belong to only 1 Section, & a Section can have 1 or more Students. The code which represents this bi-directional association is a. b. class Section{ class Section{ private int sectionNo; private int sectionNo; private int maxNoOfStudents; private int maxNoOfStudents; private Student newStudent; private ArrayList<Student> students; Section(){ //code for constructor Section(){ } //code for constructor public void addStudent(){ } //code to add Students to the public void addStudent(Student arraylist newStudent){ } students.add(newStudent); } } class Student{ } private String name; class Student{ private int rollNo; private String name; private ArrayList<Section> private int rollNo; sections; private Section studentSection; Student(){ Student(){ //code for constructor //code for constructor } } public void associateSection(){ public void associateSection(){ //code to assign Student to a //code to assign Student to a Section Section } } } } c. d. class Section{ class Section{ private int sectionNo; private int sectionNo; private int maxNoOfStudents; private int maxNoOfStudents;

private ArrayList<Student> students; Section(){ //code for constructor } public void addStudent(Student newStudent){ students.add(newStudent); } } class Student{ private String name; private int rollNo; private ArrayList<Section> studentSections; Student(){ //code for constructor } public void associateSection(){ //code to assign Student to a Section } } e. None of these

private ArrayList<Student> students; Section(){ Student newStudent = new Student(); // rest of the code } public void addStudent(){ //code to add Students to the arraylist } } class Student{ private String name; private int rollNo; Student(){ //code for constructor } public void associateSection(){ //code to assign Student to a Section } }

7. Which of the following code describes aggregation relationship between A and B? a. class A{ String title; A(String title){ this.title = title; } } class B{ ArrayList<A> listA; B(){ listA = new ArrayList<A>(); } void addToList(A objA){ listA.add(objA) } } c. class A{ String title; A(String title){ this.title = title; } } class B{ ArrayList<A> listA; B(String s){ listA = new ArrayList<A>(); b. class A{ String title; A(String title){ this.title = title; } } class B{ ArrayList<A> listA; B(ArrayList<A> listOfA){ listA = new ArrayList<A>(); listA = listOfA; } void addToList(A objA){ listA.add(objA) } } d. class A{ String title; A(B my_B){ //constructor code; } } class B{ String name; B(){ //constructor code;

listA.add(new s); } void addToList(String s){ A objA = new A(s); listA.add(objA) } }

e.

None of these

8. Which of the following code describes composition relationship between A and B? a. class A{ String title; A(String title){ this.title = title; } } class B{ ArrayList<A> listA; B(){ listA = new ArrayList<A>(); } void addToList(A objA){ listA.add(objA) } } c. class A{ String title; A(String title){ this.title = title; } } class B{ ArrayList<A> listA; B(String s){ listA = new ArrayList<A>(); listA.add(new s); } void addToList(String s){ A objA = new A(s); listA.add(objA) } } e. None of these b. class A{ String title; A(String title){ this.title = title; } } class B{ ArrayList<A> listA; B(ArrayList<A> listOfA){ listA = new ArrayList<A>(); listA = listOfA; } void addToList(A objA){ listA.add(objA) } } d. class A{ String title; A(B my_B){ //constructor code; } } class B{ String name; B(){ //constructor code; } }

9. Consider the following code and identify the relationship between class A and class B class Section{ private int sectionNo; private int maxNoOfStudents; private ArrayList<Student> students; Section(){

} class Student{ private String name; private int rollNo; private ArrayList<Section> studentSections; Student(){ //code for constructor } public void associateSection(){ //code to assign Student to a Section } } class graduateStudent extends Student{ private String major; graduateStudent(){ //code for constructor } } a) Aggregation b) Composition c) Association d) Generalization e) None of these

//code for constructor } public void addStudent(Student newStudent){ students.add(newStudent); }

10. Litware, Inc. creates a new audio player called LitwarePlayer. LitwarePlayer uses a primary file, which uses a newly developed audio format that enables an entire audio CD to be stored in less than 10 kilobytes of memory with no loss of quality. This new primary file type is a media type. Users exchange media files across various platforms and there might be other applications that need to read the LitwarePlayer format. Identify the relationship between LitwarePlayer and the primary file. a) Association b) Aggregation c) Composition d) Dependency e) Generalization

1. The University of Toronto has several departments. Each department is managed by a chair, and at least one professor. Professors must be assigned to one, but possibly more departments. At least one professor teaches each course, but a professor may be on

sabbatical and not teach any course. Each course may be taught more than once by different professors. We know of the department name, the professor name, the professor employee id, the course names, the course schedule, the term/year that the course is taught, the departments the professor is assigned to, the department that offers the course. Identify the class diagram that represents the sceneroi. a)

b)

c)

10

d)

e)

11

UML has several relations (association, aggregation and composition) that seem to all mean the same thing : "has a". So, what is the difference between them? Association represents the ability of one instance to send a message to another instance. This is typically implemented with a pointer or reference instance variable, although it might also be implemented as a method argument, or the creation of a local variable. [Example:]
|A|----------->|B| class A { private: B* itsB; };

Aggregation [...] is the typical whole/part relationship. This is exactly the same as an association with the exception that instances cannot have cyclic aggregation relationships (i.e. a part cannot contain its whole). [Example:] 12

|Node|<>-------->|Node| class Node { private: vector<Node*> itsNodes; };

The fact that this is aggregation means that the instances of Node cannot form a cycle. Thus, this is a Tree of Nodes not a graph of Nodes. Composition [...] is exactly like Aggregation except that the lifetime of the 'part' is controlled by the 'whole'. This control may be direct or transitive. That is, the 'whole' may take direct responsibility for creating or destroying the 'part', or it may accept an already created part, and later pass it on to some other whole that assumes responsibility for it. [Example:]
|Car|<#>-------->|Carburetor| class Car { public: virtual ~Car() {delete itsCarb;} private: Carburetor* itsCarb };

Types of Association: Literal meaning of association means. Being associated with each other means I know you, or you know me right?? Whenever two objects communicate with each other its association relationship. Association is of different types. Importantly of three types. 1. I know u as well as so many other people as well. Same for you. You also know so many people. This kind of relationship is depicted as simple Association in UML. This is always characterized by "has a" relationship. Like I have your reference. You have mine reference. Both or none. 2. I am not complete without you. You make me complete. Example a music system consists of sound box, CD player, graphic equalizer etc. So in other words we may say, a music system is aggregation of CD player, casette player, graphics equalizer, sound box etc. Or music system object has aggregation relationship with each of the things mentioned above. 3. I am not complete without you. And you dont exist outside me.

13

Example could be a tree? Branches, leaves, fruits dont exists outside it? If tree dies everything dies. This is strongest form of association and called composition relationship. Another examples could be relationship between a house and its rooms. Rooms dont exist outside a house? Same room cannot be shared across two houses? And all the rooms persishes if the house collapses.

Categorize the following relationships into inheritance, aggregation, or association. Beware, there may be ternary or n-ary associations in the Iist, so do not assume every relationship involving three or more object classes is an inheritance relationship. (i) A country has a capital city. (ii) A dining philosopher is using a fork. (iii) A file is an ordinary file or directory file. (iv) Files contain records. (v) A polygon is composed of an ordered set of point (vi) A drawing object is text, a geometrical object, (vii) A person uses a computer language on a project (viii) Modems and keyboards are inputoutput device (ix) Object classes may have several attributes. (x) A person plays for a team in a certain year. (xi) A route connects two cities. (xii) A student takes a course from a professor. (xiii) A student may be a part-time or full-time student. (xiv) An origination has many departments. (xv) A student can undergo many courses simultaneously'. (xvi) You and I are the members of this organization.

1. Consider the following code snippets class Borrower { private String ID; private String Name; public Borrower(String myName, String myID) { ID = myID; Name = myName; } boolean Check_Return_Date( Date_Slip dateSlip, Date today)

14

{ return (today.comparedate(dateSlip.get_return_date())); } } class LibraryBook { private String name; public ArrayList <Pages> pages = new ArrayList <Pages>(); LibraryBook(String name, int pgnumber) { this.name = name; Pages NP = new Pages(pgnumber); pages.add(NP); } public void addPage(int pageNumber){ Pages newPage = new Pages(pageNumber); pages.add(newPage); } } class Pages{ private int pageNumber; private String text ; public Pages(int pageNumber){ this.pageNumber = pageNumber; } } class Date_Slip { Date issue_Date; Date return_Date; public Date_Slip(Date idate, Date rdate) { issue_Date = idate; return_Date = rdate; } Date get_return_date() { return return_Date; } } class Date { int day; int month; int year; public Date(int dd, int mm, int yy)

15

{ day = dd; month = mm; year = yy; } boolean comparedate(Date newdate) { if (day <= newdate.day && month <= newdate.month && year <= newdate.year) return true; else return false; } } Identify the relationship between Borrower and Date_Slip 2. Which of the following code describes uni-directional association of A towards B?

1.
class A{ String title; B my_B; A(){ //constructor code; } } class B{ String name; B(){ //constructor code; } }

2.
class A{ String title; A(){ //constructor code; } } class B{ String name; A my_A; B(){ //constructor code; } }

3.
class A{ String title; A(){ //constructor code; } } class B{ String name; B(){ //constructor code; } }

4.
class A{ String title; A(B my_B){ //constructor code; } } class B{ String name; B(){ //constructor code; } }

16

5.
class A{ String title; A(){ //constructor code; } } class B{ String name; B(A my_A){ //constructor code; } }

3. Which of the following code describes bi-directional association of A and B?

1.
class A{ String title; B my_B; A(){ //constructor code; } } class B{ String name; A my_A; B(){ //constructor code; } }

2.
class A{ String title; A(){ //constructor code; } } class B{ String name; A my_A; B(){ //constructor code; } }

3.
class A{ String title; A(){ //constructor code; } } class B{ String name; B(){

4.
class A{ String title; A(B my_B){ //constructor code; } } class B{ String name; B(){

17

//constructor code; } }

//constructor code; } }

5.
class A{ String title; A(){ //constructor code; } } class B{ String name; B(A my_A){ //constructor code; } }

4. Identify the relationship between class A and B from the following code snippet. class A{ String title; A(){ //constructor code; } } class B{ String name; B(){ //constructor code; } } 1. unidirectional association 2. bidirectional association 3. dependency 4. aggregation 5. composition 6. None of these 5. Refer the code snippet given below class A { private int aField; private String sField; A(String sField, int aField)

18

{ this.aField=aField; this.sField=sField; } public String get_sField() { return sField; } } class B { private ArrayList <A> aFieldList ; private int bField; B(int bField, String s, int c) { this.bField=bField; aFieldList = new ArrayList <A>(); aFieldList.add(new A(s,c)); } //other member functions// } Identify the option that most accurately describes relationship exists between class B and class A. 1. Aggregation 2. Composition 3. Association 4. unidirectional association 5. bi-directional association 6. A Student can belong to only 1 Section, & a Section can have 1 or more Students. The code which represents this bi-directional association is

1.
class Section{ private int sectionNo; private int maxNoOfStudents; private Student newStudent; Section(){ //code for constructor } public void addStudent(){ //code to add Students to the arraylist } } class Student{

2.
class Section{ private int sectionNo; private int maxNoOfStudents; private ArrayList<Student> students; Section(){ //code for constructor } public void addStudent(Student newStudent){ students.add(newStudent); } }

19

private String name; private int rollNo; private ArrayList<Section> sections; Student(){ //code for constructor } public void associateSection(){ //code to assign Student to a Section } }

class Student{ private String name; private int rollNo; private Section studentSection; Student(){ //code for constructor } public void associateSection(){ //code to assign Student to a Section } }

3.
class Section{ private int sectionNo; private int maxNoOfStudents; private ArrayList<Student> students; Section(){ //code for constructor } public void addStudent(Student newStudent){ students.add(newStudent); } } class Student{ private String name; private int rollNo; private ArrayList<Section> studentSections; Student(){ //code for constructor } public void associateSection(){ //code to assign Student to a Section } } 5. None of these

4.
class Section{ private int sectionNo; private int maxNoOfStudents; private ArrayList<Student> students; Section(){ Student newStudent = new Student(); // rest of the code } public void addStudent(){ //code to add Students to the arraylist } } class Student{ private String name; private int rollNo; Student(){ //code for constructor } public void associateSection(){ //code to assign Student to a Section } }

7. Which of the following code describes aggregation relationship between A and B?

20

1.
class A{ String title; A(String title){ this.title = title; } } class B{ ArrayList<A> listA; B(){ listA = new ArrayList<A>(); } void addToList(A objA){ listA.add(objA) } }

2.
class A{ String title; A(String title){ this.title = title; } } class B{ ArrayList<A> listA; B(ArrayList<A> listOfA){ listA = new ArrayList<A>(); listA = listOfA; } void addToList(A objA){ listA.add(objA) } }

3.
class A{ String title; A(String title){ this.title = title; } } class B{ ArrayList<A> listA; B(String s){ listA = new ArrayList<A>(); listA.add(new s); } void addToList(String s){ A objA = new A(s); listA.add(objA) } } 5. None of these

4.
class A{ String title; A(B my_B){ //constructor code; } } class B{ String name; B(){ //constructor code; } }

8. Which of the following code describes composition relationship between A and B?

1.

2. 21

class A{ String title; A(String title){ this.title = title; } } class B{ ArrayList<A> listA; B(){ listA = new ArrayList<A>(); } void addToList(A objA){ listA.add(objA) } }

class A{ String title; A(String title){ this.title = title; } } class B{ ArrayList<A> listA; B(ArrayList<A> listOfA){ listA = new ArrayList<A>(); listA = listOfA; } void addToList(A objA){ listA.add(objA) } }

3.
class A{ String title; A(String title){ this.title = title; } } class B{ ArrayList<A> listA; B(String s){ listA = new ArrayList<A>(); listA.add(new s); } void addToList(String s){ A objA = new A(s); listA.add(objA) } } 5. None of these

4.
class A{ String title; A(B my_B){ //constructor code; } } class B{ String name; B(){ //constructor code; } }

9. Consider the following code and identify the relationship between class A and class B class Section{ private int sectionNo; private int maxNoOfStudents; private ArrayList<Student> students;

22

Section(){ //code for constructor } public void addStudent(Student newStudent){ students.add(newStudent); } } class Student{ private String name; private int rollNo; private ArrayList<Section> studentSections; Student(){ //code for constructor } public void associateSection(){ //code to assign Student to a Section } } class graduateStudent extends Student{ private String major; graduateStudent(){ //code for constructor } } 1. 2. 3. 4. 5. Aggregation Composition Association Generalization None of these

10. Litware, Inc. creates a new audio player called LitwarePlayer. LitwarePlayer uses a primary file, which uses a newly developed audio format that enables an entire audio CD to be stored in less than 10 kilobytes of memory with no loss of quality. This new primary file type is a media type. Users exchange media files across various platforms and there might be other applications that need to read the LitwarePlayer format. Identify the relationship between LitwarePlayer and the primary file. 1. 2. 3. 4. 5. Association Aggregation Composition Dependency Generalization

23

========================================================== ========================================================== = 1.class complain { private String Type; private String Description; private Date date_of_registration; private boolean Status; public complain(String compType,String compDesc, Date myregistration){ Type = compType; Description = compDesc; date_of_registration = myregistration; Status = false; } public complain(String compType,String compDesc, Date myregistration, boolean comp_Status){ Type = compType; Description = compDesc; date_of_registration = myregistration; Status = comp_Status; } private complain(String compType,String compDesc){ Type = compType; Description = compDesc; } public void setStatus(boolean newStatus){ Status = newStatus; } public void getStatus(){ if (Status) System.out.println("Complaint resolved"); else System.out.println("Complaint not resolved"); } public boolean ComplainStatus(){ if (Status) System.out.println("Complaint resolved"); else System.out.println("Complaint not resolved"); return Status; } } class Date {

24

int dd; int mm; int yy; Date(int mydd, int mymm, int myyy){ dd = mydd; mm = mymm; yy = myyy; } } Which of the following statement is invalid. a) Date D = new Date (30, 10, 2009) complain C1 = new complain(Crime, Robbery, D) b) Date D = new Date (30, 10, 2009) complain C1 = new complain(Crime, Robbery) c) Date D = new Date (30, 10, 2009) complain C1 = new complain(Crime, Robbery, D,true) d) Date D = new Date (30, 10, 2009) complain C1 = new complain(Crime, Robbery, new Date(30,10,2009),true) e) none of these 2. Following is a class template. class Address { private String city; private String country; private String street; public Address(String mycity,String mycountry, String mystreet){ city=mycity; country=mycountry; street=mystreet; } public Address(){ city = "GHT"; country = "INDIA"; street = "M.G Street"; } public Address(String mycity){ city = mycity; country = "INDIA"; street = null; } public String getCity(){ return city; } public String getCountry(){ return country;

25

} public String getStreet(){ return street; } } Identify the expressions that can create a customized Address object. a) Address A1 = new Address() b) Address A1 = new Address(Guwahati) c) Address A1 = new Address(DELHI, INDIA, PARK STREET) d) a,b,c e) b,c f) None of the options. 3. A course knows its name , the semester name in which it is offered, the name of the teacher assigned to teach it, total scores and the pass score. Identify the code snippet that can be used to create a customized course like named Software Engineering , offered in the 4th semester , having a total score of 100 , pass score 50 , taught by Ms Smita who is a senior lecturer in the CS department. a) class course { private String courseName; private String SemesterName; private int totalScore; private int passScore; private String FacultyName; public course(String name,String Semester,int totalScore, int passScore, String FacultyName) { courseName = name; SemesterName = Semester; this.FacultyName = FacultyName; this.totalScore = totalScore; this.passScore = passScore; } public String getName(){ return courseName; } } b) class course { private String courseName; private String SemesterName; private int totalScore; private int passScore; private String FacultyName;

26

public course(String name,String Semester,int totalScore, int passScore, String FacultyName) { courseName = name; SemesterName = Semester; FacultyName = FacultyName; totalScore = totalScore; passScore = passScore; } public String getName(){ return courseName; } } c) class course { private String courseName; private String SemesterName; private int totalScore; private int passScore; private String FacultyName; public course(){ courseName = Software Engineering; SemesterName = 4th Semester; FacultyName = Smita; totalScore = 100; passScore = 50; } public String getName(){ return courseName; } } d) class course { private String courseName; private String SemesterName; private int totalScore; private int passScore; private String FacultyName; public course(String name,String Semester,int cFees){ courseName = name; SemesterName = Semester; FacultyName = Smita; totalScore = 100; passScore = 50;

27

} public String getName(){ return courseName; } } e) none of these 4. Seema wants to borrow a book from a library. The library has an automated system. So the Library displays the main screen, asks Seema to enter her smart card and the password. After Seema enters her card and the password, Library verifies the card and if verification is successful, it asks Seema to enter the details of the book she wants to borrow. The library then verifies for the availability of the book. If the book is available, it asks Seema to go to the dispatching counter and collect the book ,otherwise returns a regret note. Library returns back the card to Seema. Identify the doing responsibilities of the Library. a)Library,Seema, Seemas card. b)Displaying the main screen, asking for the card, asking for the password, verifying the card, asking for book details, returning regret note and the card, returning book and the card. c)Displaying the main screen, asking for the card, asking for the password, verifying the card, asking for book details, verifying book availability,returning regret note, sending book to the dispatch counter, asking Seema to collect the book and returning the card. d)Entering the card, knowing the password, giving the password, knowing the amount, giving the amount to be withdrawn, giving the book details. e)card number, password, amount to be withdrawn. f)none of these. g)Displaying the main screen, asking for the card, asking for the password, verifying the card, asking for book details, returning regret note, sending book to the dispatch counter, asking Seema to collect the book and returning the card. 5. Mr. Abhishek and Ms. Leela are teaching Computer Science in an engineering college. The registration number of the college they work in is P01. Mr. Abhishek is working as a lecturer and Ms. Leela as laboratory assistant. Each employee of the college has an employee id, employee name, address and category. The college got the registration on 12th June 09 and the end date of the registration is 11th Jun 10. Mr. Abhisheks employee id is 78901. Identify the objects defined in the above scenario. a)college, Employee, Chemist, Laboratory Assistant. b)Mr. Abhishek, Ms. Leela, P01, Computer Science c)Mr. Abhishek, 78901, Ms. Leela, 12th June 09 and 11th June 10 d)Mr. Abhishek, Ms. Leela e)Mr. Abhishek, Ms. Leela, engineering college f)None of the options.

28

6. IIT Guwahati provides bus services to travel from its campus to the city. Faculties, students, office staff and visitors can avail this service to travel from the city to the IIT campus and vice versa. For those students, faculties and office staff who are regular traveler, the IIT authority provides travel pass on monthly or half yearly basis. A travel pass has a unique pass number and date of issue. Identify the most suitable classes that need to be defined for developing an automated travel pass management system based on the given scenario. a)IIT, Bus, Student, faculty , staff , travel pass b)Traveler, travel pass, IIT c)Travel pass , traveler, regular traveler d)Travel pass , Monthly Travel pass , Half yearly travel pass , traveler e)Traveler, Half yearly travel pass , Monthly travel pass 7. Mohan is driving his car at a speed of 60k.m/hour. His car is black in color. Mohan can apply break to decrease the speed of his car and can apply accelerator to increase the speed. When he makes a change to the cars speed he needs to change the gear. Which of the following code snippet best define class to be used for creating Mohans car? a) class car{ private String color; private int gear; private int speed; public car(String startColor, int startSpeed, int startGear) { gear = startGear; color = startColor; speed = startSpeed; } public int getColor() { return color; } public int getGear() { return gear; } public void setGear(int newValue) { gear = newValue; } public int getSpeed() { return speed; } public void applyBrake(int decrement,int newval) { speed -= decrement; gear=newval; }

29

public void speedUp(int increment,int newval) { gear=newval; } } b) class Mohans_car { private String color=Blue; private int gear=2; private int speed=20; public int getColor() { return color; } public int getGear() { return gear; } public void setGear(int newValue) { gear = newValue; } public int getSpeed() { return speed; } public void applyBrake(int decrement) { speed -= decrement; } public void speedUp(int increment) { speed += increment; } } c) class car { private String color; private int gear; private int speed; public int getColor() { return color; } public void setColor(String newValue){ color = newValue; } public int getGear(){ return gear; } public void setGear(int newValue){ gear = newValue; } public int getSpeed(){

30

return speed; } public void applyBrake(int decrement){ speed -= decrement; } public void speedUp(int increment){ speed += increment; } } d) class car{ private String color; private int gear; private int speed; public car(String startColor, int startSpeed, int startGear){ color= startColor; gear = startGear; speed = startSpeed; } public int getGear(){ return gear; } public void setGear(int newValue){ gear = newValue; } public int getSpeed(){ return speed; } public void applyBrake(int decrement){ speed -= decrement; } public void speedUp(int increment) { speed += increment; } } e) none of these 8. Consider the following code: class Time{ private int hour, min, sec; public Time(int hour, int min, int sec){ this.hour=hour; this.min=min; this.sec=sec; } public int getHour(){return hour;} public int getMinute(){return min;}

31

public int getSecond(){return sec;} public Time addminutes(int minutes){ int newmin = (min + minutes) % 60; int newhour = hour + (min + minutes) / 60; return new Time(newhour, newmin, sec); } public int findDiff(Time T){ return ((T.getHour() - hour) * 60 + (T.getMinute() - min)); } } class FlightSchedule{ int duration; Time DepartureTime, ArrivalTime; public FlightSchedule(){ this.DepartureTime = new Time(6,0,0); this.ArrivalTime = new Time(7,0,0); this.duration = 60; } public FlightSchedule(Time DepTime, int duration){ this.DepartureTime = DepTime; this.duration = duration; this.ArrivalTime = DepTime.addminutes(duration); } public FlightSchedule(Time DepTime, Time ArrTime){ this.DepartureTime = DepTime; this.ArrivalTime = ArrTime; this.duration = DepTime.findDiff(ArrTime); } public FlightSchedule(Time DepTime, Time ArrTime, int duration){ this.DepartureTime = DepTime; this.ArrivalTime = ArrTime; this.duration = duration; } } Using the above code, create a customized object of class FlightSchedule having departure time as 6:00 am and a flight duration of 150 minutes a)FlightSchedule FS = new FlightSchedule(); b)FlightSchedule FS = new FlightSchedule(6, 150); c)FlightSchedule FS = new FlightSchedule(new Time(6,0,0),150); d)FlightSchedule FS = new FlightSchedule(new Time(6,0,0),new Time(8,30,0)); e)FlightSchedule FS = new FlightSchedule(new Time(6,0,0),new Time(8,30,0), 150); 9. Greyhound Bus Ticket reservation system offers online bus ticket reservation facility. A customer can register and update his details. For reserving a ticket a registered customer has to give his preferences like number of seats, date, source and destination of journey. Based on seat availability, tickets

32

will be reserved and a booking reference number will be issued. Customer can view the schedule of the bus by giving his booking reference number. A customer can cancel reserved tickets. From the above scenario, if a system is developed to automate the whole process, what could be possible business behaviours of an object of type customer? Book Tickets Check Availability Get Customer Preferences Schedule Arrangement Issue PNR Register Customer Update Customer Details Options a.5,7 b.2, 5, 6 c.3, 7 d.1, 5, 7 e.4,3,1 f.3 10. Govt has deployed a Complaint Tracking system through which the citizens can raise the complaints against social crimes, bribery all other kind of social injustices and also system allows a citizen to check the status of his complaints. Mr X has registered a complaint and he wishes to check the status of his complaint. Govt administrator verifies the complaint and transfers the complaint to department in charge. Identify the messages that need to be passed between the objects Mr X and Complaint Tracking system in the above scenario. a)registerComplaint, checkComplaintStatus b)registerComplaint, checkComplaintStatus,verifyComplaint c)registerComplaint, verifyComplaint d)registerComplaint, verifyComplaint,transferComplaint e)registerComplaint, checkComplaintStatus, verifyComplaint,transferComplaint f)verifyComplaint,transferComplaint 11. Mrs White wants to enrol her daughter Janet in AllSmart Day Care Centre. Mrs White would like to know the working hours of AllSmart Day Care Centre. She would also like to know the charges levied by the AllSmart Day Care Centre. The AllSmart Day Care Centre would like to know the personal details of Mrs White like her name and address. Janet would like to know number of swings in the AllSmart Day Care Centre. The AllSmart Day Care Centre would like to know from Janet, her date of birth and food preferences. Identify the messages that need to be passed between the objects Mrs White and AllSmart Day Care Centre in the above scenario. Options: a)Get working hours, Get charges levied, Get personal details b)Get working hours, Get charges levied, Get personal details, Get date of birth c)Get working hours, Get charges levied, Get personal details, Get food preferences

33

d)Get working hours, Get charges levied, Get personal details, Get date of birth, Get food preferences e)Get toy available details, Get working hours, Get charges levied, Get personal details, Get date of birth, Get food preferences f)None of the options 12. XYZ University had various departments. A professor has to deliver lectures, conduct evaluations and send evaluation reports. A student has to register for sessions and appear for evaluations. A student can also see the result of evaluation by using his registration number. Exam controller has to schedule evaluation based on availability of professor, and consolidate all evaluation reports. Lecture duration should be at least 45 minutes. An evaluation should not be conducted on Fridays. Exam controller should consolidate result within 5 days of exam. A Professor can send an alert to students informing about registering for sessions, and schedule of exams. From the above scenario, if a system is developed to automate the whole process, what could be possible business behaviours of an object of type professor? 1.send alert 2.consolidate result 3.schedule evaluation 4.conduct evaluation 5.check availability of professor 6.register student for exam 7.know lecture duration a.1,7 b.2, 5, 6 c.1, 4 d.1, 5, 7 e.1 f.3 13. An ILP building has 2 floors. Training Room 1 and 2 are in the 1st floor and Training Rooms 3, 4 and 5 are in the 2nd floor of the ILP building. The rooms in the 1st floor have a seat capacity of 40; where as those in the 2nd floor have a seat capacity of 30 each. Given the number of ILP participants to a Training Room Object, it can be checked if all the participants can be accommodated in that training room Find the attributes of the Training Room class a)floor, seat capacity, building no b)floor, seat capacity, training room no c)floor, seat capacity, training room no, canAccommodateParticipants d)floor, seat capacity, building no, canAccommodateParticipants e)floor, seat capacity, training room no, number of ILP participants 14. Read the following scenario and identify the objects. Mr. X is organizing a dinner party for his friends on 25th of November to celebrate his sons birthday. He calls his chef, Mr. Y and tells him to arrange food and drinks for the dinner. He gives Mr. Y the number of vegetarian and non vegetarian invitees. Mr. Y would also require the specifications for the drinks he would have to serve as alcoholic and non-alcoholic.

34

a)Mr. X, Mr. Y, dinner party, friend, son b)Organizer, Chef, party, food, drink, specification c)Mr. X, Mr. Y, dinner party, vegetarian food, non vegetarian food, alcoholic drink, non alcoholic drink d)Mr. X, Mr. Y, dinner party, vegetarian food, non vegetarian food, alcoholic drink, non alcoholic drink, specification e)Mr. X, Mr. Y, dinner party on 25th November 15. Mr. John arrives at a car showroom. He meets Mr. X, the owner of the showroom. Mr. X calls the sales representative, Mr. Burns and introduces him to Mr. John. Mr. Burns gets all the requirements of Mr. John and shows him all the cars in the shop that meets his requirement. Mr. John asks Mr. Burns about the price of the cars and their specifications. He finally chooses his desired car and decides to make the payment to Mr. X. Mr. X then asks him if he would be paying by check or by cash and makes the necessary arrangements. Identify the messages that need to be passed between the objects Mr John and Mr Burns in the above scenario a)show details, get price, get specification, choose car b)get price, get specification, get payment type c)get requirement, get price, make payment d)get requirement, show details, get price, get specification e)show details, choose car, get payment type, make payment 16. Read the following scenario and identify the objects. Chandra B, the president of XYZ Manufacturing, requested that Swami V, the MIS department manager, investigate the viability of selling their products over the Web. Currently, the MIS department is still using an IBM mainframe as their primary deployment environment. As a first step, Swami contacted his friends at IBM to see if they had any suggestions as to how XYZ Manufacturing could move toward supporting sales in an electronic commerce environment while keeping their mainframe as their main system. His friends explained that IBM now supports Java and Linux on their mainframes. Furthermore, they suggested that Swami investigate using object-oriented systems as a basis for developing the new system. a)Chandra, XYZ Manufacturing, Swami V, MIS Department, product, mainframe, IBM, Java, Linux b)Chandra, XYZ Manufacturing, Swami V, product, mainframe c)Chandra, XYZ Manufacturing, Swami V, MIS Department, IBM, mainframe d)Chandra, XYZ Manufacturing, Swami V, MIS Department, IBM mainframe, IBM, Java, Linux e)None of these 17. Consider the following code: class Box { double width; double height; double depth; Box(){//constructor 1 width = 40; height = 40; depth = 40; } Box(double w, double h, double d) {//constructor 2

35

width = w; height = h; depth = d; } Box(double w, double h){//constructor 3 width = w; height=h; depth = h; } Box(double s){//constructor 4 width = s; height=s; depth = s; } // compute and return volume double volume() { return width * height * depth; } } Using the above code, create an object of class Box having height, width and depth as 40 cm a)Box B1 = new Box(); b)Box B1 = new Box(40); c)Box B1 = new Box(40,40); d)Box B1 = new Box(40, 40, 40); e)All of these 18. Read the following scenario and identify the objects. Johns wife, Heather, and son, Joe, are suffering from cold and having body ache. After a round of blood test, the doctor confirmed that both of them have got H1N1 virus and are suffering from Swine Flu. The doctor prescribed some medicine and suggested them to stay at home for at least 2 weeks. John went to Drugs For You Pharmacy in order to get the prescribed medicines. The staff at the Pharmacy noted down the doctor name and phone numbers as well as all the details of the medicine, like medicine manufacturing date, expiry date, batch number. Identify the objects involved in the above scenario. a)John, Heather, Joe, H1N1 virus, Swine Flu, Drugs For You Pharmacy b)John, Heather, Joe, Drugs For You Pharmacy c)John, Heather, Joe, H1N1 virus, doctor, Drugs For You Pharmacy d)John, Heather, Joe, H1N1 virus, Swine Flu, Drugs For You Pharmacy e)John, Heather, Joe, doctor, prescription, Drugs For You Pharmacy, staff 19. Consider the following code class Date{ private int day, month, year; public Date(int day, int month, int year){ this.day = day; this.month = month; this.year = year; } public void displayDate(){ System.out.println(day + ":" + month + ":" + year); } }

36

class ConferenceSchedule{ Date StartDate, FinishDate; public ConferenceSchedule (Date D1, Date D2){ this.StartDate =D1; this.FinishDate =D2; } public Date CalculateDuration(){ return new Date(FinishDate.day - StartDate.hour, FinishDate.month - StartDate.month, FinishDate.year - StartDate.year); } } Find the output when the following code snippet is executed Date D1 = new Date(10,2,2009); Date D2 = new Date(12,3,2009); ConferenceSchedule CS1 = new ConferenceSchedule (D1,D2); (CS1.CalculateDuration()).displayDate(); a)2:1:0 b)-2:-1:0 c)Will not be executed since the return type of CalculateDuration() does not match with the function definition d)Will not be executed as day, month and year being private, cannot be accessed from objects of class Date e)Will not be executed as StartDate and FinishDate are not declared as public. 20. Ashok knows his name, age and hobby. He can show his name, age and his hobby. He/she celebrates his/her birthday every year. The code snippet for the class used to create Ashok is defined as follows: public class Person { private String name; private int age; private String hobby; public Person(String nm, int a, String hb) { name = nm; age = a; hobby=hb; } private String getname() { return name; } private int getage() { return age; }

37

public void celebrate_BDAY( int b_day_no) { age=b_day_no;

OOP Exercise Set 1 1. Identify the attributes & methods for a washing machine. Attributes: Width, Height, Length, Weight, Price, Capacity Methods: Wash, Dry, FillWater, DrainWater, SetTimer 2. Assume you are in a market to buy a car, identify the class (es) [Their attributes & methods] relevant in this scenario. class car { //Attributes float price; float maxSpeed; float mileage; string color; float horsePower; int numberOfGears; boolean airBags; boolean powerWindows; boolean powerSteering; boolean AC; int capacity; //Methods moveForward(); moveReverse(); turnACOn(); turnEngineOn(); turnWindowsUp(); turnWindowsDown(); }

3. Identify the relationships between the following classes. 1. Library & books in the library - Aggression 2. The recipes in a cookbook. - Aggression 3. The contents of an encyclopedia - Aggression 4. The grammar of FORTRAN - Composition 5. The grandparents of the children living in Springfield - Association 6. Course & Student - Association 7. Book & Chapter - Composition 8. Computer & Keyboard - Association 9. Team & Person - Aggression 10. Remix & Sound Clips - Composition

4. For a Library Management System, Identify the class, responsibility & Identity from the following:

1) Book - Class 38

2) 3) 4) 5) 6) 7) 8) 9)
5.

Book No - Identity Know Book No - Responsibility Know Title - Responsibility Know Purchase Price - Responsibility Know Purchased - Responsibility Know Date Published - Responsibility Know Purchase Date - Responsibility Know author - Responsibility Identify classes in the below scenario.

Consider the payroll system that processes employee records at a small manufacturing firm. The company has several classes of employees with particular payroll requirements & rules for processing each. The company has 3 types of employees: 1. Managers receive a regular salary 2. Office workers receive an hourly wage & are eligible for overtime after 40 hrs 3. Production workers are paid according to a piece rate Company Employee Manager Office Workers Production Workers 6. Identify classes in the below scenario. The gate-keeper at an amusement park is given the following instructions for admitting persons to the park (i) if the person is under three years of age, there is no admission fee. (ii) If a person is under 16, half the full admission fee is charged and this admission is reduced to a quarter of full admission if the person is accompanied by an adult (the reduction applies only if the person is under 12). Gate-Keeper Park Category1 visitor Category2 visitor Category3 visitor b. The telephone directory should contain entries for each person in the university community - Student, professor & staff member. Users of the directory can look up entries. In addition, the administrator of the telephone book, can after supplying a password, insert new entries, delete existing entries, modify existing entries, print the telephone book & print a listing of all students or all faculties. Identify the classes & their operations. Student Stores a students' information Professor Stores a professors' information Staff Member Stores a staff member's information Telephone Book Stores telephone entries.

1 39

You have to develop an object-oriented drawing application which can be used to draw circles, rectangles, lines, Bezier curves , and many other graphic objects. These objects all have certain states (for exaple position, orientation, line color , fill color) and behaviors ( for example : MoveTo, Rotate, Resize, Draw) in common. Some of these states and behaviors are the same for all graphic objects, e.g position , fill color, and moveTo. Other require different implementations such as resize themselves;they just differ in how they do it. Which Object oriented concept/concepts will you not apply to develop the above mentioned application. Options: a) Abstract class b) Polymorphism c) method overriding d) inheritance e) all of these f) none of these . 2. At ILP Guwahati three batches are there. Every morning at 11 a.m., a special bell rings at the center. The significance of the bell is that, it is the time for all Batch 1 to go to the library, for the batch 2 it is the time to go to the MPH and the batch 3 can go for a break. Which object oriented concept is related to the fact participant's response to the bell described in the above scenario? Options: 6. Inheritance 7. Polymorphism. 8. Composition. 9. Encaptulation 10. All of these 11. None of these.

3.

40

To write an efficient code to represent this class hierarchy, which of the following OOP technique can be used? Options: A.Composition B.Aggregation C.Inheritance D.Polymorphism E.Both b & d F.Both c & d

3. Following is a code snippet class A { float aFieldp; public String PrintName(String aName) { System.out.println(aName); return My Name; } public float PrintName() { System.out.println(aField); return aField; } 41

} class M {} class B extends A { public void PrintName(String astring) { System.out.println("My String"); } } Identify the OOP concept/concepts that are applied in the above code. Options: a) Method overriding b) None of these c)Method overloading d) Both a& b e) Both a & c 4. class A{ public void fun1(int x){ System.out.println("int in A"); } public void fun1(int x,int y){ System.out.println("int and int"); } } class C { public void fun1(int x){ System.out.println("int in C"); } } Identify the OOP concept that is/are used in the above code snippet. Options: a) method overloading b) method overriding 4 inheritance d) a, b,c e) none of these

42

1. Following is a code snippet. abstract class Figure { double dim1; double dim2; Figure(double a, double b) { dim1 = a; dim2 = b; } abstract double area(); public static void main(String args[]) { Rectangle r = new Rectangle(9, 5); Triangle t = new Triangle(10, 8); Figure figref; figref = r; System.out.println("Area is " + figref.area()); figref = t; System.out.println("Area is " + figref.area()); } } class Rectangle extends Figure { Rectangle(double a, double b) { super(a, b); } double area() { System.out.println("Inside Area for Rectangle."); return dim1 * dim2; } } class Triangle extends Figure { Triangle(double a, double b) { super(a, b); } double area() { System.out.println("Inside Area for Triangle."); return dim1 * dim2 / 2; } }

43

Identify the predominant OOP concept that is used. Options: a) compile time polymorphism b) run time polymorphism c) method overloading d).method overriding 1) a 2) b 3) c 4) a & c 5) b & d 6) a & d 2. Identify the code that represents method overloading Identify the code that represents method overriding. a) class student { int roll; public String name; public student(int r, String nm) { roll = r; name = nm; } public boolean compare(student s) { if (roll == s.roll) return true; else return false; } public int compare(student s, int a) { if (roll == s.roll) return roll; else return a; } } b) class student { int roll; public String name; public student(int r, String nm) {

44

roll = r; name = nm; } public boolean compare(student s) { if (roll == s.roll) return true; else return false; } public int compare(student s) { if (roll == s.roll) return roll; else return s.roll; } } c) class student { int roll; public String name; public student(int r, String nm) { roll = r; name = nm; } public boolean compare(student s) { if (roll == s.roll) return true; else return false; } } class UGStudent extends student { String major; UGStudent(int r ,String nm,String myMajor) {super (r,nm); major=myMajor; } public boolean compare(student s) { if (roll==s.roll) return true; else return false; } }

45

46

1. ____________ relationship among the use cases is that it allows you to show optional system behavior. 12. Includes 13. Extends 14. Generalization 15. Uses 16. none of these 2. UML is a 2. a language to model syntax 3. an object-oriented development methodology 4. an automatic code generation tool 5. none of the above 6. a,b,c 3. What is "the identification of common features (attributes and methods) to form an hierarchy of classes and sub-classes" a) b) c) d)
e)

Abstraction Generalization Cohesion Data hiding


Polymorphism

4.

The relationship shown between person and magazine is : 5 6 7 8 9 5. Which of the following is(are) true in the case of an actor in a use case diagram : 1. Must be part of the system. 2. Must be a person interacting with the system. 3. Maybe a person or another system interacting with the system. 47 Association. Aggregation. Dependency. Generalization. None of these

a. (i) & (ii) b. (iii) c. (ii) d. (i)

6.Consider

the below UseCase diagram :

Soda Machine

Restock

Suppliers Representative

Collect
Collector

the above diagram, the Suppliers Representative puts the soda can inside the soda machine and the Collector collects the money from the soda machine. For performing their actions they both have to unsecure and open the soda machine before perfoming their operations and close it and securing it again after performing their operations. In order to show the common steps to be perfomed for the operations Restock and Collect in the UseCase diagram, which of the following stereotypes can be used to eliminate the duplication of steps from the UseCase diagram : c. d. e. f. Aggregation Generalisation Inclusion extension

In

48

7.Suppose

an Order Management system exixts with the following uses cases: 1. manage customer details. 2. enter order 3. find customer record and 4. handle invalid product number

Identify the relationships (if any) between the following pairs of use cases. (i) 1&4 a. <<extend>> b. <<include>> c. <<uses>> d. None of these 2&3 a. <<extend>> b. <<include>> c. <<uses>> d. None of these 1&3 a. << extend>> b. <<include>> c. <<uses>> d. None of these 2&4 a. << extend>> b.<<include>> c.<<uses>> d.None of these

(ii)

(iii)

(iv)

8.

Consider the following UseCase diagram and answer the below questions :

49

Employees Personal System


ChangeEmployeeDetails

ViewEmployeeDetails

FindEmployeeDetails

Manager DeleteEmployeeDetails

i) State whether the following statement is true or false : FindEmployeeDetails is the base UseCase for the other three UseCases.. TRUE -

ii) The relationship between the UseCase ChangeEmployeeDetails and FindEmployeeDetails : a. Extension. b. Inclusion. c. None of the above. 7. Raju has to take his mother to the doctor. He drives a car and brings his mother to the doctor. Raju's car rotates four wheels to move the car. Identify the class diagram that represents the relationship between Raju, his car and wheels. a)

50

b)

c)

51

d)

52

e)

f) None of the options. g)

53

2. Raju is an instrumentalist. He plays Wind instrument to entertain people. He plays percusion and stringed instruments also to perform on stage. Raju can play wood wind as well as brass wind. Identify the class diagram that best represents the relationship between Raju, Wind, Percusion and Stringed instruments as described in the above scenerio. a)

b)

54

c)

d)

e)

55

f)

56

10 An automobile is a type of vehicle. Identify the class diagram that best describe the above scenerio. a) 57

b)

c)

d)

58

4. The Online CD ordering system has a single actor: the on-line customer. The customer can browse the catalog, search for a CD, add a CD to the order, view the order details, and place the order. Both "View Order Details" and "Place Order" use "Calculate Order Total". Identify the use case diagram that represents the Online CD ordering system. a)

59

b)

c)

60

d)

e) None of these 61

g. A school can have many students. Each student has to take a course but one student can take at most 6 courses. For a course at least there is one student in the school who has taken the course. Identify the class diagram that represent the above scenario. h. a)

b)

c) 62

d)

63

e)

6. Identify the use case diagram that best describes the scenarios Drive Car, Apply Break, Take turn ,take left turn and take right turn. a)

64

b)

c)

65

d)

e)

66

d. Identify the relation between class AddClip & Channel class AddClip{ private String name; //rest of attributes of AddClip public void reset(){ // } public void playOn(Channel c){ c.start(); } } class Channel { private String name; //rest of the attributes of Channel public void tune(){ //code for the implementation } public void start(){ //code for the implementation } public void stop(){ //code for the implementation } public void setFrequency(){ //code for implementation } 67

} 17. 18. 19. 20. 21. Association Composition Dependency Aggregations Inheritance

Course Id: TP486_ENG-1285029887(study mode) Course Title: TestPrep 486 Object-Oriented Analysis and Design with UML OMI Link... http://www.ibm.com/developerworks/rational/library/769.html - UML Basics http://www.ibm.com/developerworks/rational/library/content/RationalEdge/sep04/ bell/index.html - Class Diagram http://www.ibm.com/developerworks/rational/library/3101.html - Sequence Diagram http://books.google.co.in/books?id=s1sIlw83pQC&printsec=frontcover&dq=Elements+of+UML+2.0#v=onepage&q=&f=false The elements of UML 2.0 style TP486_ENG-1285029887 Design OO 1.
What is "the identification of common features (attributes and methods) to form an hierarchy of classes and sub-classes" a) b) c) d) e) Abstraction Generalization Cohesion Data hiding Polymorphism (1 mark)

2.

Circle

Point

The diagram above doesnt depict the correct notation for the relationship if any between Circle and Point. Identify the most appropriate relationship if any between the Circle class and Point class.

68

11 12 13 14 3.

Composition Generalization Aggregation None of these

(2 marks)

The relationship shown between person and magazine is : e. f. g. h. 4. Association. Aggregation. Dependency. Generalization.

(2 marks)

The interaction between different objects in a sequence diagram is represented as ________

f. g. h. i.

Data Methods Messages Instances

(1 marks)

5.

. Identify the synchronous messages from the following sequence diagram

a) manageCourse, createCourse b) manageCourse, assignTutorToCourse

69

c) createCourse, createTopic d) createTopic, assignTutorToCourse e) courseID, topicID 6.

(2 marks)

What is purpose of Sequence diagram? a) Emphasize the temporal aspect of a scenario b) Emphasize the spatial aspect of a scenario. c) All the above d) None of these
(1 marks)

7.

Which of the follwing statement is true in sequence Diagram? a) Horizontal axis represents the passage of time b) Vertical axis represents the objects involved in a sequence c) None of the options d) all of the options
(1 marks) RA OO 8.
Which of the following is(are) true in the case of an actor in a use case diagram : 1. 2. 3. a. b. c. d. Must be part of the system. Must be a person interacting with the system. Maybe a person or another system interacting with the system. (i) & (ii) (iii) (ii) (i) only

(2 mark)

9.

Consider the below UseCase diagram :

Soda Machine

Restock

Suppliers Representative

70

Collect
Collector

In the above diagram, the Suppliers Representative puts the soda can inside the soda machine and the Collector collects the money from the soda machine. For performing their actions they both have to unsecure and open the soda machine before perfoming their operations and close it and securing it again after performing their operations. In order to show the common steps to be perfomed for the operations Restock and Collect in the UseCase diagram, which of the following stereotypes can be used to eliminate the duplication of steps from the UseCase diagram : 10. Aggregation Generalisation Inclusion Extension

(2 marks)

Which of the following is/are true in the case of use cases : 1) 2) 3) 4) a. b. c. d. e. A use case can exist without an actor. System-level use cases should represent both functional and non-functional requirements. A use case describes the interaction between the system and one or more actors. Use cases provide a basis for performing system tests that verify that the system works appropriately and validate it.

(i) ,(ii) & (iii) (ii) & (iii) Only (iii) (iii) & (iv) None of these

Q10) You have a file called docs. Z but do not know what it is. What is the easiest way to look at the contents of the file? a. Use zcat to display its contents. b. Use uncompress to expand the file and then use emacs to display the files contents. c. Copy the file to a floppy disk and uncompress it under Windows. d. Use tar -xt to display the file's contents. Answer: a 1 mark 71

Q11) You want to verify which lines in the file kickoff contain 'Bob'. Which of the following commands will accomplish this? a) sed -n /Bob/p kickoff b) sed /Bob/p kickoff c) sed -n 'Bob p' kickoff d) sed /Bob/ kickoff Answer: a 1 mark Q12) You search for the word prize in the file kickoff by typing grep prize kickoff. However you also find lines containing prize as part of a word such as prizes but do not find Prize. How should you change the command to find all occurrences of prize as a word and not part of a word? a) grep -lc prize kickoff b) grep -cw prize kickoff c) grep -vi prize kickoff d) grep -iw prize kickoff Answer: d 1 mark Q13) You want to know how many lines in the kickoff file contains 'prize'. Which of the following commands will produce the desired results? a) grep -n prize kickoff b) grep -c prize kickoff c) grep -v prize kickoff d) grep prize kickoff Answer: b 1 mark Q14) You want to construct a regular expression that will match all lines that end with 'stuff'. Which of the following expressions will do this? a) ^stuff b) stuff$ c) $stuff d) stuff^ Answer: b 1 mark Q15) You have an object salaried_employee which has operations like compute_tax and compute_pf. What characteristic of OOPS is followed here 72

a) Polymorphism b) Abstraction c) Encapsulation d) Hierarchy Answer b 2 marks Q16) Which characteristic of the Unified process signifies a process of giving a continuous feedback to improve the final product? a) Incremental b) Iterative c) Architecture-Centric d) Use Case driven Answer: b 1 mark Q17) What relationship is shown in the following use case diagram. a) Specialization b) Association c) Generalization d) None of the above Answer: c 2 marks

Q17) How do you represent a class in a UML? a) Sequence diagram b) Class Diagram c) Use case diagram d) All of the above Answer: b 1 mark

73

Q19) Choose one out of the following. UML is a ____ a) Process b) Method c) Notation d) None of the above Answer: c 1 mark Q22) A sequence diagram is: a) a time-line illustrating a typical sequence of calls between object function members b) a call tree illustrating all possible sequences of calls between class function members c) a time-line illustrating the changes in inheritance and instantiation relationships between classes and objects over time d) a tree illustrating inheritance and relationships between classes e) a directed acyclic graph illustrating inheritance and instantiation relationships between classes and objects Answer: a 1 mark Q23) A ____________ exists between two defined elements if a change to the definition of one would result in a change to the other a) Dependency b) Multiplicity c) Realization d) Generalization Answer: a 1 mark Q24) Which characteristic of the Unified process signifies a process of giving a continuous feedback to improve the final product? a) Incremental b) Iterative c) Architecture-Centric d) Use Case driven Answer: b 2 marks Q25)

74

Which of the following statements is bug? a) ddd is an attribute b) iii is a class c) mmm is a method d) ppp is a method e) hhh is a class Answer: a, c and e 3 marks Q11) You know that the info utility provides easier to understand documentation but you have never used it. How can you access a tutorial on using info? a. man info b. info c. info info d. info help Answer: a and b 2 marks Q12) You want to know how much space is being occupied by your user's home directories. Which of the following will provide you with this information? a. du -l /home b. du -b /home c. du -m /home d. du -c /home Answer: d 1 mark Q13) What should you type to change the runlevel of your system? a. init [runlevel] b. halt [runlevel] c. /etc/inittab d. sys init [runlevel] Answer: a 1 mark

75

Q14) Where are the startup scripts defined? a. /etc/initd b. /etc/scripts c. /etc/start d. /etc/inittab Answer: d 1 mark Q15) You are going to install a new hard disk in your system. Which of the following commands will halt your system so you can install the new hardware? a) shutdown -k now b) shutdown -h now c) shutdown -r now d) shutdown -t now Answer: b 1 mark Q16)

Which one of the following statements is false:a) aaa and hhh are linked by a gen-spec relationship b) sss is a method of hhh c) hhh is a specialisation of aaa d) ooo and hhh are linked by a whole-part relationship e) bbb is an attribute of hhh Answer: b and e 3 marks Q17) When does a bug in a program result? a) Program built under unsafe environment b) Program not neat c) There are errors in logic, code and design d) All the above Answer: c 1 mark 76

Unix:
Q31) You have a file called docs.Z but do not know what it is. What is the easiest way to look at the contents of the file? a. Use zcat to display its contents. b. Use uncompress to expand the file and then use emacs to display the files contents. c. Copy the file to a floppy disk and uncompress it under Windows. d. Use tar -xt to display the file's contents. Answer: a Q32) You want to verify which lines in the file kickoff contain 'Bob'. Which of the following commands will accomplish this? a. sed -n /Bob/p kickoff b. sed /Bob/p kickoff c. sed -n 'Bob p' kickoff d. sed /Bob/ kickoff Answer: a Q33) You search for the word prize in the file kickoff by typing grep prize kickoff. However you also find lines containing prize as part of a word such as prizes but do not find Prize. How should you change the commandto find all occurrences of prize as a word and not part of a word? a. grep -lc prize kickoff b. grep -cw prize kickoff c. grep -vi prize kickoff d. grep -iw prize kickoff Answer: d Q34) You want to know how many lines in the kickoff file contains 'prize'. Which of the following commands will produce the desired results? a. grep -n prize kickoff b. grep -c prize kickoff c. grep -v prize kickoff 77

d. grep prize kickoff Answer: b Q35) You want to construct a regular expression that will match all lines that end with 'stuff'. Which of the following expressions will do this? a. ^stuff b. stuff$ c. $stuff d. stuff^ Answer: b Q36) You know that the info utility provides easier to understand documentation but you have never used it. How can you access a tutorial on using info? a. man info b. info c. info info d. info help Answer: a and b Q37) You want to know how much space is being occupied by your user's home directories. Which of the following will provide you with this information? a. du -l /home b. du -b /home c. du -m /home d. du -c /home Answer: d Q38) What should you type to change the runlevel of your system? a. init [runlevel] b. halt [runlevel] c. /etc/inittab d. sys init [runlevel] Answer: a Q39) Where are the startup scripts defined? a. /etc/initd b. /etc/scripts 78

c. /etc/start d. /etc/inittab Answer: d Q40) You are going to install a new hard disk in your system. Which of the following commands will halt your system so you can install the new hardware? a. shutdown -k now b. shutdown -h now c. shutdown -r now d. shutdown -t now Answer: b

Use Case Diagram:


Q41) You have an object salaried_employee which has operations like compute_tax and compute_pf. What characteristic of OOPS is followed here a) Polymorphism b) Abstraction c) Encapsulation d) Hierarchy Answer b 2 marks Q42) Which characteristic of the Unified process signifies a process of giving a continuous feedback to improve the final product? a) Incremental b) Iterative c) Architecture-Centric d) Use Case driven Answer: b 2 marks Q43) What relationship is shown in the follwoing use case diagram. a) Specialization b) Association c) Generalization d) None of the above Answer: c 2 marks

79

Q44) How do you represent a class in a UML? a) Sequence diagram b) Class Diagram c) Use case diagram d) All of the above Answer: b 1 mark Q45) Choose one out of the following. UML is a ____ a) Process b) Method c) Notation d) None of the above Answer: c 1 mark Q46) ____________ takes an external perspective of the test object to derive test cases. These tests can be functional or non-functional, though usually functional. The test designer selects valid and invalid input and determines the correct output. There is no knowledge of the test object's internal structure. a) Black box testing b) White box testing Answer: a 2 marks Q47) Which of the following is not a tool for designing modular systems a) Structure charts b) Data dictionaries c) Class diagrams d) Collaboration diagrams Answer: b 2 marks Q48) A sequence diagram is: 80

a) a time-line illustrating a typical sequence of calls between object function members b) a call tree illustrating all possible sequences of calls between class function members c) a time-line illustrating the changes in inheritance and instantiation relationships between classes and objects over time d) a tree illustrating inheritance and relationships between classes e) a directed acyclic graph illustrating inheritance and instantiation relationships between classes and objects Answer: a 1 mark Q49) A ____________ exists between two defined elements if a change to the definition of one would result in a change to the other a) Dependency b) Multiplicity c) Realization d) Generalization Answer: a 1 mark Q50)

Which of the following statements is false: a) ddd is an attribute b) iii is a class c) mmm is a method d) ppp is a method e) hhh is a class Answer: a, c and e 2 marks Q51) Which one of the following statements is false:a) aaa and hhh are linked by a gen-spec relationship b) sss is a method of hhh c) hhh is a specialisation of aaa d) ooo and hhh are linked by a whole-part relationship 81

e) bbb is an attribute of hhh Q52) Which one of the following statements is false:a) ooo and hhh are linked by a whole-part relationship b) hhh is a specialisation of aaa c) sss is a method of hhh d) bbb is an attribute of hhh e) aaa and hhh are linked by a gen-spec relationship Q53) What is the difference between activity and sequence diagram? a) Using Sequence diagram it can be shown how processes execute in sequence; for example what operations are called in what order and what parameter. While using Activity diagram operational workflows can be shown. b) Actors cannot be created in sequence diagram as interactions may not contain actors. c) Both are same d) (a) and (b) 2 marks
Use Case Questions

1. Which statements are true for an Actor?


a) an actor is a role a user plays with respect to the system b) generalization is not applicable to actors c) an actor does not need to be human. A subsystem or external system can be modelled as an actor d) a and c e) b and c (Easy)

2. Which statements are true for an Actor?

82

Enroll Student Student

Enroll in Seminar

International Student

Enroll International Student

The diagram above doesnt depict the correct notation between the use cases Enroll Student - Enroll In Seminar Enroll International Student - Enroll Student Identify the most appropriate relationship between the use casesEnroll International Student and Enroll Student.
a) <<include>> b) <<extend>> c) <<uses>> d) None of the above (Complex)

3. Identify the most appropriate relationship between the use


casesEnroll Student and Enroll In Seminar.
a) b) c) d) (Complex) <<include>> <<extend>> <<uses>> None of the above

4. Which are valid relationships in Use Case Diagrams?


a) b) c) d) include extract subtyping generalization

(Moderate)

83

Class Diagram Questions

5. Which relationships in Class diagram shows inheritance


relationships?
a) b) c) d) (Easy) Aggregation Composition Specialization Association

6.

Customer

Order

The diagram above doesnt depict the correct notation for the relationship if any between Customer and Order. Identify the most appropriate relationship if any between the Circle class and Point class. a) b) c) d) (Easy) Generalization Aggregation Association None of these

7.

Car

Wheel

The diagram above doesnt depict the correct notation for the relationship if any between Customer and Order. Identify the most appropriate relationship if any between the Circle class and Point class. a) b) c) d) (Easy) Generalization Aggregation Association None of these

8. Aggregation (encapsulation) relationships are represented in the UML


notation by:
a) Nesting of classes

84

b) c) d) e) (Easy)

lines lines lines lines

with a solid diamond at one end with a hollow diamond at one end with an arrow at one end without an arrow at either end

9. Inheritance relationships are represented in the UML notation by :


a) b) c) d) Nesting of classes lines with a solid diamond at one end lines with a hollow diamond at one end lines with a triangular arrow at one end lines with a triangular arrow at both ends

e)
(Easy)

10. What is the association multiplicity indicator for "zero or more" in


UML notation? Select the correct answer:
a) b) c) d) (Easy) Sequence Diagram Questions 0->* *..0 0..* 0->more

11. getID() belongs to which class, in the below diagram? :A getID() getID() :B :C

a) b) c) d)

Both A & B Both C & B Only C A, B & C

(Moderate)

85

12. Identify which all the statement(s) is(are) true.


a) Sequence diagrams emphasize the temporal aspect of a scenario. b) Collaboration diagrams emphasize the spatial aspect of a scenario.
c) Both Sequence diagrams and Collaboration diagrams represents the types of Interactions diagrams. d) All of the above (a , b & c) e) Only a & b (Easy)

13. Can we show the return type of message call in sequence diagram?
a) Yes b) No

(Easy)

14. Which of the following notation is true about visibility in sequence


diagram? a) b) c) d)
(Easy)

+ = * -

is used for public element. is used for private element is used for private element is used for public element

15. Sequence diagram


a) b) c) d)

interaction between objects by message passing Specifies the behavior of a system or a part of a system. Specification of a communication All of the above

86

:UI Update() Enterdetails()

: Employee details

update-employee() getEmployeeid()

Alt

(If valid employee id) Savedetails() Confirmation

16. In the given diagram, Update() is not present in UI class?


a) True b) False (Hard)

17. In the given diagram, Enterdetails () is not present in UI class?


a) True b) False (Hard)

18. In the given diagram, update-employee () is present in which class?


a) UI b) Employee Details

(Moderate)

8. Raju has to take his mother to the doctor. He drives a car and brings his mother to the doctor. Raju's car rotates four wheels to move the car. Identify the class diagram that represents the relationship between Raju, his car and wheels. a) 87

b)

c)

88

d)

e)

89

f) None of the options. g)

2. Raju is an instrumentalist. He plays Wind instrument to entertain people. He plays percusion and stringed instruments also to perform on stage. Raju can play wood wind as well as brass wind. Identify the class diagram that best represents the relationship between Raju, Wind, Percusion and Stringed instruments as described in the above scenerio.

90

a)

b)

c)

d)

91

e)

92

f)

15 An automobile is a type of vehicle. Identify the class diagram that best describe the above scenerio. a)

b)

93

c)

d)

4. The Online CD ordering system has a single actor: the on-line customer. The customer can browse the catalog, search for a CD, add a CD to the order, view the order details, and place the order. Both "View Order Details" and "Place Order" use "Calculate Order Total". Identify the use case diagram that represents the Online CD ordering system. a)

94

b)

c) 95

d)

e) None of these i. A school can have many students. Each student has to take a course but one 96

student can take at most 6 courses. For a course at least there is one student in the school who has taken the course. Identify the class diagram that represent the above scenario. j. a)

b)

c)

97

d)

e)

98

2. Identify the use case diagram that best describes the scenarios Drive Car, Apply Break, Take turn ,take left turn and take right turn. a)

b)

99

c)

d)

e)

100

i. Identify the relation between class AddClip & Channel


class AddClip{ private String name; //rest of attributes of AddClip public void reset(){ // } public void playOn(Channel c){ c.start(); } } class Channel{ private String name; //rest of the attributes of Channel public void tune(){ //code for the implementation } public void start(){ //code for the implementation } public void stop(){ //code for the implementation } public void setFrequency(){ //code for implementation }

22. 23. 24. 25.

Association Composition Dependency Aggregation

101

26.

Inheritance

Design OO 1.
What is "the identification of common features (attributes and methods) to form an hierarchy of classes and sub-classes" a) b) c) d) e) Abstraction Generalization Cohesion Data hiding Polymorphism (1 mark)

2.

Circle

Point

The diagram above doesnt depict the correct notation for the relationship if any between Circle and Point. Identify the most appropriate relationship if any between the Circle class and Point class. 16 17 18 19 Composition Generalization Aggregation None of these

3.

(2 marks)

The relationship shown between person and magazine is : j. k. l. m. 4. Association. Aggregation. Dependency. Generalization. (2 marks)

The interaction between different objects in a sequence diagram is represented as ________

j. k. l. m.

Data Methods Messages Instances

(1 marks)

102

5.

. Identify the synchronous messages from the following sequence diagram

f) g) h) i) j) 6.

manageCourse, createCourse manageCourse, assignTutorToCourse createCourse, createTopic createTopic, assignTutorToCourse courseID, topicID

(2 marks)

What is purpose of Sequence diagram? a) Emphasize the temporal aspect of a scenario b) Emphasize the spatial aspect of a scenario. c) All the above d) None of these
(1 marks)

7.

Which of the follwing statement is true in sequence Diagram? a) Horizontal axis represents the passage of time b) Vertical axis represents the objects involved in a sequence c) None of the options d) all of the options
(1 marks) RA OO 8.
Which of the following is(are) true in the case of an actor in a use case diagram : 4. Must be part of the system.

103

5. 6. e. f. g. h. 9.

Must be a person interacting with the system. Maybe a person or another system interacting with the system. (i) & (ii) (iii) (ii) (i) only (2 mark)

Consider the below UseCase diagram :

Soda Machine

Restock

Suppliers Representative

Collect
Collector

In the above diagram, the Suppliers Representative puts the soda can inside the soda machine and the Collector collects the money from the soda machine. For performing their actions they both have to unsecure and open the soda machine before perfoming their operations and close it and securing it again after performing their operations. In order to show the common steps to be perfomed for the operations Restock and Collect in the UseCase diagram, which of the following stereotypes can be used to eliminate the duplication of steps from the UseCase diagram : 10. Aggregation Generalisation Inclusion Extension

(2 marks)

Which of the following is/are true in the case of use cases : 1) 2) A use case can exist without an actor. System-level use cases should represent both functional and non-functional requirements. 104

3) 4) f. g. h. i. j.

A use case describes the interaction between the system and one or more actors. Use cases provide a basis for performing system tests that verify that the system works appropriately and validate it.

(i) ,(ii) & (iii) (ii) & (iii) Only (iii) (iii) & (iv) None of these (1 mark)

RA Structured

11.

k. An invoice must have one Purchase order and purchase order may or may not have many invoices. l. An invoice has one purchase order and purchase order have many invoices. m. An invoice has must one purchase order and purchase order must have one or more invoices. n. A purchase order must have an invoice and an invoice amy or maynot have purchase orde

12.

Which one is correct? 1.

105

2.

3.

4.

( 1 mark) 13. Identify the inappropriate entities in ERD of ABC Banking system shown below. 106

Treasurer is the user of the ABC banking system. Treasurer manages the Database of the ABC Bank. Treasurer also receives the expense report which is nothing but a consolidated expense charged for an account.

Treasurer Expense Report Account Expense I and ii ( 2 marks)

107

14.

Account details C Customer P1


M Account

Update Account

Details
Customer Details

M1

Customer Details

. Choose the error in the DFD above if any i) P1 cannot be in a loop ii) No error iii) P1 cannot write to 2 data store iv) Output from P1 is same and cannot be written to two different data store 1. 2. 3. 4. I and iii Ii I and iv Iii and iv

( 2 marks)

15. In DFD open-ended rectangles representing____________ including electronic


stores such as databases or XML files and physical stores such as or filing cabinets or stacks of paper.

i. data flows ii entities. iii. processes iv. data stores


( 1 mark) Design Structured

108

16.

Normalize the table to 3NF

R1 NoteNo 300 300 300

Packer Jony Jony Jony

Name Bloggs Bloggs Bloggs

Address Chennai Chennai Chennai

ItemNo 1 2 3

Qty 120 200 300

PartNo 1234 3000 3321

Desc Nuts Bolts Washer

f. PackaingNote{NoteNo,Packer,Name} g. CustomerDeatails{Name,Address} h. PackingNoteItem(NoteNo,ItemNo,Qty,PartNo) i. Part (PartNo,Desc) 5) PackaingPart(NoteNo,ItemNo,Qty,PartNo,Desc) 6) Packer(NoteNo,Packer,Name,Address) a) 1,2,3,4 b) 1,3,4,5 c) 1,2, 5 d) 5,6 ( 3 marks) 17. Choose the statements which state the benefit of Structure Chart
5. 6. 7. 8. Sequential ordering of the modules Data interchange among modules Procedural implementation of the modules Various modules that represent the system. 1.I only 2.I, ii and iv 3.Ii and iv 4.Iii and iv 5.None of the above

( 2 marks)

17.

Arrows with filled circles in Structure chart represent Data passing among different modules call from lower module to high level modules control flag flow between modules shows iteration ( 1 mark) For converting a given table to 1 NF we need to a. Remove the repeating groups b. Remove partial dependencies c. Remove transitional dependencies d. All the above ( 1 mark)

i) 27. 28. 29. (iv)

19.

109

Assuming that the entity types have the following attributes:


Course(course_no, c_name), Student(matric_no, st_name, dob). Choose the set of

relations tht are produced after mapping the ERD to

relations Course(course no, c_nema) and Student(matric_no, st_name, dob, course_no) n. Matriculate (course no, matric_no, c_nema) o. Matriculate (course no, matric_no, c_nema, st_name, dob) p. Course(course no, c_nema, matric_no) and Student(matric_no, st_name,dob) q. None of these.
20.

Assuming that the entity types have the following attributes:


Student(matric_no, st_name, dob), Module(module_no, m_name, level, credits) Choose the correct set of relations that are produced

after mapping the ERD to relations

3. Student(matric_no, st_name, dob),Module(module_no, m_name, level, credits), Studies(matric_no,module_no) 4. Student(matric_no, st_name, dob, module_no) 5. Module(module_no, m_name, level, credits,matric_no) 6. None of these. 7. Either (a) or (b) or (c) Marks 3 21. checking for 3NF consists of a) there are no no-atomic attributes in the relation b) degree of the relation c) checking that all attributes in the relation depends on the primary key. d) checking for a situation where an attribute is in the relation but that attribute is better defined by some other attribute that is not the primary key. e) a , c , d f) a , b , c Marks 1 22.Which of the following are true with respect to normalization: a) Normalization is the process of efficiently organizing data in a database.
b) c) d) e) Goal of normalization is eliminating redundant data . It reduce the amount of space a database consumes. All of these. None of these.

110

23. To bring a relation to 1 NF a) Eliminate duplicative columns from the same table. b) Create separate tables for each group of related data and identify each row with a unique column or set of columns. c)Remove subsets of data that apply to multiple rows of a table and place them in
separate tables. d) a & c e) a & b

Marks 2

24

CUSTOMER table is as follows:

CUSTID C1011 C1001 C2010 C3300

CUSTNAME Mr. Mohan Mrs. Shahsi Mr. Barua Mr. Dutta

DESIGNATION LDA UD LDA LDA

HOUSENO G45 H16 A09 C10

STREET M.G Street K.K Street M.L Street P.K Street

CITY Delhi Delhi GHT GHT

ZIP 320001 320001 781001 781001

In which normal form the table is 9. Unnormalized 10. Second normal form 11. First normal form 12. Third normal form 13. Fourth normal form. Marks 3 23.The unnormalized relation ORDERFROM is given as

ORDERFROM (Order No, Order Date, Customer No, Customer Name, Product No, Product Description, Qty Ordered ) . After decomposition the following relations are formed ORDERFROM ( Order No, Order Date, Customer No, Customer Name ),

ORDERLINE ( Order No, Product No, Product Description, Qty Ordered ), PRODUCT (Product No, Product Description), Which of the following are in 1NF a) ORDERFROM b) ORDERLINE c) PRODUCT d) b & c e) a, b &c

1. SriLankan Holidays , the leisure arm of SriLankan Airlines invites Indian kids to a holiday Sri Lanka. On offer are four exciting tours, Holiday in Colombo, Holiday on the Beach,Holiday in Negombo and Holiday in Kandy.

111

A minimum of two adults purchasing the package entitles a maximum of two children below the age of 12 to these holiday packages. These special packages include return airfare on SriLankan Airlines including Fuel Surcharge for adult tickets, accommodation on Bed & Breakfast basis, airport and internal transfers, transportation by air-conditioned vehicle and English speaking chauffeur guide with a city tour of Colombo. Unbeatable travel deals have become the trademark of SriLankan Holidays which works with a global network of hotels and tour operators to offer holidaymakers excellent value-for-money travel packages in the airline's destinations. These range from leisure travel for individuals, couples and families, to business travel, adventure travel, sports tourism, cultural tours, and MICE tourism(Meeting, Incentives, Conventions and Exhibitions) Identify the classes from the above depicted scenario. Options: a) Kid, SriLankan Holidays, SriLankan Airlines,Travel,Tour, Package b) Tour,Package,Ticket,Holiday maker c) Tour, Package,Ticket, Fuel Surcharge,Accommodation, internal transfer,vehicle, Guide, Holidaymaker d) Kid , Parent,Tour,Package, Ticket,Airline e) Kid, Parent, Airline,Holiday, Package, Tour,Holiday maker Ayur the pioneer brand in the Herbal cosmetic market launched its new range of natural colour cosmetics, under the brand name WOMSEE. The products are made of pure herbs without any harmful chemical ingredients. Mr. Dilvinder Singh Narang, Managing Director, Ayur Herbal Cosmetics said, We are delighted to introduce a new brand of natural colour cosmetic to our consumers. There will be six different ranges of products under WOMSEE namely Foundation, Compact, Thirty six shades of lipsticks, Twelve shades of Lip glosses, Mascara and EyeLiners. Identify the objects from the above scenario. Options: a) Ayur, Mr. Dilvinder Singh Narang b)Ayur, WOMSEE, Mr. Dilvinder Singh Narang c)Ayur,WOMSEE, Mr. Dilvinder Singh Narang,Foundation, Compact, Lipstick,Lip gloss, Mascara, Eye-Liner d) Ayur, Mr. Dilvinder Singh Narang,Foundation, Compact, Lipstick,Lip gloss, Mascara, Eye-Liner e) WOMSEE, Mr. Dilvinder Singh Narang

Mrs Hldar is very expert in making cakes and cookies. She makes Blueberry Cheese Cake for her son's birthday. 112

The ingredients required to prepare Blueberry Cheese Cake are 200 gm Blueberry, 3 Egg yolk, 50 gm sugar, 250 gm cheese, 500 gm rich cream,20 gm gelatin and 200gm sponge vanilla. Mrs Halder is going to follow the recipe by Sarita Dalal. To make the cake, she adds sugar and egg yolks in a bowl and whisk it until if becomes fluffy. To that mixture, cheese, cream, and Blueberry are added. For the base of the cake, a cake tin is lined with vanilla sponge. The gelatin mixed with warm water is added to the main mixture and spread evenly on the base which is then refrigerated for a couple of hours. Identify the relationship between the Blueberry cake and its ingredients. Options: a) composition b) aggregation c) dependency d) inheritance e) none of these A company produces products like shampoo, bathing soap and biscuits. The revenue generated by the company is increased this year over the last year. The revenue generated by shampoo is increased by 50%, by bath soap is 30% and by biscuit is 20%. The code written to calculate the revenue generated by each of the products are give as below. abstract class product { public String product_code; public String product_description; public double unit_price; public product(String p_code,String description, double price) { product_code=p_code; product_description = description; unit_price= price; } public abstract double FindRevenue(double last_revenue); } class Soap extends product { private String flavour; public Soap(String myflavour,String p_code,String description,Double price) { super(p_code,description,price); flavour=myflavour; } public double FindRevenue(double last_revenue) 113

{ return (last_revenue + last_revenue * .3); } } class Shampoo extends product { private String flavour; public Shampoo(String myflavour,String p_code,String description, double price) { super(p_code,description,price); flavour=myflavour; } public double FindRevenue(double last_revenue) { return (last_revenue + last_revenue * .5); } } class Biscuit extends product { public Biscuit(String p_code,String description, double price) { super(p_code,description,price); } public double FindRevenue(double last_revenue) { return (last_revenue + last_revenue * .2); } } Identify the OOP concept that is/are applied. Option: a) method overriding b) method overloading c) association d) all of these e) none of these

There are ten animals ---two each lions, panthers, bisons, bears, and deer---in a zoo. The enclosures in the zoo are named X,Y,Z,P and Q and each enclosure is allotted to one of the following attendants,Jack, Mohan, Shalini, Suman and Rita. Two animals of different species are housed in each enclosure. Identify the classes from the above depicted scenario. Options: 114

a) lion,panther , bison, bear,deer,Mohan ,Shalini, Suman ,Rita,X,Y,Z,P and Q b) animal,species,loin,panther,bison,bear,enclosure,attendant c) Animal,loin,panther,bison,bear,enclosure,attendant d) lion , panther,boson,deer,enclosure,attendant e) Animal,enclosure, attendant.

A bus of Haryana road which costs Rs. 7,20,000 to the government make a trip to and from Hisar to Delhi in a day. There are 50 seats in the bus and there is no seat vacant both times. The driver of the bus charged Rs. 250 and the conductor charged Rs. 200 for one day. The maintenance charges of the bus is Rs. 750 per day. The bus consumes 50 litres of fuel per day at the rate of Rs 40. Identify the knowing responsibilities of the bus. Options: a) source of trip , destination of trip, total seats,vacant seats,maintenance charge, fuel consumed b) cost to the government, trip to , trip from,total seats, vacant seats, occupied seats, fuel consumption, fuel price c)cost to the government, trip to , trip from,total seats, vacant seats, occupied seats, fuel consumption, fuel price,driver's charge,conductor's charge d)total seats, vacant seats, maintenance charge, fuel consumed e) total seats, vacant seats, occupied seats,maintenance charge, fuel consumed 30. For a banking system Bank customer is an actor. A customer can use the system to deposit money and withdraw money. The following are the scenarios identified for the system withdraw cash, deposit cash , transfer between accounts and validate customer Identify the scenarios between which there will be includes relationship. Options: a) withdraw cash , validate customer b) deposit cash , validate customer c) transfer between accounts , validate customer d) withdraw cash , transfer between accounts e) deposit cash , transfer between accounts f) a,b &c g) a,b h) a,b,c,d,e 9. From a video store all the valid members can rent a video and can return a video taken for rent. The clerk of the store can also rent a video and return it. A clerk can also maintain video records. Identify the use case diagram that represents the system for the given scenario. a)

115

b)

c)

116

d)

e) None of these

117

118

También podría gustarte