Ruby and Ruby on Rails
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Aakhri Jung!

5 posters

Page 1 of 3 1, 2, 3  Next

Go down

Aakhri Jung! Empty Aakhri Jung!

Post by Admin Fri Apr 29, 2016 5:54 am

Use this thread for Final

Admin
Admin

Posts : 17
Join date : 2016-02-12

https://rubyror.forumotion.com

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by ledzep93 Fri Apr 29, 2016 6:31 pm

Just checking.

ledzep93

Posts : 9
Join date : 2016-04-29

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by gorydog Fri Apr 29, 2016 9:50 pm

testing

gorydog

Posts : 10
Join date : 2016-04-29

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by sasti_randi Fri Apr 29, 2016 11:13 pm


sasti_randi

Posts : 14
Join date : 2016-04-29

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by sasti_randi Sat Apr 30, 2016 12:03 am

(a) Allow users to scan over and access the elements of a collection without knowing the underlying representation of the collection.


(b) You are tasked with designing an application for scheduling a conference room. This process uses web services from the facilities team for heating, IT team for audiovisual and with security to grant access to the rooms at the booked time. However, to save employees’ time you create simple interface which takes care of this in the background. What pattern is used here.


(c) You are designing a web interface for both computers and mobile devices. Depending upon the type of the device, appropriate interfaces for the underlying platform should be invoked.


(d) A design pattern that requires making the constructor private.

sasti_randi

Posts : 14
Join date : 2016-04-29

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by sasti_randi Sat Apr 30, 2016 12:04 am

(a) Allow users to scan over and access the elements of a collection without knowing the underlying representation of the collection.
iterator

(b) You are tasked with designing an application for scheduling a conference room. This process uses web services from the facilities team for heating, IT team for audiovisual and with security to grant access to the rooms at the booked time. However, to save employees’ time you create simple interface which takes care of this in the background. What pattern is used here.
facade

(c) You are designing a web interface for both computers and mobile devices. Depending upon the type of the device, appropriate interfaces for the underlying platform should be invoked.
template

(d) A design pattern that requires making the constructor private.
singelton

sasti_randi

Posts : 14
Join date : 2016-04-29

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by Admin Sat Apr 30, 2016 12:08 am

b)You are developing a game, and your task is to change an actress's physical positions based on her previous conditions. For instance, If actress is standing, and user presses "Up", she should jump. If in same position user presses down she should sit. If actress is sitting, and user presses "Up", she should stand up. What design pattern should be used here. STATE

(c) We are building Taypals add a payment option feature. A user can add a credit card, debit card, or bank account. The processing steps differ depending on the given payment option. ABSTRACT FACTORY

Admin
Admin

Posts : 17
Join date : 2016-02-12

https://rubyror.forumotion.com

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by sasti_randi Sat Apr 30, 2016 12:10 am

) In the future, you are implementing a system for time travel. It is to allow you to travel to any era for your life, and later, you can return to the present, or to another era you have been to. Once you return, everything is as it was when you left.
memnto

(b) Here is a physical analogy to a design pattern. Which pattern? When you call Microsoft tech support, you deal with a Level 1 consultant. If (s)he can’t answer your question, eventually you are routed to a Level 2 consultant. If this consultant can’t answer your question, you are transferred to a Level 3 consultant.
chain of responsibility

sasti_randi

Posts : 14
Join date : 2016-04-29

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by gorydog Sat Apr 30, 2016 12:13 am

auto
auto
auto
o
auto
sedan

gorydog

Posts : 10
Join date : 2016-04-29

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by Admin Sat Apr 30, 2016 12:24 am

auto.print(auto);
auto.print(sedanAuto);
auto.print(sedan);
sedan.print(o);
sedan.print(auto);
sedan.print(sedan);


Admin
Admin

Posts : 17
Join date : 2016-02-12

https://rubyror.forumotion.com

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by sasti_randi Sat Apr 30, 2016 12:34 am

//in the MoneyConverter class
public Money convertTo(Money money, Currency to) {
if (money instanceof SimpleMoney) {
SimpleMoney simpleMoney = (SimpleMoney) money;
long newAmount = simpleMoney.getAmount() * getRate(simpleMoney.getCurrency(), to);
return new SimpleMoney(newAmount, to);
}
else {
MixedMoney mixedMoney = (MixedMoney) money;
long totalAmount = 0;
for (Currency currency: mixedMoney.getCurrencies()) {
long currentAmount = mixedMoney.getAmount(currency);
totalAmount += (long) (getRate(currency,to) * currentAmount);
}
return new SimpleMoney(totalAmount, to);
}
}
(a) (2 points) What principle or pattern is violated if the convertTo(...) method is implemented (only) in MoneyConverter?


Expert pattern

(b) (2 points) When different kinds of Money objects (SimpleMoney, MixedMoney) are being added together, which design pattern could be used to avoid checking the class of the object that is being added? Your answer should be the name of a design pattern; it should not involve a tree format for representing money.

visitor

sasti_randi

