Software Architectures Mid-Semester Examination - Regular Question Paper 2016 MTech Software Systems- BITS WILP

Software Architectures (SSZG653)

Mid-Semester Examination - Regular Question Paper 2016
MTech Software Systems- BITS WILP


Data Structures and Algorithms Design Mid-Semester Examination - Regular Question Paper 2016 MTech Software Systems- BITS WILP

Data Structures and Algorithms Design (SSZG519)

Mid-Semester Examination - Regular Question Paper 2016
MTech Software Systems- BITS WILP


Object Oriented Analysis and Design Mid-Semester Examination - Regular Question Paper 2016 MTech Software Systems- BITS WILP

Object Oriented Analysis and Design (SSZG514)

Mid-Semester Examination - Regular Question Paper 2016
MTech Software Systems- BITS WILP


Database Design and Applications Mid-Semester Examination - Regular Question Paper 2016 MTech Software Systems- BITS WILP

Database Design and Applications (SSZG518)

Mid-Semester Examination - Regular Question Paper 2016
MTech Software Systems- BITS WILP


Data Structures and Algorithms Quiz 3- MTech Software Systems- BITS-PILANI-WILP - 2016

Data Structures and Algorithms Design (SSZG519) Quiz 3

MTech Software Systems- BITS-PILANI-WILP - 2016


1. Dijkstra's algorithm is a
Select one:
a. Brute force algorithm
b. Greedy algorithm
c. Divide and Conquer algorithm
d. Dynamic Programming algorithm
e. None of the above

Ans: b. Greedy algorithm

2. Consider the experiment of  tossing a coin until a head appears. The number of elements in the sample space is

Select one:
a. 0
b. None of the above
c. 1
d. 4
e. 2

Ans: e. 2

3. Prim's algorithm is a
Select one:
a. None of the above
b. Dynamic Programming algorithm
c. Greedy algorithm
d. Brute force algorithm
e. Divide and Conquer algorithm

Ans: c. Greedy algorithm

4. Merge sort is
Select one:
a. None of the above
b. Greedy algorithm
c. Divide and Conquer algorithm
d. Dynamic programming algorithm .
e. Brute force algorithm.

Ans: c. Divide and Conquer algorithm

5. Consider the interval scheduling problem. The triple (i,s,f) denotes the task i with starting time s and finishing time f. Each of the tasks has to use a resource but no two tasks can be accommodated simultaneously. We have to accommodate maximum number of tasks. Consider the following instance of the problem. {(1,2,4), (2,1,3),(3,4,6), (4,5,6)}. Which of the following is true?
Select one:
a. None of the above
b. Tasks 1 and 2 are in conflict
c. Tasks 2 and 3 are in conflict
d. Tasks 1 and 4 are in conflict
e. Tasks 2 and 4 are in conflict

Ans: b. Tasks 1 and 2 are in conflict

6. If a graph G with n vertices and m edges is represented using Adjacency list, then running time of Prim's algorithm is
Select one:
a. O(m2)
b. O(nlogn)
c. O(mlogn)
d. O(n2)
e. None of the above

Ans: c. O(mlogn)

7.  Let G be a simple undirected graph with n vertices. Then number of edges in G is
Select one:
a. None of the above
b. at least n(n-1)/2
c. at most n
d. at least n
e. at most n(n-1)/2

Ans: e. at most n(n-1)/2

8. Let A be an adjacency matrix of an undirected graph in G. Then sum of all entries in the matrix is equal to
Select one:
a. Number of vertices in G
b. Twice the number of edges in G
c. Twice the number of vertices in G
d. Number of edges in G
e. None of the above

Ans: b. Twice the number of edges in G

9. Average case running time for quick sort is
Select one:
a. O(n2)O(n2)
b. O(nlogn)
c. O(nloglogn)
d. None of the above
e. O(n)

Ans: b. O(nlogn)

10. Running time of Depth First Search algorithm on a graph with n vertices and m edges is
Select one:
a. O(mn)
b. O(m)
c. O(m+n)
d. None of the above
e. O(n)

Ans: c. O(m+n)


11. Consider the interval scheduling problem. The triple (i,s,f) denotes the task i with starting time s and finishing time f. Each of the tasks has to use a resource but no two tasks can be accommodated simultaneously. We have to accommodate maximum number of tasks. Consider the following instance of the problem. {(1,2,4), (2,1,3),(3,4,10), (4,5,6), (5,7,10)}. Suppose we use a greedy strategy: Choose a task with the minimum starting time. The solution, number of tasks, given by greedy algorithm is
Select one:
a. 3
b. 1
c. None of the above
d. 2
e. 4

Ans: d. 2

12. Let T be a tree with m edges. Then the number of vertices in T is
Select one:
a. exactly m-1
b. exactly m
c. None of the above
d. exactly m+1
e. at most m

Ans: a. exactly m-1

13. Worst case running time for merge sort is
Select one:
a. O(nloglogn)
b. O(nlogn)
c. None of the above
d. O(n)
e. O(n2)

Ans: b. O(nlogn)


14. Total number of comparisons needed for merge(L1,L2) where L1 is 2,4,6,8 and L2 is 10, 12, 13,15, 17
Select one:
a. 4
b. 9
c. 5
d. None of the above
e. 8

Ans: e. 8

15. Consider the instance of coin changing problem. We have infinite supply of each of 1,2,5,25 valued coins and we want to make change for 70 cents using minimum number of coins. The optimum solution is
Select one:
a. 6
b. 14
c. 1
d. 70
e. None of the above

