November 12, 2018

Data Mining - Mid Sem Solutions


Question:
Give an example for each of the following preprocessing activates
a. Incomplete
b. Inconsistent

Answer:
Data Processing: It is a data mining technique that involves transforming raw data into an understandable format. Our Real-world data is often incomplete, inconsistent, and/or lacking in certain behaviors or trends, and is likely to contain many errors. Hence it is needed for resolving such issues.
"Preprocessing is needed to improve data quality"

A. Incomplete: Lacking attribute values, lacking certain attributes of interest, or containing only aggregate data.
E.g. Many tuples have no recorded value for several attributes,
Occupation = “ ” (missing data)

B. Inconsistent: Containing discrepancies in codes or names.
E.g.
Age = “42”, Birthday = “03/07/2010”
Was rating “1, 2, 3”, now rating “A, B, C”
discrepancy between duplicate records

Software Testing Methodologies - Mid Sem Solutions




Question
One of your friends has written a program to search a string in a string and requested you to test the below function using equivalent class portioning :

function strpos_generic( $haystack, $needle, $nth,  $insensitive)
Following are terminology definitions:
  • $haystack= the string in which you need to search value
  • $needle= the character that needs to be searched, the $needle should be a single character
  • $nth= occurrence you want to find, the value can be number between 1,2,3
  • $insensitive= 1- case insensitive, 0 or any other value is case sensitive
  • Passing as Null as parameter in haystack or needle is not a valid scenario and will return boolean false
  • The function will return mixed integer either the position of the $nth occurrence of $needle in $haystack, or Boolean false if it can't be found.
a) Derive positive and negative domain equivalence class portioning with the value in the following format     

$haystack
$needle
$nth
$insensitive




                                                                             
b) And drive test case for weak robust variant in following format and use the variable efficiently and cover  all the paths:
 
Sl.no
$haystack
$needle
$nth
$insensitive
Expected  results

Answer:
NOTE : The above question is for your exercise,kindly try solving it using below reference questions

Similar questions for finding  positive , negative domain equivalence class portioning and driving test cases.

Question
ABC Transportation Company has implemented an online ticket booking system for their buses, and they have created a simple screen to search the bus and following are some of the business rules they have incorporated in the screen.
From and To location should be minimum 3 characters and maximum  of  25 characters
Date of travel cannot be lesser than today’s date
Time : Morning, Afternoon, Night
No of Passengers can be 1 to 6
Service class can be: Premium, Deluxe, Express
a) Identify the positive and negative domain.

b) Write test case for weak robust variant.

November 05, 2018

Design and Analysis of Algorithms - Mid Sem Solution


Question 1A)
The time factor when determining the efficiency of algorithm is measured by
a) Counting microseconds
b) Counting the number of key operations
c) Counting the number of statements
d) Counting the kilobytes of algorithm

Answer: b
Justification: It is hardware and language independent , rest are dependent on hardware or on software

1B) The concept of order Big O is important because
a) It can be used to decide the best algorithm that solves a given problem
b) It determines the maximum size of a problem that can be solved in a given  amount of time
c) It is the lower bound of the growth rate of algorithm
d) Both A and B


Answer: a
Justification: We know that Big Oh notation is used in time complexity . the reason why we called Big Oh because it says "at any condition this is worst time that an algorithm could take " where as Big Omega says its is "best time that you can get , You cant get better than this.

1C) In worst case Quick Sort has order
A) O (n log n)            B. O (n2 /2)                C. O (log n)                         D. O (n2 /4)

Answer: A
Justification: In the worst case of quick sort has order O(n2). Quick sort is the quickest comparison-based sorting algorithm. It is very fast and requires less additional space, only O(n log n) space is required.

1D) Consider the following program segment. What is the Space complexity?
Begin
i=0;
S=0;
S=s+1;
Return s;
End

Answer: [If i,S considered as integers] => Space Complexity = 4 +(4*2)  = 12 bytes, where additional 4 bytes is for return value

To calculate the Space complexity of an algorithm, we need to follow the below instruction first:
It is the amount of memory used by the algorithm (including the input values to the algorithm) to execute and produce the result.

Space Complexity = Auxiliary Space + Input space

Calculating the Space Complexity:

For calculating the space complexity, we need to know the value of memory used by different type of datatype variables, which generally varies for different operating systems, but the method for calculating the space complexity remains the same.
TypeSize
bool, char, unsigned char, signed char1 byte
short, unsigned short,2 bytes
float, int, unsigned int, long, unsigned long4 bytes
double, long double, long long8 bytes
1E)  What is the time complexity of optimal binary search
(1) a)O(n) b) O(1) c)O(2n/2 d) O(n2)

