Friday, April 10, 2015

Software Architecture Quiz 3

1.If you want to create a modular design in C, which of the following C language features represent interfaces ?
Select one:

Header files (.h files) {correct}
Loop constructs
Struct keyword
Union keyword

2.You are writing a software for a soccer game  where your team, comprising of multiple players will play with another team. Your player needs to pass a ball in various ways- like a short pass, long pass, back pass, dribble and then pass. What's the design pattern you should use to implement passing a ball

Select one:

strategy pattern {correct}
command pattern
observer pattern
visitor pattern

3.Suppose that you have a data represented in a graph form. You want to create two types of reports, say a PDF report and a text report that traverses this graph and generates report. You don't want the data structure to know the report generation logic. What design pattern would you choose?

Select one:

Visitor {correct}
Singleton
Strategy
Observer

4.Suppose you are given a list of numbers as \{10,-6,8,9,0\}. You can sort these numbers via bubble sort, insertion sort and so on. This is an example of 

Select one:

Iterator
Singleton
Strategy {correct}
Observer

5.There exists three techniques to copy a text from one location to another (either by pressing ^C or selecting copy icon or by selecting copy option from edit menu). This is an example of ...

Select one:

Adapter Pattern
Strategy Pattern
Observer Pattern
Decorator Pattern {correct}

6.Consider the statement(s) in sequence \:  LinkedList l1 \= new LinkedList();LinkedList l2 \= new LinkedList();l1.add(l2); l1.add(new ArrayList()); Which Design Pattern is most appropriate in this scenario ?

Select one:

Decorator
Composite {correct}
Factory Method
Observer

7.Retriving the elements of a collection object is an example of

Select one:

Iterator Pattern {correct}
Factory Method Pattern
Decorator Pattern
Singleton Pattern

8.The concepts of source, event and listener  is used in which of the following pattern?

Select one:

Strategy
Singleton
Observer {correct}
Iterator

9.Suppose you are given an input stream you want to read its records one by one. Which of the following design 

patterns will you use?

Select one:

Strategy
Singleton
Iterator {correct}
Observer

10.Which of the following is an idiom type design pattern?

Select one:

Iterator
Observer
Singleton {correct}
Strategy

11.In a typical MS-word document, you have the features of coloring an individual character or a word or a line or sentence or the whole paragraph or the whole document. Which design patterns are involved in this situation?

Select one:

Factory Method and Singleton
Composite and Strategy
Decorator and Composite {correct}
Strategy and Visitor

12.A website is giving an option to change its featured like themes/colour at "run time" but the basic layout will be same. It is giving an option to change or revert the changes. Which kind of design pattern should we use to implement this scheme for a particular layout.

Select one:

factory
strategy
observer
decorator {correct}

13.Which one of the following is an example of Idiom type design pattern?

Select one:

Factory Method {correct}
Adapter
Decorator
Visitor

14.Suppose you are given an input stream you want to read its records one by one. Which of the following design 

patterns will you use?

Select one:

Singleton
Observer
Iterator {correct}
Strategy

15.You need to provide a new layout for a container component. The layout can chosen at runtime. What pattern 

would you use?

Select one:

Composite Pattern
Decorator Pattern {correct}
Factory Method Pattern
Strategy Pattern

16.You have a graph data structure which you don't want to change. If you want to implement different graph traversal algorithms, what design pattern would you choose?

Select one:

Decorator
Command
Visitor
Strategy {{correct}}

17.MS-Word software application  provides various text editing helper methods such as copy a text from one location to another, cut a portion of a text, paste from  buffer, undo a previous command etc. Which design 

pattern is used here?

Select one:

strategy {{correct}}
visitor
observer
command

18.A MS-word application provides mechanism for aligning the typed text (either left or right or centre justified). 
This is an example of which type of pattern?

Select one:

None of the above {correct}
Adapter
Observer
Factory Method

19.Consider an application which writes a log message by making a call to Logger.log(String msg). This logger class in turn uses a third party library that sends this log message via email. What pattern should Logger class 

use for this purpose?

Select one:

Decorator Pattern
Adapter Pattern {correct}
Composite Pattern
Strategy Pattern

20.You have a simple database application that takes a SQL string and returns you the result. This database application is so designed that it can run remotely, or can even run as a part of your application. Your application wants to use this database but you don't want your application to understand the details of how to connect to the database and other communication related information. What should you implement? 

Select one:

client side stub {correct}
Singleton design pattern
server side skeleton
Composite design pattern

21.You are fetching data from a NO-SQL platform where the table structure is quite dynamic. It can change depending on the nature of the data. You wouldn't like to change your application everytime the table structure changes. What's the pattern you should use?

Select one:

broker
microkernel
reflection {correct}
blackboard architecture

22.You are implementing an real-time bulletin board where notices are posted continuously. All the students registered for a type of notice will be intimated whenever a new notice of that type is posted. What  pattern is used for this kind of application

Select one:

observer {correct}
command
visitor
strategy

1 comment:

  1. Can you please post sem2 regular question papers?

    ReplyDelete