Ans:

16. Consider the following statement about DFS.
i) At the end of DFS algorithm, each edge will be labelled as either discovery edge or back edge
ii) Discovery edges will form a spanning tree of the graph.
Select one:
a. ii only
b. i only
c. None of them is true
d. None of the above
e. Both of them are true

Ans:

17. Which of the following statements is correct.
i) Any comparison based algorithm must perform Ω(nlogn) comparisons to sort n elements in the worst case
ii. Any comparison based algorithm must perform Ω(nlogn) comparisons to sort n elements in the best case
Select one:
a. None of the above
b. only i is true
c. none of them is true
d. both of them are true
e. only ii is true

Ans:

18. Suppose the input to Quick sort is 1,2,...17. What would be the best pivot element during the first invocation?
Select one:
a. None of the above
b. 8
c. 17
d. 1
e. 9

Ans:

19. The running time of quick sort depends heavily on the selection of:
Select one:
a. Arrangement of elements in the array
b. None of the above
c. Size of elements
d. Pivot element
e. Number of inputs

Ans: d. Pivot element

20. Suppose an undirected graph, which has n vertices and d maximum degree, is represented using adjacency list. The running time to find the degree of a given vertex is
Select one:
a. O(logn)
b. O(d)
c. O(1)
d. O(n)
e. None of the above

Ans:

21. The space complexity to represent a graph with n vertices and m edges using adjacency matrix is
Select one:
a. None of the above
b. O(nlogn)
c. O(n^2)
d. O(n)
e. O(n+m)

Ans: c. O(n^2)

22. Consider the problem of sorting a sequence in ascending order. If the input is already in ascending order, which of the following sorting procedure is most efficient.

Select one:
a. None of the above
b. Merge sort
c. Quick sort
d. Heap sort
e. Insertion sort

Ans: e. Insertion sort

23. Suppose a directed graph is represented using adjacency list. The running time to calculate indegree of a vertex is
Select one:
a. O(d)
b. None of the above
c. O(n)
d. O(m+n)
e. O(logn)

Ans:

24. Consider the instance of coin changing problem. We have infinite supply of each of 1, 10, 25 valued coins and we want to make change for 30 cents using minimum number of coins. The optimum solution is
Select one:
a. None of the above
b. 6
c. 3
d. 30
e. 1

Ans: c. 3

25. Consider the interval scheduling problem. The triple (i,s,f) denotes the task i with starting time s and finishing time f. Each of the tasks has to use a resource but no two tasks can be accommodated simultaneously. We have to accommodate maximum number of tasks. {(1,2,4), (2,1,3),(3,4,10), (4,5,6), (5,7,10)}. Suppose we use a greedy strategy: Choose the task with smallest interval (difference in starting time and finishing time). The solution, number of tasks, given by greedy algorithm is
Select one:
a. None of the above
b. 1
c. 3
d. 2
e. 4

Ans: b. 1

26. Consider the experiment of tossing a coin until k heads appears. Then expected number of tosses is
Select one:
a. None of the above
b. k
c. 2
d. 2k
e. 1

Ans:

27. Consider the interval scheduling problem. The triple (i,s,f) denotes the task i with starting time s and finishing time f. Each of the tasks has to use a resource but no two tasks can be accommodated simultaneously. We have to accommodate maximum number of tasks. Consider the following instance of the problem. {(1,2,4), (2,1,3),(3,4,6), (4,5,6)}. Which of the following taskset is optimal?
Select one:
a. {1,4}
b. {1}
c. {1,2,3,4}
d. {1,2}
e. None of the above

Ans:

28. Consider the instance of coin changing problem. We have infinite supply of each of 1, 10, 25 valued coins and we want to make change for 30 cents using minimum number of coins. Suppose we use the greedy strategy: Choose a largest coin less than or equal to the remaining sum. The solution given by greedy algorithm is
Select one:
a. 3
b. 6
c. 30
d. None of the above
e. 1

Ans: b. 6


29. If a graph G with n vertices and m edges is represented using Adjacency matrix, then running time of Prim's algorithm is

Select one:
a. $O(m^2)$
b. O(mlogn)
c. $O(n^2)$
d. None of the above

Ans: b. O(mlogn)

30.  Worst case running time for quick sort is

Select one:
a. O(nloglogn)
b. O(n^2)
c. O(n)
d. None of the above
e. O(nlogn)

Ans: b. O(n^2)

Database Design and Applications- Quiz-3 - MTech Software Systems- BITS Pilani WILP

Database Design and Applications (SSZG518)- Quiz-3
MTech Software Systems- WILP(Work Integrated Learning Programmes)  
Birla Institute of Technology and Science, Pilani

1. A schedule that will always produce identical results are serial schedule.
Select one:
True
False

Ans: False

2. Every view serializable schedule that is not conflict  serializable has blind writes.

Select one:
True
False

Ans: True

3. The point in the schedule where the transaction has obtained its final lock is known as Commit point.
Select one:
True
False

Ans: False

4. The write ahead logging protocol guarantees atomicity and durability
Select one:
True
False

Ans: True

5. The schedule is deadlock free if the Precedence graph is acyclic
Select one:
True
False

Ans: True

6. Only one exclusive lock can be placed on a resource at a time.
Select one:
True
False

Ans: True

7. Every conflict serializable schedule is also view serializable.
Select one:
True
False

Ans: True


8. There can exist view serializable schedule which is not conflict serializable.
Select one:
True
False

Ans: True