Answer: d
Justification:
An optimal binary search tree is a binary search tree for which the nodes are arranged on levels such that the tree cost is minimum.

For Reference:
The complexity of linear search algorithm is
a) O(n)
b) O(log n)
c) O(n2)
d) O(n log n)

Answer: a
Justification: It refers to n values complexity in the algorithm which can be reduced by choosing the other algorithms.

The complexity of Bubble sort algorithm is
a) O(n)
b) O(log n)
c) O(n2)
d) O(n log n)

Answer: c
Justification: Bubble sort, is a simple sorting algorithm that works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order.

Question
Randomised algorithms are also called as __________________ and whose behavior is dependent  on  _______________ in decision making as part of its logic

Answer: probabilistic algorithm and randomness

Question:
Match the following    


Problem

Recurrence Equation
1
Binary Search 
A
tn – tn-1 = 1
2
Merge Sort
B
T(n)=2T(n/2)+n-1
3
Sequential Search
C
tn =  tn-1 + n
4
Factorial
D
T(n)=7T(n/2)+18(n/2)2
5
Strassen Matrix Multiplication
E
T(n)=T(n/2)+1
6
Selection Sort
F
T(n)=T(n/2)+n-1









Answer:

T(n) = Time Complexity
 

Problem

Recurrence Equation
1
Binary Search
E
T(n)=T(n/2)+1
2
Merge Sort
B
T(n)=2T(n/2)+n-1
3
Sequential Search
A
tn – tn-1 = 1
4
Factorial
F
T(n)=T(n/2)+n-1
5
Strassen Matrix Multiplication
D
T(n)=7T(n/2)+18(n/2)2
6
Selection Sort
C
tn =  tn-1 + n

Additional Reference:


7
Insertion sort
-
T(N) = T(N-1) + N-1
8
Tree traversal
-
T(n) = 2T(n/2) + 1
9
Quicksort
-
(n) = 2T(n/2) + n
10
Master Theorm
-
T(n)=aT(n/b)+f(n)












Tip:
Merge Sort: The merge sort algorithm deals with the problem of sorting a list of n elements. It is able to sort a list of n elements in O(n log n) run-time, which is considerably faster than insertion sort, which takes O(n2).
Merge sort uses a divide and conquer method:
1. If the length of the list is 1, the list is sorted. Return the list.
2. Otherwise, split the list in two (roughly) equal halves and then recursively merge sort the two halves
3. Merge the two sorted halves into one sorted list.

November 03, 2018

SOFTWARE PROJECT MANAGEMENT - Mid Sem Solutions

Mid-Sem Paper Solutions:

Note: Provide justification for your choice; else you will get zero, More than one choice may be the right answer.



Question:
When using Agile methods, planning is usually done based on:
A.    Scheduled Milestones                   B. Series of Releases
C.    Fixed Requirements                      D. Technical feasibility

Answer: B
Series of Releases

Justification:
AGILE methodology is a practice that promotes continuous iteration of development and testing throughout the software development life-cycle of the project. In Agile Planning, Selection of features develops during a specific set of time(The sprint).

Basically, in an Agile Project - release plan is focused on planning multiple iterations in an effort to determine when each release will be delivered. In order to achieve the product vision,

Tip: There are lots of reasons which you can use here, the basis on your work. If you have worked in an agile project. 

Question:
All of the following statements concerning stakeholders are true except
A.    Differences between or among stakeholders should be resolved in favor of the customer.
B.    Managing stakeholder expectations may be difficult because stakeholders often have very different objectives that may come into conflict.
C.    Project stakeholders may influence the course of the project and its results.
D.    Differences between or among stakeholders should be resolved in the most cost-efficient manner consistent with project objectives.

Answer: D
Differences between or among stakeholders should be resolved in the most cost-efficient manner consistent with project objectives.


Question:
During a company event, you had the opportunity to talk to a colleague project manager. He told you that in his current project actual costs are15% under cumulated costs scheduled for today. What do you think?
A.    The information available is not sufficient to assess project performance.
B.    The project will probably be completed with total costs remaining under budget.
C.    A significant cost increase during the further course of the project will probably bring the costs back to the baseline level.
D.    Original cost planning must have been poor to allow this variance.

Answer: A
The information available is not sufficient to assess project performance.

November 02, 2018

