Saturday, May 27, 2017

Software Architectures - Second Semester 2013-14 : Comprehensive Exam (EC- 3 Regular)

Birla Institute of Technology & Science, Pilani
Work-Integrated Learning Programmes Division
Second  Semester 2013-2014

Comprehensive Examination
(EC-3 Regular)

Course No.                    : SS ZG653 
Course Title                  : SOFTWARE ARCHITECTURES  
Nature of Exam            : Open Book
Weightage                     : 50%
Duration                        : 3 Hours 
Date of Exam                : 05/04/2014      (FN) 



Q.1. Differentiate between
(a) Interactive Systems and Adaptable Systems 
                                                                                                                                   [5]
(b) MVC Pattern and PAC Pattern 
                                                                                                                                   [5]


Q.2. Write a short note on
       (a) Documenting Architecture with a focus on Views. 
                                                                                                                                   [5]
       (b) Microkernel Pattern with a specific focus on adaptability to evolving hardware and software.
                                                                                                                                   [5]


Q.3   (a) Security is a one of the most important quality attribute. Take an example of a remote proxy that performs the function of protection and firewall, to explain the implementation of security tactics. List suitable examples. 
                                                                                                                                    [5]

Q.3 (b) For the same proxy take an example of a client accessing the external data (over the network) (Hint: Use of proxy pattern). For the scenarios (i) Connect with original to get the latest data when the data in proxy is stale (ii) Provide the data to the client from the proxy as the data in the proxy is not stale, draw only an Message Sequence Charts to depict the scenarios. 
                                                                                                                                    [5]

Q.4. Case Study: Lift car and Lift Control System

A single lift control system (LCS) controls more than one lifts. This control system consists of all of algorithms to control the electrical input to control and manage the movement of lift cars (LC). A communication bus is used to send in commands and receive data from the lift car.

Every lift car can carry varying number of passengers i.e. laden weight of the lift may vary across different models. Each car does have its maximum speed which can be reached or allowed Example: A service lift is a slow speed lift whereas passenger lifts are higher speed when compared to service lift. Lift car has a user interface which shows the present floor, present weight of the lift, speed of the lift and shows time-of-day. An input interface is present which allows certain inputs from the users for floor request, alarm and internal light switch on/off. An emergency light is installed which switches on when the power fails. This light is controlled by the lift control system.

An auto rescue device may be installed on the lift. This is configured in the LCS as well as lift car. This is a mechanical device which gets the LC to the nearest floor in case of power failure and also can detect as to which floor the lift is at. Thus makes it easier to reset the position which otherwise will have the lift to be brought to the lowest floor to reset the position in case of power failure.

An LCS has control algorithms to control the speed, soft start and stop of the lifts and has all the data pertaining to the movement, speed, position and other status of the LC. This is displayed on the Graphical User Interface of the LCS. A keyboard can be connected to the system to configure and control the system.

Questions:

(a) Create required class diagrams/Block diagram so as to demonstrate that the functionalities so depicted covers all requirements 
                                                                                                                                [10]
(b) Create Message Sequence Diagrams for the following scenarios  :
                   -  Power failure scenario for LCS  
                                                                                                                                  [5]
                   -  Power failure scenario for LC 
                                                                                                                                  [5]

**********

Software Architectures - Second Semester 2013-14 : Mid-Semester Test (EC- 2 Regular)

Birla Institute of Technology & Science, Pilani
Work-Integrated Learning Programmes Division
Second Semester 2013-2014

Mid-Semester Test
(EC-2  Regular)


Course No.                  : SS ZG653
Course Title                : SOFTWARE ARCHITECTURES
Nature of Exam          : Closed Book
Weightage                   : 35%
Duration                      : 2 Hours
Date of Exam              : 15/02/2014    (FN)


Q.1. Differentiate with examples between “Architectural Pattern” and a “Design Pattern”. 
                                                                                                                                        [4]


Q.2. What are the three parts of the Pattern Schema? Briefly describe each of them with respect to pipes and filters. 
                                                                                                                                        [5]