9. The DBMS creates a logpoint, in order to minimize the time taken to recover in the event of a system crash.
Select one:
True
False

Ans: Fasle


10.Locks are released when the transaction is committed successfully.
Select one:
True
False

Ans: True


BITS PILANI WILP - M Tec Software Systems - Data Structures and Algorithms Design Mid-Semester Regular Test Question Paper 2016 - 2017


SS ZG519: Data Structures and Algorithms Design
Mid-Semester Test (Regular) -2016 - 2017

MTech Software Systems- WILP(Work Integrated Learning Programmes)  

Birla Institute of Technology and Science, 


BITS PILANI- WILP - M.Tec. - Software Systems- Object Oriented Analysis and Design - Quiz 3

Object Oriented Analysis and Design - Quiz 3

BITS PILANI- WILP - M.Tec. - Software Systems



1. ISP states that
Select one:
a. High-level modules should not depend on low-level modules
b. BOTH Clients should not be forced to depend on methods they do not use AND Design
cohesive interfaces and avoid "fat" interfaces
c. Design cohesive interfaces and avoid "fat" interfaces
d. Clients should not be forced to depend on methods they do not use

Ans: d. Clients should not be forced to depend on methods they do not use

2. F2166b:What is true about Structural desing pattern?
Select one:
 a. Makes the system independent of how the objects are created, composed and represented.
 b. Abstract the instantiation process
 c. All the given choices
 d. How classes and objects are composed to form larger structures?

Ans: d. How classes and objects are composed to form larger structures?

3. F2109:Which of the following statements are true about Package Diagrams?
Select one:
 a. Dependency is indicated by a solid line with arrow head at one end
 b. Package diagrams are particularly useful for testing
 c. Package is an object-oriented approach in managing system structure
 d. Package is a grouping mechanism that can be applied to classes only
 e. Package in UML is similar to Java, to avoid name collision
 f. Package dependency and class dependency are not the same.

Ans:  b. Package diagrams are particularly useful for testing

4. F2155: Which of the following is NOT creational design pattern?
Select one:
 a. String builder
 b. Factroy Method
 c. SIngleton
 d. Abstract Factory

Ans:  a. String builder

5. F2138:How to handle alternatives based on type?
Select one:
 a. Use protected variations
 b. Use Polymorphism
 c. User Expert
 d. Use adapter

Ans:  b. Use Polymorphism

6. F2188:Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.
Select one:
 a. Use Facade
 b. Use Chain Of Responsibility
 c. Use Interpreter
 d. Use Command pattern

Ans: d. Use Command pattern

7. F2142:How to design elements (objects, subsystems, and systems) so that the variations or instability in these elements does not have an undesirable impact on other elements?
Select one:
 a. Use creator
 b. Use Protected Variations
 c. Use Indirection
 d. Use Expert

Ans:  b. Use Protected Variations

8. F2146:Subtypes must be substitutable for their base types, is suggested by
Select one:
 a. SRP
 b. LSP
 c. OCP
 d. DIP

Ans:  b. LSP

9. F2165: GoF patterns can be classified as
Select one:
 a. Creational
 b. Structural
 c. Behavioural
 d. All the given choices

Ans :  d. All the given choices

10. F2118:Which of following are false?
Select one:
 a. Domain model shows conceptual perspective
 b. Domain model does not represent class diagrams.
 c. Design class diagram shows software perspective

Ans:  b. Domain model does not represent class diagrams.

11. F2153:Which design pattern would resolve who should be responsible for creating objects when there are special considerations such as complex creation logic, a desire to separate the creation responsibilities for better cohesion and so forth?
Select one:
 a. Singleton
 b. Creator
 c. Abstract factory
 d. Factory

Ans: d. Factory

12. F2145: While implementing OCP what are the guidelines?
Select one:
 a. Look for internal relationships
 b. Both Look for duplicated code AND Look at the change history
 c. Look for duplicated code
 d. Look at the change history
 e. Look at hidden methods

Ans:  b. Both Look for duplicated code AND Look at the change history

13. F2107a:Which of the following statements are true?
Select one:
 a. Within a specification perspective, derived associations and attributes indicate a constraint between values.
 b. All the given choices
 c. Derived associations and attributes can be found in class diagrams only.
 d. Within a specification perspective, derived associations and attributes indicate an implementation option e.g. optimization and performance considerations.
 
Ans:  b. All the given choices

14. F2168:Which of following is NOT true for behavioural design pattern?
Select one:
 a. Abstract the instantiation process
 b. Concerned with algorithms and assignment of responsibilities between objects
 c. Describe the patterns of communication between objects
 d. All the given choices

Ans:  a. Abstract the instantiation process

15. F2189:Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.
Select one:
 a. Use Command
 b. Use Composite
 c. Use Interpreter
 d. Use Facade

Ans :  c. Use Interpreter

16. F2168A:Which of following is NOT true for behavioural design pattern?
Select one:
 a. Neither of the given choices
 b. Behavioral class patterns use inheritance to distribute behavior between classes
 c. Concerned with algorithms and assignment of responsibilities between objects
 d. Both the given choices

Ans: a. Neither of the given choices

17. F2139:What object should have the responsibility, when you do not want to violate High Cohesion and Low Coupling, or other goals, but solutions offered by Exert (for example) are not appropriate?
Select one:
 a. Cohesion
 b. Expert
 c. Pure Fabrication
 d. Protected Variation

Ans:  d. Protected Variation

18. F2102:Package diagrams are designed for:
Select one:
 a. reducing dependency
 b. Organizing a large project into components
 c. All the given choices
 d. assisting deployment