Software Engineering - Comprehensive

 2015 - 2016
Comprehensive Examination (Regular) 

Question) Indicate True or False for following statements with a justification within 30 words. No credit is given for answers with no justification.  

a. For successful design, you must practice diversification followed by convergence.
Answer)TRUE
b. Appraisal cost is likely to be the most expensive element of cost of quality.
Answer)TRUE
c. Before an architectural pattern is chosen for use in a particular system it must have a code implementation to expedite its reuse.
Answer)FALSE
d.Quantitative methods for evaluating the quality of proposed architectural designs are freely available.
Answer) FALSE
e. In component-based software engineering, the team searches for available components at the outset of the project.
Answer)FALSE
f. With thorough testing it is possible to remove all defects from a program prior to delivery to the customer.
Answer)FALSE
g. Many software metrics can only be measured indirectly.
Answer)TRUE
h. Software testing is deemed complete at end of budgeted duration for testing.
 Answer)FALSE
i. Design patterns are not applicable to the design of object-oriented software.
Answer)FALSE

Question) Differentiate the following: 
a. Analysis vs. design

November 01, 2018

DESIGN AND ANALYSIS OF ALGORITHMS - Comprehensive Paper Solution

Question:
Assume that there are two algorithms A and B for a given problem P. The time complexity functions of algorithms A and B are 5n and log2n    respectively. Which algorithm should be selected assuming that all other conditions remain the same for both the algorithms?

Solution:
Assuming that all conditions remain the same for both algorithms, the best algorithm takes less time when the input is changed to a larger value. Results obtained employing different values of n are shown below:

Computer Networks - Answer Key

QUESTION 1.For each of the following applications,  determine whether  TCP or UDP is used as the transport layer protocol  and explain the reason(s) for your choice [5 x 2 = 10]
a)File Transfer
b)Watching a real time streamed video
c)Web browsing
d)A Voice over IP (VoIP) telephone conversation

Solution
a)File transfer :This should be TCP The reason is that you want a file to be transmitted in its entirety without any errors, therefore the error detection and correction properties of TCP are needed.
b)Watching a real time streamed video :This should be UDP. The reason is that when watching a movie, delay is critical and therefore there simply isn't any time to seek the retransmission of any errors. The simplicity of UDP is therefore required.
c)Web browsing :This should be TCP The reason is that web pages need to be delivered without error so that all content is properly formatted and presented. Therefore the error detection and correction properties of TCP are needed.
d)A Voice over IP (VoIP) telephone conversation :This should be UDP. The reason is that a telephone conversation has strict timing requirements for the transfer of data and seeking the retransmission of any errors would introduce too much delay. Therefore the simplicity of UDP is needed.

Computer Graphics - Answer Keys

Section – A (7 x 8 marks = 56 marks)

Question 1.The co-ordinates of only one eighth of the total pixels lying on circumference of a circle are computed. Why? The Bresenhem’s circle drawing algorithm can be adapted for computing the coordinates of other pixels, explain?

Solution Scheme: 
Circle is symmetric about its axis. So, if point (x,y) is on the circle, then we can trivially compute (450 segment) seven other points (y,x),(y,-x),(x,-y),(-x,-y),(-y,-x),(-y,x),(-x,y) using the symmetry.(2 marks)
Bresenhem’s circle drawing algorithm (6 marks)

Question 2.Cohen-Sutherland line clipping technique uses the concept of region codes (or outcodes) in order to clip lines. Suppose a rectangular clip window ABCD is defined such that the lower left hand corner is at A(1,2) and upper right hand corner is at C (9,8). Clip the following line segments using Cohen Sutherland technique
  Line 1 from P(-1,7) to Q(11,1)
  Line 2 from R(3,7) to S(3,10)
  Line 3 from U(2,3) to V(8,4).

Software Development for Portable Devices - Paper Solution

 QUESTION 1(10 Marks)
Q1a.Explain the following methods of ContentProvider class [5]
(Note: Full marks is awarded if methods parameters and return type is explained.)

Answer)
i.canonicalize(Uri url):
  • A canonical URI is one that can be transported across devices, backup/restore, and other contexts, and still be able to refer to the same data item. Typically this is implemented by adding query params to the URI allowing the content provider to verify that an incoming canonical URI references the same data as it was originally intended for and, if it doesn't, to find that data (if it exists) in the current environment.
  • Parameters Url: uri: the Uri to canonicalize. this value must never be null
  • Returns : URI Return the canonical representation of url, or null if canonicalization of that Uri is not supported.