Q.3. Propose the priority of quality attributes when considered for architecture and implementation for the following two systems. Justify your choice of priority. Please use following quality attributes for prioritization:
  • Security
  • Testability
  • Availability
  • Modifiability-Performance
  • Usability
(a) Automated Teller Machine (ATM)                                                                       
                                                                                                                                        [5]
(b) Web based Management Information System                                                      
                                                                                                                                        [5]


Q.4. Identify two quality attributes which may have conflicting requirements from design and implementation perspective. Justify your answer with 2 distinct aspects which conflict with an example for each. 
                                                                                                                                        [8]

Q.5. Answer the following:
(a) Write a short note on: Outputs of ATAM                                                           
                                                                                                                                        [4]
(b) Differentiate between ATAM and CBAM                                                          
                                                                                                                                        [4]



*********



Software Architectures - Second Semester 2015-16 : Mid-Semester Test (EC- 2 Regular)

Birla Institute of Technology & Science, Pilani
Work-Integrated Learning Programmes Division
Second Semester 2015-2016

Mid-Semester Test
(EC-2  Regular)


Course No.                  : SS ZG653
Course Title                : SOFTWARE ARCHITECTURES
Nature of Exam          : Closed Book
Weightage                   : 35%
Duration                      : 2 Hours
Date of Exam              : 27/02/2016    (FN)

Q.1.   A real-time system, through expected to be running all the time, needs to be stopped 5 times a day due to massive data-collection that requires cleaning and backup. The system needs to be restarted after 10 minutes interval each time. Compute the % availability of the system in a day. Clearly write any assumption that you taken.
                                                                                                                                         [4]


Q.2.   Consider a web portal built using J2EE based infrastructure. The system needs to be available 24x7 with small acceptable downtime. To ensure that the application is not choked with too many requests, you have decided to control the number of hits to this portal, if the number of hits exceeds a threshold. You have also decided to monitor the health of the server to ensure the availability. Identify at least 2 availability and 2 performance tactics that are suitable, and explain the reason in one line per tactic. 
                                                                                                                                        [8]


Q.3.    A camera based sensor module continuously tracks moving object's positions and streams the data to a robot control module. The robot control module triggers an action only if the image quality is reasonable and the different between the received position data and the recently registered data is > a threshold. Describe the module dependency structure and the component and hardware allocation structure for this problem. The structure should be described using UML. Explain what should be correct dependency on the sensor.
                                                                                                                          [2+3+2=7]


Q.4.   Identify at least three differentiating features with examples between "Architectural Pattern" and a "Design Pattern".
                                                                                                                                       [3]


Q.5.   Explain the terms (i) Architectural Pattern, (ii) Reference Model and (iii) Reference Architecture. How they are related with each other? 
                                                                                                                                       [6]


Q.6.   Explain   the various step(s) required to implement a Layered Architectural pattern. Explain an efficient variation of the layer pattern where the client call to a layered system can be responded faster. 
                                                                                                                               [5+2=7]

***********

Friday, May 26, 2017

Software Architectures - Second Semester 2015-16 : Comprehensive Exam (EC- 3 Make-up)

Birla Institute of Technology & Science, Pilani
Work-Integrated Learning Programmes Division
Second  Semester 2015-2016

Comprehensive Examination

(EC-3 Make-up)

Course No.                    : SS ZG653 
Course Title                  : SOFTWARE ARCHITECTURES  
Nature of Exam            : Open Book
Weightage                     : 50%
Duration                        : 3 Hours 
Date of Exam                : 23/04/2016      (FN) 



Q.1 (a) Write a short note explaining why Change Propagation Mechanism is required in the case of MVC pattern. Explain use of the publisher-subscriber pattern for this purpose. Explain with a class diagram and a sequence diagram using UML notation.

                                                                                                                                             [2+2+2+2]


Q.1 (b) Consider word processor software that allows to “undo” the “deletion of a paragraph”. To implement this feature, “command pattern” is used. Draw a class diagram to depict this scenario. Briefly explain the methods/data-structure needed to implement this “undo”.

                                                                                                                                         [5]



Q.2.  Consider the following simplified module view of an eCommerce system.



The Item-Selection module fails only if both its submodules fail. It works if one of the submodules is operational. The Order-Fulfillment module fails only if one of its submodules fails. The system fails if either Item-Selection module or Order-fulfilment module fails. Compute with detailed steps, the failure probability of Item-Selection and Order-Fulfilment and the probability that the system remains operational, given the probability of failure of each sub-module as shown in the diagram.           

                                                                                                                                                 [10]

Q.3. Consider a computer system that has a scanner installed. Assume that the OS (follows a Microkernel architecture), has already detected a scanner and is ready to be used. The OS is a particular flavor of UNIX. Now consider a scenario that a user uses GUI application to scan a document. Identify the essential modules for this problem. Map each module with the components of the Microkernel pattern. Identify the key functionality of each module keeping the role of each microkernel entities in mind. For each component draw a sequence diagram to depict this operation.                                                                                                                                     [2+2+2+3= 9]


Q.4. Consider a financial batch processing application that continuously receives batches of transactions. Each batch of transaction is first sorted based on its account number and the sorted batch is given to the next component that computes various transaction summary results. This summary result data is given to a printing module which eventually passes the summary to the archiving module. The archiving module stores the summary in a datastore. This application requires high throughput and needs to process batches within a short time. Suggest the architectural pattern that’s most appropriate for this system. Identify various components of this application, the data items, and draw a structure diagram depicting these components, their interactions and data-flow.

                                                                                                                                         [1 + 4 = 5] 


Q.5. Case Study: Question paper Correction and Reporting Application

You are designing a system having the following display input and output requirements

Input of the system is a set of answers for multiple choice questions (MCQ). This input is provided in a comma separated format with each line providing the question number and the solution as marked by the person taking the test.

i. This input is processed against the answer template and the following data is made available
  • Student ID (which is also the Key), total number of correct and wrong answers for each answer sheet, total number of unmarked answers for each answer sheet, total number of answer sheets validated

ii. Following data is shown on the display in real time
  • A bar graph of number of students who have passed and failed the test with two bars. Colour is configurable from the same display window
  • Analysis of total number of unanswered questions from each paper in the form of Student ID and total un-answered in a tabular format
Based on the details provided above, answer the following

(a) Identify the modules for this problem that play the roles of M, V and C.
                                                                                                                                                     [2]
(b) Draw a sequence diagram to describe an efficient mechanism of implementing change of color requested for the bar graph         

                                                                                                                                                     [5]

Q.6. (a)   Describe in steps how Broker can be used as Service Locator and as intermediary. 
                                                                                                                                                     [3]
Q.6. (b)   Describe a few benefits and overheads of the Broker pattern.
                                                                                                                                                     [3]

Thursday, May 25, 2017

Software Architectures - Second Semester 2014-15 : Mid-Semester Test (EC- 2 Regular)

Birla Institute of Technology & Science, Pilani
Work-Integrated Learning Programmes Division
Second Semester 2014-2015

Mid-Semester Test
(EC-2 Regular)

Course No.                     : SS ZG653  
Course Title                   : SOFTWARE ARCHITECTURES 
Nature of Exam             : Closed Book
Weightage                      : 35%
Duration                         : 2 Hours 
Date of Exam                 : 20/02/2015      (FN)

Q.1. A software system crashed 100 times in the first year and for each crash it needs 10 min to restart. Calculate the availability in percentage in that year.
                                                                                                                                 [4]
Answer:

In a year, total minutes is: 365 X 24 X 60 = 525600 min.
The system failed 100 times, and each time it took 10 min to restart.
Total time to recover: 100 X 10 = 1000 min.
Total time of operation: 525600 - 1000 = 524600 min.
Availability: (524600 / 525600 ) X 100 = 99.809 = 99.81%


Q.2. Consider a web portal built using J2EE based infrastructure. The system needs to be available 24x7 with small acceptable downtime. To ensure that the application is not choked with too many requests, you have decided to control the number of hits to this portal, if the number of hits exceeds a threshold. You have also decided to monitor the health of the server to ensure the availability. Identify at least 2 availability and 2 performance tactics that are suitable, and explain the reason in one line per tactic.    
                                                                                                                                 [8]




Answer: 

Availability tactics: 
1. (a) Ping or (b) heartbeat to detect if the application is live in order to take the mitigating action. 
2. (a) Active redundancy or (b) passive redundancy is necessary to start a good copy of the application if the main server goes down.
Since small acceptable downtime is allowed, it is not required to use expensive “Voting” mechanism. Depending on the downtime tolerance limit, one can go for either passive or active redundancy. “Spare-Copy” is not acceptable as it takes quite a bit of time to restart the service.

Performance tactics: 
1. Main tactic category: Reduce #of events: In this context it is the number of hits. 
      a) Manage event rate: Using this tactic it will be possible to either explicitly deny the service in a graceful manner if it exceeds threshold (by showing some user-friendly page) 
      b) Control sampling freq: Don’t even register the new request. 

 2. Main tactic category: Controlling resource usage 
     a) Bound exec time: Execution time of each request can be bounded so that it does not impact others 
     b) Bound queue size: Requests aren’t piled up beyond certain point. These are discarded if the queue is full.


Q.3. Propose the priority of quality attributes when considered for architecture and implementation for an Automated Teller Machine (ATM). Justify your choice of priority. Use Security, Testability, Availability, Modifiability, Performance, and Usability quality attributes.  
                                                                                                                                [5]
Answer: 

My choice of priority :  
1. Security
2. Availability
3. Usability
4. Performance
5. Modifiability
6. Testability

Justification: 
  • At all times the top three attributes form the important ones to be taken care of for an ATM. 
  • Security to make sure that the system is secure at all times as the data and transactions which the system manages could mean major loss to users if not handled correctly. 
  • Availability forms a key attribute (second to security) as this system will be used by users who would not like to spend more time at the ATM (rather an optimum time at ATM); additionally would need the system available 24 x 7 x 365. 
  • System needs to be simple as the class of users is anyone who is a bank account holder and thus system cannot assume any technical knowledge or a level apart from simple steps to make use of the ATM to complete transactions. (Usability)
  • Other attributes (Performance, Modifiability and Testability) lower in priority than the others. 
  • ATM steps for all transactions are typical and thus performance does not form a comparable attributes. 
  • Systems do not change as often hence modifiability and testability can be at the lowest priority.


Q.4. During architecture review it is found that the account management module invokes system logging through an intermediate component. The logging is done frequently. Identify at least two quality attributes that are +vely or –vely impacted by this approach. Explain the reason for each in one line.
                                                                                                                                [4]
Answer: 

Modifiability is impacted +vely. This is a clear example of using the tactic: Use of intermediary between modules to prevent ripple effect, when the logging component is changed or upgraded. 

Performance is impacted –vely. One common tactic to improve the performance is to reduce overhead – by removing the intermediaries. The given design clearly violates this tactic.


Q.5. What are the dependencies that need to be taken care to avoid ripple effect in modifiability tactics?
                                                                                                                                [8]
Answer: 

If Module A is changed to accomplish particular modification, then Module B is changed only because of change in Module A, B has to be modified because it depends, in some sense, on A. 
8 types :
     a.  Syntax 
              i.  Syntax of data: For B to compile (or execute) correctly, the type of the data that is 
                  produced by A and consumed by B must be consistent with the type of data assumed by B
             ii.  Syntax of service: For B to compile and execute correctly, the signature of services 
                  provided by A and invoked by B must be consistent with the assumption of B 
     b.  Semantic of 
              i.  Semantics of data: For B to execute correctly, the semantics of the data produced by A 
                  and consumed by B must be consistent with the assumptions of B
             ii.  Semantics of service: For B to execute correctly, the semantics of the service produced 
                  by A and used by B must be consistent with the assumptions of B
     c.  Sequence of 
              i.  Sequence of data: For B to execute correctly, it must receive the data produced by A in a
                  fixed sequence. Ex: a data packet’s header precede its body. 
             ii. Sequence of control: For B to execute correctly, A must have executed previously within 
                 certain timing constraints. Ex: A must have executed no longer than 5ms before B 
                 executes
     d.  Identity of an interface of A: A may have multiple interfaces. For B to compile and execute 
          correctly, the identity of the interface must be consistent with the assumptions of B 
     e.  Location of A (runtime): For B to execute correctly, the runtime location of A must be 
          consistent with the assumptions of B 
      f.  Quality of service/data provided by A: For B to execute correctly, some property involving 
           the  quality of the data or service provided by A must be consistent with the assumption of B.  
           Ex: data provided by a particular sensor must have a certain accuracy in order for the 
           algorithm of  B to work correctly. 
     g.  Existence of A: For B to execute correctly, A must exist. 
     h.  Resource behavior of A: For B to execute correctly, the resource behavior of A must be 
          consistent with B’s assumptions


Q.6. Identify at least three differentiating features with examples between “Architectural Pattern” and a “Design Pattern”. 
                                                                                                                                [3]
Answer : 

Architectural Pattern
Design Pattern
An architectural pattern is a highest level of Design of a system
A design pattern is a medium level of design of a system
An Architectural Pattern expresses a fundamental structural organization schema for a software system
A design pattern provides a scheme for refining the subsystems or components of a software system
It provides a set of predefined subsystems, specifies their responsibilities and includes and rules and guidelines for organizing relationships between them
It describes a commonly-recurring structure of communicating components that solves a general design problem within a particular context


Q.7. Describe essential aspects of Security. 
                                                                                                                                [3]
Answer : 

Three main aspects

1. Confidentiality : prevention of the unauthorized disclosure of information. E.g. Nobody except you should be able to access your income tax returns on an online tax-filing site.

2. Integrity : prevention of the unauthorized modification or deletion of information. E.g. your grade has not been changed since your instructor assigned it.

3. Availability : prevention of the unauthorized withholding of information – e.g. DoS attack should not prevent you from booking railway ticket


Other Important aspects of Security

Non repudiation ::
An activity (say a transaction) can’t be denied by any of the parties involved. E.g. you cannot deny ordering something from the Internet, or the merchant cannot disclaim getting your order. 

Assurance ::
Parties in an activities are assured to be who they purport to be. Typically done through authentication. E.g. if you get an email purporting to come from a bank, it is indeed from a bank. 

Auditing :: System tracks activities so that it can be reconstructed later

Authorization :: grants a user the privileges to perform a task. For example, an online banking system authorizes a legitimate user to access his account.

***********

Saturday, May 20, 2017

Network Programming - Second Semester 2016-17 : Mid-Semester Test (EC- 2 Regular)

Birla Institute of Technology & Science, Pilani
Work-Integrated Learning Programmes Division
Second Semester 2016-2017

Mid-Semester Test
(EC-2 Regular-SOLUTION)

Course No.  : IS ZC462
Course Title  : NETWORK PROGRAMMING
Nature of Exam  : Close Book 
Weightage  : 30% 
Duration                : 2 Hours  
Date of Exam  : 26/02/2017 (AN) 



Q.1.       What are various IDs associated with a process?                                          [4]

·        Unix identifies each process with a unique integer called ProcessID.
·    The process that executes the request for creation of a process is called the 'parent process' whose PID is 'Parent Process ID'.
·    Every process is associated with a particular user called the 'owner' who has privileges over the process. The identification for the user is 'UserID'. Owner is the user who executes the process.
·      Process also has 'Effective User ID' which determines the access privileges for accessing resources like files.

§  getpid() -process id
§  getppid() -parent process id
§  getuid() -user id
§  geteuid() -effective user id

                                                                                                      
Q.2.       What is Zombie process in UNIX? How do you find Zombie process in UNIX?   [4]

o   Kernel keeps information (process ID, the termination status of the  process, and the amount of CPU time taken by the process ) until  parent asks for it.
o   a process that has terminated, but whose parent has not yet waited  for it, is called a zombie.
o   Zombies can hold up pids and resources in long-live servers.
If we use the following command we can see which process are zombies.
ps -el | grep 'Z'

With a normal ps -el command you see an output with in the second colum the state of the process. Here are some states:
S: sleeping
R: running
D: waiting (over het algemeen voor IO)
T: gestopt (suspended) of getrasseerd
Z: zombie (defunct)



                                                                                                      
Q.3.       What are the process states in Unix?                                                              [6]


Running: Process is either running or ready to run

Interruptible: A Blocked state of a process and waiting for an event or signal from another process

Uninterruptible: a blocked state. Process waits for a hardware condition and cannot handle any signal

Stopped: Process is stopped or halted and can be restarted by some other process

Zombie: process terminated, but information is still there in the process table.


Q.4.       What is Inode? Explain the content of Inode.                                                   [6]

A file system’s i-node table contains one i-node (short for index node) for each file residing in the file system. I-nodes are identified numerically by their sequential location in the i-node table. The i-node number (or simply i-number) of a file is the first field displayed by the ls –li command. 

The information maintained in an i-node includes the following:


􀁺 File type (e.g., regular file, directory, symbolic link, character device).
􀁺 Owner (also referred to as the user ID or UID) for the file.
􀁺 Group (also referred to as the group ID or GID) for the file.
􀁺 Access permissions for three categories of user: owner (sometimes referred to as user), group, and other (the rest of the world). 
􀁺 Three timestamps: time of last access to the file (shown by ls –lu), time of last modification of the file (the default time shown by ls –l), and time of last status change (last change to i-node information, shown by ls –lc). As on other UNIX implementations, it is notable that most Linux file systems don’t record the creation time of a file.
􀁺 Number of hard links to the file.
􀁺 Size of the file in bytes.
􀁺 Number of blocks actually allocated to the file, measured in units of 512-byte blocks. There may not be a simple correspondence between this number and the size of the file in bytes, since a file can contain holes (Section 4.7), and thus require fewer allocated blocks than would be expected according to its nominal size in bytes.
􀁺 Pointers to the data blocks of the file.




Q.5.       What is the purpose of alarm and pause functions?                                        [4]


Alarm Function :

      #include <unistd.h>
      unsigned int alam( unsigned int seconds );
      /* Always success, returning number of seconds remaining on any previously set timer, or 0 if no timer previously was set */

        alarm() call is used to set a real-time timer in seconds. After expiry, it generates SIGALRM signal.
        alarm(0) cancels the existing timer.
        In Linux, there can be only one timer per process. Among setitimer() and alarm(), only one timer can be running at a give time.

Pause Function :

        The pause() function suspends the calling thread until the delivery of a signal whose action is either to execute a user-defined signal handler or to terminate the process

#include <unistd.h>
int pause(void);

        If the action is to terminate, pause() does not return
        If a signal is caught by the process, pause() returns after the signal handler returns
        The pause() function always returns 1
        If interrupted by a signal, pause() sets errno to EINTR
        To wait for a particular signal by using pause(), a program must determine which signal caused pause() to return
        This information is not directly available, so the signal handler must set a global flag for the program to check after pause() returns




Q.6.       Explain the memory segments of process in UNIX?                                             [6]


A process is logically divided into the following parts, known as segments:

1. Text or Code Segment
2. Initialized Data Segments
3. Uninitialized Data Segments
4. Stack Segment
5. Heap Segment
  

The text segment contains the machine-language instructions of the program run by the process. The text segment is made read-only so that a process doesn’t accidentally modify its own instructions via a bad pointer value. Since many processes may be running the same program, the text segment is made shareable so that a single copy of the program code can be mapped into the virtual address space of all of the processes.

The initialized data segment contains global and static variables that are explicitly initialized. The values of these variables are read from the executable file when the program is loaded into memory.

The uninitialized data segment contains global and static variables that are not explicitly initialized. Before starting the program, the system initializes all memory in this segment to 0. For historical reasons, this is often called the bss segment, a name derived from an old assembler mnemonic for “block started by symbol.” The main reason for placing global and static variables that are initialized into a separate segment from those that are uninitialized is that, when a program is stored on disk, it is not necessary to allocate space for the uninitialized data. Instead, the executable merely needs to record the location and size required for the uninitialized data segment, and this space is allocated by the program loader at run time.

The stack is a dynamically growing and shrinking segment containing stack frames. One stack frame is allocated for each currently called function. A frame stores the function’s local variables (so-called automatic variables), arguments, and return value.

The heap is an area from which memory (for variables) can be dynamically allocated at run time. The top end of the heap is called the program break.