Ans:  b. Organizing a large project into components

19. F2125:To partition the domain model into packages, place elements together that
Select one:
 a. Are weakly associate
 b. Participate in different use case
 c. Are in a class hierarchy together
 d. Are in same subject area
 e. Are in same subject area or Are in a class hierarchy together

Ans:  e. Are in same subject area or Are in a class hierarchy together

20. F2116:The property string specified in operations syntax can include
Select one:
 a. Abstract operation
 b. Exceptions that may arise
 c. Return type
 d. Exceptions that may arise and Abstract operation

Ans:  d. Exceptions that may arise and Abstract operation

21. F2191:______ promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently.
Select one:
 a. Mediator
 b. Command
 c. Iterator
 d. Interpreter

Ans:  a. Mediator

22. F2191:______ promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently.
Select one:
 a. Mediator
 b. Command
 c. Iterator
 d. Interpreter

Ans:  a. Mediator

23. F2180:How to change our design to reuse the logic to place an order and, at the same time, reducing the probability of being affected by changes in interfaces?
Select one:
 a. Use Facade
 b. Use Composite
 c. Use Observer

Ans: a. Use Facade

24. F2108:Which of the following statement is true about visibility?
Select one:
 a. UML adopts Java's convention
 b. UML uses # for public element
 c. UML uses - for private element
 d. UML uses * for protected element

Ans: c. UML uses - for private element

25.F2174: Which of following is NOT component of Strategy pattern?
Select one:
 a. Strategy
 b. Context
 c. Adaptee
 d. Concrete Strategy

Ans:  c. Adaptee

Software Architectures Quiz - 3 - M Tec - Software Systems - BITS PILANI WILP



Software Architectures Quiz - 3

BITS PILANI- WILP - M.Tec. - Software Systems

1. Which of the following statement is perfectly fitting for Cloud Computing?
Select one:
 a. It’s always going to be less expensive and more secure than local computing
 b. You can access your data from any computer in the world, as long as you have an Internet connection
 c. Only a few small companies are investing in the technology, making it a risky venture.
 d. None of the above

Ans: a. It’s always going to be less expensive and more secure than local computing

2. What is private cloud?
Select one:
 a. A standard cloud service offered via the Internet
 b. A cloud architecture maintained within an enterprise data center
 c. A cloud service inaccessible to anyone but the cultural elite
 d. All of the above

Ans: b. A cloud architecture maintained within an enterprise data center

3. class Asset { ... }
class Player {
Asset asset;
public Player(Assest purchasedAsset) { ... } /*Set the asset via Constructor or a setter*/
}

Which of the following concept of UML is represented via above diagram and code snippet :
Select one:
 a. Generalization
 b. Composition
 c. Dependency
 d. Association

Ans: d. Association

4. A good cloud computing network can be adjusted to provide bandwidth on demand.
Select one:
 a. False
 b. True

Ans: b

5. What is server virtualization?
Select one:
 a. It’s a problem that crops up with cloud computing when servers go offline.
 b. It’s a method of modeling a cloud computing network before you actually build it so that it works properly.
 c. It’s partitioning a normal server so that it behaves as if it’s multiple servers.
 d. All of the above

Ans: c. It’s partitioning a normal server so that it behaves as if it’s multiple servers.

6. In a scenario where House can contain multiple rooms - there is no independent life of room and any room can not belong to two different houses. If we delete the house - room will automatically be deleted. Which of the following concept of UML will best represent the above scenario?
Select one:
 a. Association
 b. Aggregation
 c. Composition
 d. Generalization
 e. None

Ans: c. Composition

7. Which of the following isn't an advantage of cloud?
Select one:
 a. No worries about running out of storage
 b. Immediate access to computing resources
 c. Paying only for what you use
 d. Easier to maintain a cloud network

Ans: d. Easier to maintain a cloud network

8. Network automation is unnecessary in cloud networks.
Select one:
 a. True
 b. False

Ans:  b. False

9. In UML diagrams, relationship between object and component parts is represented by
Select one:
 a. segregation
 b. aggregation
 c. ordination
 d. increment

Ans:  b. aggregation

10 Google Docs’ is example of:
Select one:
 a. Software as a Service
 b. Platform as a Service
 c. Infrastructure as a Service
 d. All of the above

Ans : a. Software as a Service

11. Amazon Web Services is which type of cloud computing distribution model?
Select one:
 a. Software as a service
 b. Infrastructure as a service
 c. Platform as a service
 d. All of the above

Ans :   b. Infrastructure as a service

12. A company is interested in Cloud Computing is looking for a provider who offers set of basic services such as Virtual server provisioning and on demand storage that can be combined into a platform for deploying and running customized application. What type of cloud computing model fits these requirements?
Select one:
 a. SaaS
 b. PaaS
 c. IaaS
 d. All of the above

Ans: c. IaaS

13. Object diagram captures the behavior of a single use case.’ This statement is:
Select one:
 a. False
 b. True

Ans: a. False

14. What is Redundant System?
Select one:
 a. It’s a system that has multiple data backups spread across multiple machines to guard against data loss.
 b. It’s a computer network that duplicates the services already provided by another network.
 c. It’s a computer network struck with a virus that causes it to perform the same operations repeatedly.

Ans: b. It’s a computer network that duplicates the services already provided by another network.

15. ‘B2 is the super class and A2 is the subclass in the relationship.’ Most appropriate UML notation will be:
Select one:
 a. Generalization
 b. Realization
 c. Aggregation
 d. Association

Ans: a. Generalization

16. Which diagram shows the configuration of run-time processing elements of the system?
Select one:
 a. Deployment diagram
 b. ER-diagram
 c. Component diagram
 d. Class diagram

Ans:  a. Deployment diagram

17. ‘Open source development involves making the source code of a system publicly available.’ Statement is:
Select one:
 a. True
 b. False

Ans: a. True

18. In a scenario where a single teacher can not belong to multiple departments, but if we delete the department, the teacher object will not be destroyed. Which of the following concept of UML will best represent the above scenario?
Select one:
 a. Association
 b. Aggregation
 c. Dependency
 d. Generalization
 e. Composition

Ans: b. Aggregation

19. If you are working on real-time process control applications or systems that involve concurrent processing, you would use a
Select one:
 a. Activity diagram
 b. Sequence diagram
 c. Object diagram
 d. Statechart diagram

Ans: d. Statechart diagram

20. Which diagram in UML emphasizes the time-ordering of messages?
Select one:
 a. Collaboration
 b. Class
 c. Activity
 d. Sequence

Ans: d. Sequence   

OBJECT ORIENTED ANALYSIS & DESIGN Comprehensive Examination - Regular Question Paper

SS ZG514: OBJECT ORIENTED ANALYSIS & DESIGN

Comprehensive Examination - Regular Question Paper 2015-2016
MTech Software Systems- BITS WILP



Data Structures and Algorithms Design (SSZG519) Comprehensive Examination - Regular Question Paper 2015-2016 MTech Software Systems- BITS WILP

Data Structures and Algorithms Design (SSZG519)

Comprehensive Examination - Regular Question Paper 2015-2016
MTech Software Systems- BITS WILP


Data Structures and Algorithms Design (SSZG519)- Quiz-2-MTech Software Systems- BITS Pilani-WILP

Data Structures and Algorithms Design (SSZG519)- Quiz- 2
MTech Software Systems- WILP(Work Integrated Learning Programmes) 
Birla Institute of Technology and Science, Pilani



1. Consider the following statements.

i) External nodes of heap does not store any keys or elements
ii) Insertion and deletion in heap can be done in O(logn) time
iii) Min can be found in constant time.

Select one:
a. None of the above
b. i, ii are true and iii is false
c. i is true  and ii, iii are false
d. All of them are true
e. All of them are false

Ans: d. All of them are true

2. Which of the sorting algorithm has same running time for every input of size n?

Select one:
a. Heap sort
b. Insertion Sort
c. Selection Sort
d. None of the above

Ans: c. Selection Sort

3. What is the best case running time for heap sort?

Select one:
a. O(n log n)
b. O(n)
c. None of the above
d. O(log n)
e. O(n²)

Ans: a. O(n log n)

4. Which of the following has more than O(n) space requirement where n is the number of items stored.

Select one:
a. Direct Address Table
b. Look-up Table
c. None of the above
d. Binary Search Tree
e. Log File

Ans: a. Direct Address Table

5. Which of the following statements are true?

i. In linear probing method, there are only m different probe sequences are possible.
ii. In quadratic probing method,  there are m^2 different probe sequences are possible
iii. In double hashing, there are only m different probe sequences are possible.

Select one:
a. None of the above
b. All of them are true
c. i is true  and ii, iii are false
d. All of them are false
e. i, ii are true and iii is false

Ans: e. i, ii are true and iii is false

6. A binary search tree has n internal nodes. The number of external nodes is at most

Select one:
a. n
b. n+1
c. None of these
d. 2n
e. log n

Ans: d. 2n

7. Let T be a binary search tree built by receiving keys 3, 5, 10, 4, 8, 12, 2, 9. The in-order traversal of T is

Select one:
a. Any random order of 3, 5, 10, 4, 8, 12, 2, 9
b. 2, 3, 4, 5, 8, 9, 10, 12
c. 12, 10, 9, 8, 5, 4, 3, 2
d. None of the above
e. 3, 5, 10, 4, 8, 12, 2, 9

Ans: b. 2, 3, 4, 5, 8, 9, 10, 12

8. The worst case running time to find a maximum element in Binary search tree with n items is

Select one:
a. O(1)
b. O(n2)
c. None of the above
d. O(n)
e. O(logn)

Ans: d. O(n)

9. Which of the following  have O(1) running time for insert operation.

Select one:
a. Binary Search Tree, Look-up Table
b. Look-up Table, Hash Table
c. Hash Table, Binary Search Tree
d. Log File, Hash Table
e. None of the above

Ans: d. Log File, Hash Table

10. Keys { 200,205,210,...,600} are stored in a chained hash table.

Let h(k) = k mod 101, alpha be the load factor, and v be the maximum number of keys stored in a single slot. Which of the following is true?

Select one:
a. alpha > 1
b. alpha >v
c. None of the above
d. alpha =v
e. alpha < v

Ans: e. alpha < v

11. Assume the keys are inserted in the following order. 1055, 1492, 1776, 1812, 1918, 1945.
1945 is stored in the slot ________ if linear probing policy is used and h(k) =5*x mod 8 is the auxiliary hash function.

Select one:
a. 0
b. 6
c. None of the above
d. 7
e. 5

Ans: d. 7

12. Keys "63, 73, 43, 98, 110" are stored in a direct address table.

"43"  will be stored in the slot ____________

Select one:
a. 43
b. 44
c. None of the above
d. 3
e. 0

Ans: a. 43

13. Let m is the size of the hash table and n is the number of elements in the hash table. Simple uniform hashing is impossible if

Select one:
a. n>m
b. n=2m
c. n<m
d. n=m
e. None of the above

Ans:  c. n<m

14. When using linear probing policy, the probability of an empty slot gets filled if it is preceded by i full slots.


Select one:
a. 1/m
b. (i+1)/m
c. None of the above
d. (i+1)/n
e. 1/n

Ans: b. (i+1)/m

15. Keys "63, 73, 43, 98, 110" are stored in a direct address table
What is the minimum size of the table?

Select one:
a. None of the above
b. 111
c. 109
d. 4
e. 5

Ans: b. 111

16. Which of the following input sequence stores the items { 1,2,3,4,5,6,7} in a size-balanced binary search tree (that is for every node v the number of nodes in the left subtree of v is same as the number of nodes in right subtree of v)

Select one:
a. 1,2,3,4,5,6,7
b. None of the above
c. 4,2,1,3,6,5,7
d. 4,3,1,2,7,5,6
e. 7,6,5,4,3,2,1

Ans: c. 4,2,1,3,6,5,7

17. Keys { 200,205,210,...,600} are stored in a chained hash table.

Suppose h(k) = k mod 100 is used, which slot will have maximum number of keys?

Select one:
a. 200
b. None of the above
c. 100
d. 99
e. 0

Ans: e. 0

18. Assume the keys are inserted in the following order. 1055, 1492, 1776, 1812, 1918, 1945.
Find the the total number of key comparisons if linear probing policy is used and h(k) = 5*x mod 8 is the auxiliary hash function.


Select one:
a. 6
b. 9
c. None of the above
d. 7
e. 4


Ans: b. 9

19. Assume the keys are inserted in the following order. 1055, 1492, 1776, 1812, 1918, 1945.
1812 is stored in the slot ___________ if double hashing policy is used with h_1(k) = 5*x mod 8 and h_2(x) = 1+ (k mod 7).


Select one:
a. 7
b. 4
c. 3
d. 1
e. None of the above

Ans: c. 3

20. Suppose a simple uniform hashing function is used with chaining. The expected number of key comparisons in successful search is at most __________


Select one:
a. None of the above
b. alpha
c. 1+ alpha/2 - alpha/(2n)
d. 1
e. 1+alpha

Ans: c. 1+ alpha/2 - alpha/(2n)


Data Structures and Algorithms Design Quiz-1 -MTech Software Systems- BITS PILANI - WILP

Data Structures and Algorithms Design (SSZG519)- Quiz- 1
MTech Software Systems- WILP(Work Integrated Learning Programmes) 
Birla Institute of Technology and Science, Pilani


1. Consider the following stack operations. new(), push(a), push(b), pop(), push (c), pop(), push(5). what is the index of top element in the array implementation?

Select one:
a. 2
b. None of the above
c. -1
d. 1
e. 0

Ans: d. 1

2. Suppose T is a proper binary tree with 11 internal nodes. What is the size of  T?

Select one:
a. 21
b. None of the above
c. 22
d. 23
e. 12

Ans: d. 23

3. Which of the following expressions is not sublinear?

Select one:
a. None of the above
b. O(logn)
c.n√n
d. O(log log n)
e. O(n)

Ans: e. O(n)

4. Consider the ArrayFind algorithm.

input     :   an element x, n, an array A of n integers

Output :     The index i such that A[i]=x or -1 if no element in A is equal to x

i ← 0

while i <n do

if x = A[i] then

return i

else

i ←i+1

return -1



 The number of primitive operations for the best case is

Select one:
a. n
b. 5
c. 1
d. 3
e. None of the above

Ans: b. 5

5. 1+3+9+27+... + 3n is

Select one:
a. O(2n)
b. O(n3)
c. None of the above
d. O(4n)

Ans: d. O(4n)

6. Consider a binary tree of size n. The minimum size of array in the array implementation is
Select one:
a. n
b. n2
c. None of the aboven
d. n log n
e. 2n

Ans: a. n

7.Consider the ArrayFind algorithm.

input     :   an element x, n, an array A of n integers

Output :     The index i such that A[i]=x or -1 if no element in A is equal to x

i ← 0

while i <n do

if x = A[i] then

return i

else

i ←i+1

return -1

The number of primitive operations for the worst case is

Select one:
a. None of the above
b. 5n+1
c. 5n
d. 5n+3
e. 5n-2

Ans: d. 5n+3

8. Which of these is the correct big-O expression for 1+4+9+...+n²?

Select one:
a. O(n³)
b. O(n²)
c. O(log n)
d. O(n log n)
e. None of the above

Ans: a. O(n³)

9. Stack is empty when t=1

Select one:
a. t=0
b. None of the above
c. t=-1
d. t=1

Ans: c. t=-1

10. Which of the following statements are true. '

i) 2(n+1) is O(2n)

ii) 2(2n) is O(2n)

Select one:
a. ii only
b. None of them is true
c. i only
d. Both of them are true

Ans: c. i only

11. If C =1, what would be the appropriate value of n_0 to show that 2n² +9 is O( n²)?


Select one:
a. None of the above
b. 5
c. 4
d. 10

Ans: a. None of the above

12. Which of the following formulas in big-O notation best represent the expression n²+3nlogn?

Select one:
a. O(n)
b. O(42)
c. O(n³)
d. O(n²)
e. None of the above

Ans: d. O(n²)

13. Algorithm A uses 5nlog n operations and algorithm B uses n\sqrt n operations. Determine the value n_0 such that A is better than B for n >n_0.
Select one:
a. None of the above
b. 2048
c. 1024
d. 4096
e. 512

Ans: d. 4096

14.Which of the following statements are true?

i. If f(n) is O(n3), then f(n) is o(n3)

ii. If f(n) is O(n3), then f(n) is Θ(n3)

iii. If f(n) is o(n3), then f(n) is O(n3)

Select one:
a. i only
b. i and iii only
c. All of them are true
d. None of them is true
e. iii only

Ans: e. iii only

15. log2(n/2) is

Select one:
a. None of the above
b. log n2
c. log2 n-1
d. log2 n -2logn +1

Ans: d. log2 n -2logn +1

16.T(n)  = b if n=1

             2T(n-1) +b otherwise

 Then T(n) is

Select one:
a. O(n2)
b. None of the above
c. O(log n)
d. O(2^n)
e. O(nb)

Ans: d. O(2^n)

17. Consider the following recurrence relation.



T(n) =   5 if n <= 2

            T(n-1)+ n otherwise

 Closed form solution for T(n) is

Select one:
a. None of the above
b. n(n+1)/2 +7
c. n(n+1)/2 +2
d. n(n+1)/2
e. n(n-1)/2

Ans: c. n(n+1)/2 +2

18. f-r Queue is full in the circular array implementation when n

Select one:
a. r-f=1
b. f-r=1
c. f-r=0
d. None of the above

Ans: d. None of the above

19. Which of the following statements are true?

I) n! Is O(n)

ii) n! Is O(n^n)

iii) n! Is O(2n)

Select one:
a. ii and iii
b. ii only
c. None of the above
d. i only

Ans: b. ii only

20. Algorithm Loop(n)

    p ← 1

    for i← 1 to n do

                 p ← p.i

return p

Give a big-Oh characterization for the above algorithm.

Select one:
a. None of the above
b. O(logn)
c. n√n
d. O(n)
e. O(1)

Ans: d. O(n)


AngularJS Prevent Event Propagation Click Example

AngularJS Prevent Event Propagation Click Example

Today I was stuck with a problem in angularjs. I have a table row and a button in table cell. I have bound event event for both table row and button. So I have to disable event on table row click when I click on button, in other words I have to stop propagation of event on button click.

I found a solution as below,

<a href="#" ng-click="functionName(); $event.preventDefault(); $event.stopPropagation();">


$event.stopPropagation(); alone was not working. When I used $event.stopPropagation(); alone, on click it was redirecting to some other page. When I tried adding  $event.preventDefault(); $event.stopPropagation();. It worked.

Reference:
http://stackoverflow.com/questions/10931315/how-to-preventdefault-on-anchor-tags

Yeoman - Create an AngularJs Scaffold

Yeoman - Create an AngularJs Scaffold


Introduction
Yeoman is used to generate a basic scaffolding of app. This will help to start a new project quickly, creating folder structure and configuration, adding necessary libraries/tools like bootstrap, sass etc. and prescribing best practices. There are generators associated with yo for different languages like angular, backbone, etc.

Environment setup and Installation
1. Pre-requisites:

  • Node.js v0.10.x+
  • npm (which comes bundled with Node) v2.1.0+
  • git

2.Install yo, bower and grunt
   C:\>npm install --global yo bower grunt-cli

3. Install generator-angular and generator-karma using this command:
   C:\>npm install --global generator-angular@0.11.1 generator-karma

Generate Angular App
Create a folder for app,
  C:\>md yApp
  C:\>cd yApp

Now access generators via the Yeoman menu,
  C: \yApp>yo


Select Angular as generator.  On selecting angular, it will ask whether to include different components like Sass, bootstrap and different angular-modules.


On hitting enter key, different modules will be installed and app will be generated. We can edit this app and develop our app. Like we can add new controller in controller folder, add new view in views folder. Also add other libraries using bower.


Run App: Start Server
Use below command to run grunt task to start Node-based http server on localhost:9000.
C:\yApp>grunt serve


Run Unit Tests-Using Karma and Jasmine
The Angular generator has included two test frameworks: ngScenario and Jasmine. A test directory is created in the root folder, creates test spec files, created a karma.conf.js file, and pulled in the Node modules for Karma while generation of app. Add/Edit spec file for testing different modules. Use below command to run unit tests.
C:\yApp>grunt test

Get production app: Minification and Uglification
Concatenate and minify our scripts and styles to save on those network requests, run unit tests, optimize images if we were using any, etc. are one to make the code production ready using the command below,
C:\yApp>grunt

Remote Desktop Shortcut and VM Issue



Remote Desktop Shortcut and VM Issue

We usually work in virtual machines connected using Remote Desktop Connection or Citrix. The experience with remote machine is bad compared to our desktop machine. Sometime it is difficult to work with remote machines. One day I have fallen into a problem that the process explorer.exe in my virtual machine got stopped working and my desktop was all blank. I was stuck that I was not able to contact service center who used to help in situations like this. I have googled for some solution and this remote desktop connection helped me to resolve the issue. Using the shortcut, I have run the task manager and run explorer.exe using new task  option.

References:

https://blogs.technet.microsoft.com/keithmayer/2012/06/07/passing-the-windows-key-to-a-remote-rdp-session-with-windowsserver2012/

AngularJS Sort and Search in Table

AngularJS Sort and Search in Table

Today I have implemented sort and search functionality for table, just like jquery datatable, referring a tutorial on scotch.io. It is easy to implement.

https://scotch.io/tutorials/sort-and-filter-a-table-using-angular

Yeoman bootstrap styling not coming for angular generator

Yeoman - AngularJS Generator Bootstrap Styling Issue

I have created an angular project using yeoman angular generator with bootstrap. After generating the scaffold app, I observed that bootstrap was not added successfully even though i have selected to add bootstrap during the generation of scaffolding. The issue has been solved by manually adding the bootstrap in bower.json or installing bootstrap manually.

bower install --save bootstrap#3.3.4
grunt serve

Reference:
http://stackoverflow.com/questions/30946498/yeoman-and-bower-not-adding-bootstrap-css-angular-generator



Transfer PF from Prev Company To New Company

Transfer PF from Previous Company To New Company 

I have recently joined new company(CTS). I had opted to transfer the PF to new company while leaving the previous company(TCS). 3 months after joining the new company I requested to transfer the PF accumulations. I find difficult to follow the procedure, so thought of make a note on this,

The situation as per my understanding is this. Previous employer has created a PF account and put money on that account. Also new employer has created a new PF account and added money. New employer will deposit money only to this PF account, will not add money to PF account that created by previous employer. Now after changing company, PF accumulations in previous employer PF account need to be transferred to PF account created by new employer. For this we need to fill form 13 online(http://www.epfindia.gov.in/) and hand over the hard copy to HR of the new employer. The current employer only can transfer the amount from previous company.

I have followed the document http://www.epfindia.com/site_docs/PDFs/OTCP_PDFs/ProcessFlowforMembers.pdf  to complete the process.

Details Required:
PF account details of previous employer and current employer which can be obtained from payslips.
A PF Account number will be associated with previous employer. eg: MH/BAN/XXXXX/XXXXXX
A PF number will be associated with current employer. eg: TN/MAS/XXXXX/XXXXXX

Steps:
1. Register in http://www.epfindia.gov.in/.
2. Check eligibility for PF transfer in PF site(www.epfindia.gov.in ).
3. If eligible for PF transfer, fill necessary details in form 13 online.
4. Take printout of the application and hand over to hr of the current employer.

A Sample VB Console Application

A Sample VB Console Application
 To create a sample visual basic console application, follow below steps,
Open visual studio

File> New Project> Visual Basic> Console Application

Give a name, say ConsoleApplication1, for your application and click OK.

A project will be created and module.vb file will opened as below.



Module Module1

    Sub Main()
     
    End Sub

End Module

To print hello world on console we will add
        Console.WriteLine("Hello World")
inside Main() subroutine.

On running the application, we will get nothing. Actually the code is executed, hello world is printed but console window is closed after this.

To prevent closing of the console window, we will add
 Console.ReadKey()
which will wait for user input.

Module Module1

    Sub Main()
        Console.WriteLine("Hello World")
        Console.ReadKey()
    End Sub

End Module

Now run the application

Secure message feature in Outlook: Send password securely

Secure message feature in Outlook: Send password securely

Sometimes it is unavoidable to share the confidential information like username and password to people through emails. Sending normal email is not recommended for this.Secure message feature can be used to share confidential information. Advantages of this feature are
1. Restricted access to email. Recipient will be authenticated.
2. The mail can not be forwarded further.
3. Email content can not copied or printed.


To use this feature, select the options, Option>Permission


Adding Index Page/Table of Contents to Word Document

Adding Index Page/ Table of Contents to Word Document

I was preparing a word document which should be shared with client. I have to add an index page to the document. I tried to type headings and add page numbers which was very difficult and not looking good. I googled for better option and found a method to add table of contents which is very easy and beautiful.

https://www.youtube.com/watch?v=qmfGeSFB2P8

Step 1: Select the fields to be added in the index page and apply appropriate styles.
Suppose you are doing a word document like below having a main title and many subtitles. Apply Heading1 style to main title and Heading2 style for subtitles.

After applying styles page will be changed according to the style settings. example below.



Step 2: Find a space (Using Insert>Page Break ) to add table of contents.

Step 3: Add Table of Contents using References>Table of Contents>Select any template.Done.







Things to be taken care when choosing a house for rent

Things to be taken care when choosing a house for rent
I live in a rented house as my native place is far from native place. During proffessional life I have changed my accommadation twice. When going for a new rented house I had to give a security amount to the house owner and  will get it back when I will leave. First time I got half of my security amount and second time I didn't get a penny. The owner will find many reasons to not to return the money. So when you choose a house for rent, select one which you can stay long. The main factors I recommend are,
1. Transportation
2. Near to office
3. Near to shops
4. Near to city
5. Mobile range
6. Water availability
7. Waste disposal
8. Good owner and neighbors
9. Pollution
10. Near to hospital, hotel, etc
11. Near to railway
12. Room ventilation, architecture, age
13. Bathroom condition
14. Mosquitoes
15. Vasthu

Print Functionality For Web App

The Print Functionality on a Webpage

Today I have to deal with print functionality for a web page. Apart from Ctrl+P there are things to be taken care for printing, why need for a "print this page" button.

For printing, the pages should not be like webpage we see. The menus and other unwanted items can be avoided. The entire webpage will be divided into many pages. The page layout can be changed. Images and coloring can be changed. Typography can be changed.

The print function can be achieved using window+print();, http://jsfiddle.net/35vAN/ looks very interesting

You might have seen "print this page" button in web pages. Upon clicking this will convert the page so that it will be convenient for taking hard copies. Print page can be converted effectively using print styles. For responsive web design, this is not much applicable since the layout changes according to the screen size.