Posts : 14
Join date : 2016-04-29

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by Admin Sat Apr 30, 2016 12:46 am

Not sure. Verify

Car, Mustang, Wheel
There is both an is-a and a has-a relationship between/among these classes
Car, wheel

Person, Veteran, Teacher
There is an is-a relationship between/among these classes.
Person

List, ArrayList, LinkedList
There is an is-a relationship between/among these classes.
List

Admin
Admin

Posts : 17
Join date : 2016-02-12

https://rubyror.forumotion.com

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by sasti_randi Sat Apr 30, 2016 12:50 am

public
Money
convertFrom(
Money money
, Currency to) {
long newAmount =
money.getAmount
() * mc.getRate(
getCurrency
(), to);
return new SimpleMoney(
newAmount
,
to
);
}

sasti_randi

Posts : 14
Join date : 2016-04-29

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by sasti_randi Sat Apr 30, 2016 12:54 am

class Rectangle {
public:
double getHeight();
void setHeight(double h);
double getWidth();
void setWidth(double w);
};

A Square is made a subclass of Rectangle.
Does the above scenario violate the Liskov Substitution Principle? YES

sasti_randi

Posts : 14
Join date : 2016-04-29

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by piefgpi Sat Apr 30, 2016 12:54 am

The Bridge pattern decouples a set of implementations from set of objects using them.
There is high coupling between observer base class and subject.
Proxy implements a different interface than the interface implemented by the object it is serving as a proxy for.

piefgpi

Posts : 8
Join date : 2016-04-29

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by gorydog Sat Apr 30, 2016 1:00 am



(i) List, ArrayList, LinkedList
a
list

(ii) Car, Mustang, Wheel
c
car wheel

(iii) Person, Veteran, Teacher
a
person

maybe this is right.. not too sure

gorydog

Posts : 10
Join date : 2016-04-29

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by Admin Sat Apr 30, 2016 1:06 am

-The Bridge pattern decouples a set of implementations from set of objects using them.
-Using this pattern, Subjects and Observers can push messages back and forth.
-Proxy implements a different interface than the interface implemented by the object it is serving as a proxy for.

Admin
Admin

Posts : 17
Join date : 2016-02-12

https://rubyror.forumotion.com

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by Admin Sat Apr 30, 2016 1:10 am

There is high coupling between observer base class and subject. this is right

Admin
Admin

Posts : 17
Join date : 2016-02-12

https://rubyror.forumotion.com

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by piefgpi Sat Apr 30, 2016 1:13 am

admin Pakka ????

piefgpi

Posts : 8
Join date : 2016-04-29

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by piefgpi Sat Apr 30, 2016 1:15 am

public
Money
convertFrom(
Money mc
, Currency to) {
long newAmount =
mc.getAmount
() * mc.getRate(
mc.getCurrency
(), to);
return new SimpleMoney(
newAmount
,
to
);

piefgpi

Posts : 8
Join date : 2016-04-29

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by sasti_randi Sat Apr 30, 2016 1:21 am

Different responsibilities should be divided among different objects.
Encapsulation: One class should be responsible for knowing and maintaining a set of data, even if that data is used by many other classes
Expert pattern: The object that contains the necessary data to perform a task should be the object that manipulates the data
The DRY principle: Code should not be duplicated
Design your classes so that they can handle change
Code to interfaces, not classes
Encapsulate the concepts that vary
Give classes a complete interface
A well-formed class has a consistent interface



a) 1,4
b) 1,2
c) 2,6

sasti_randi

Posts : 14
Join date : 2016-04-29

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by Admin Sat Apr 30, 2016 1:23 am

yes piefgpi

Admin
Admin

Posts : 17
Join date : 2016-02-12

https://rubyror.forumotion.com

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by gorydog Sat Apr 30, 2016 1:27 am


i guess its
2,2
1,8
2,4

gorydog

Posts : 10
Join date : 2016-04-29

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by ledzep93 Sat Apr 30, 2016 1:43 am

You are developing a game, and your task is to change an actress's physical positions based on her previous conditions. For instance, If actress is standing, and user presses "Up", she should jump. If in same position user presses down she should sit. If actress is sitting, and user presses "Up", she should stand up. What design pattern should be used here.

STATE

ledzep93

Posts : 9
Join date : 2016-04-29

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by Admin Sat Apr 30, 2016 1:45 am

(a) What would be a good precondition for y = arcsin(x)?
-1≤x≤1

(b) What would be a good postcondition for the method? Note: The postcondition should involve sin.
sin y = x

(c) What is the obligation for the client in using the arcsin method?
-1≤x≤1

(d) What is the benefit for the client in using the arcsin method?
sin y = x

(e) Suppose we wanted to incorporate the precondition into the postcondition. Give the new postcondition.
e nahi aaya

Admin
Admin

Posts : 17
Join date : 2016-02-12

https://rubyror.forumotion.com

Back to top Go down

Aakhri Jung! Empty Re: Aakhri Jung!

Post by Sponsored content


Sponsored content


Back to top Go down

Page 1 of 3 1, 2, 3  Next

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum