Showing posts with label unit 2. Show all posts
Showing posts with label unit 2. Show all posts

Monday, December 8, 2014

CS2302-COMPUTERNETWORKS

17. Define Aggregation points?
            It collects and processes the data they receive from neighboring nodes, and then transmit the processed data. By processing the data incrementally, instead of forwarding all the raw data to the base station, the amount of traffic in the network is reduced.


18. Define Beacons?
            Beacon to determine their own absolute locations based on GPS or manual configuration. The majority of nodes can then derive their absolute location by combining an estimate of their position relative to the beacons with the absolute location information provided by the beacons.

19. What is the use of Switch?
            It is used to forward the packets between shared media LANs such as Ethernet. Such switches are sometimes known by the obvious name of LAN switches.

20. Explain Bridge?
            It is a collection of LANs connected by one or more bridges is usually said to form an extended LAN. In their simplest variants, bridges simply accept LAN frames on their inputs and forward them out on all other outputs.

21. What is Spanning tree?
            It is for the bridges to select the ports over which they will forward frames.

22. What are the three pieces of information in the configuration messages?
1.      The ID for the bridge that is sending the message.
2.      The ID for what the sending bridge believes to the root bridge.
3.      The distance, measured in hops, from the sending bridge to the root bridge.

23. What is broadcast?
            Broadcast is simple – each bridge forwards a frame with a destination broadcast address out on each active (selected) port other than the one on which the frame was received.

Sunday, December 7, 2014

CS2302-COMPUTERNETWORKS - Unit 2

1. What are the functions of MAC?
            MAC sub layer resolves the contention for the shared media. It contains synchronization, flag, flow and error control specifications necessary to move information from one place to another, as well as the physical address of the next station to receive and route a packet.

2. What are the functions of LLC?
The IEEE project 802 models take the structure of an HDLC frame and divides it into 2 sets of functions. One set contains the end user portion of the HDLC frame – the logical address, control information, and data. These functions are handled by the IEEE 802.2 logical link control (LLC) protocol. 

3. What is Ethernet?
            Ethernet is a multiple-access network, meaning that a set of nodes send and receive frames over a shared link.

4. Define the term carrier sense in CSMA/CD?
            All the nodes can distinguish between idle and a busy-link and “collision detect” means that a node listens as it transmits and can therefore detect when a frame it is transmitting has interfered (collided) with a frame transmitted by another node.

5. Define Repeater?
            A repeater is a device that forwards digital signals, much like an amplifier forwards analog signals. However, no more than four repeaters may be positioned between any pairs of hosts, meaning that an Ethernet has a total reach of only 2,500m.

6. Define collision detection?
            In Ethernet, all these hosts are competing for access to the same link, and as a consequence, they are said to be in the same collision detection.

7. Why Ethernet is said to be a I-persistent protocol?
            An adaptor with a frame to send transmits with probability ‘1 ‘whenever a busy line goes idle.

8. What is exponential back off?
            Once an adaptor has detected a collision and stopped its transmission, it waits a certain amount of time and tries again. Each time it tries to transmit but fails, the adaptor doubles the amount of time it waits before trying again. This strategy of doubling the delay interval between each transmission attempt is a general technique known as exponential back off.

Friday, August 15, 2014

CS 2305 PROGRAMMING PARADIGM - Unit 2

11. What is garbage collection? What is the process that is responsible for doing that in java?  
Reclaiming the unused memory by the invalid objects. Garbage collector is responsible for this process 

12. What kind of thread is the Garbage collector thread? - It is a daemon thread. 

13.What is a daemon thread? 
 These are the threads which can run without user intervention. The JVM can exit when there are daemon thread by killing them abruptly. 

14. How will you invoke any external process in Java?  
Runtime.getRuntime().exec(….) 

15. What is the finalize method do?
 Before the invalid objects get garbage collected, the JVM give the user a chance to clean up some resources before it got garbage collected. 

Thursday, August 14, 2014

CS 2305 PROGRAMMING PARADIGM - Unit 2

1. What's the difference between a queue and a stack? 
 Stacks works by last-in-first-out rule (LIFO), while queues use the FIFO rule 
 
2. You can create an abstract class that contains only abstract methods. On the other hand, you can create an interface that declares the same methods. So can you use abstract classes instead of interfaces? 
Sometimes. But your class may be a descendent of another class and in this case the interface is your only option. 
 
3. What comes to mind when you hear about a young generation in Java? 
Garbage collection. 
 
4. What comes to mind when someone mentions a shallow copy in Java? 
 Object cloning. 
 
5. If you're overriding the method equals() of an object, which other method you might also consider? 
hashCode() 
 

Sunday, April 27, 2014

Software Architecture unit 2

1. What is KWIC? 
The KWIC (Key Word In Context) index system accepts an ordered set of lines; each line is an ordered set of words, and each word is an ordered set of characters. Any line may be “circularly shifted” by repeatedly removing the first word and appending it at the end of the line. The KWIC index system outputs a listing of all circular shifts of all lines in alphabetical order. 

2. What are the software design changes proposed by Parnas? 
• Changes in the processing algorithm 
• Changes in the data representation 

3. What are the considerations given by Garlan, Kaiser, and Notkin? 
The considerations given by Garlan, Kaiser, and Notkin are as follows: 
. Enhancement to system function 
. Performance 
. Reuse 

4. Give reasons, why Main Program/Subroutine with shared data style is not suitable for KWIC? 
A change in data storage format will affect almost all of the modules. Also changes in the overall processing algorithm and enhancements to system function are not easily accommodated. Finally this decomposition is not particularly supportive of reuse. 

5. Why Abstract data type style is more suitable for KWIC? 

Abstract data type style is more suitable for KWIC, because both the algorithms  and data representations can be changed in individual modules without affecting others. Also reuse is better supported, because modules make fewer assumptions about the others with which they interact. 

Saturday, April 12, 2014

DBMS

21. What are composite attributes? 
Composite attributes can be divided in to sub parts. 
22. Define null values. 
In some cases a particular entity may not have an applicable value for an attribute or if we do not know the value of an attribute for a particular entity. In these cases null value is used. 
23. Define the terms 
i) Entity type 
ii) Entity set 
Entity type: An entity type defines a collection of entities that have the same attributes. 
Entity set: The set of all entities of the same type is termed as an entity set. 
24. What is meant by the degree of relationship set? 
The degree of relationship type is the number of participating entity types. 
25. Define the terms 

i) Key attribute 
ii) Value set 
Key attribute: An entity type usually has an attribute whose values are distinct from each individual entity in the collection. Such an attribute is called a key attribute. 
Value set: Each simple attribute of an entity type is associated with a value set that specifies the set of values that may be assigned to that attribute for each individual entity. 

Thursday, March 20, 2014

Operating System

21.What is a thread? 
A thread otherwise called a lightweight process (LWP) is a basic unit of CPU utilization, it comprises of a thread id, a program counter, a register set and a stack. It shares with other threads belonging to the same process its code section, data section, and operating system resources such as open files and signals. 

22.What are the benefits of multithreaded programming? 
The benefits of multithreaded programming can be broken down into four major categories: 
• Responsiveness 
• Resource sharing 
• Economy 
• Utilization of multiprocessor architectures 

23.Compare user threads and kernel threads. 
User threads 
User threads are supported above the kernel and are implemented by a thread library at the user level. Thread creation & scheduling are done in the user space, without kernel intervention. Therefore they are fast to create and manage blocking system call will cause the entire process to block 
Kernel threads 
Kernel threads are supported directly by the operating system .Thread creation, scheduling and management are done by the operating system. Therefore they are slower to create & manage compared to user threads. If the thread performs a blocking system call, the kernel can schedule another thread in the application for execution 

24.What is the use of fork and exec system calls? 
Fork is a system call by which a new process is created. Exec is also a system call, which is used after a fork by one of the two processes to replace the process memory space with a new program. 

25.Define thread cancellation & target thread. 
The thread cancellation is the task of terminating a thread before it has completed. A thread that is to be cancelled is often referred to as the target thread. For example, if multiple threads are concurrently searching through a database and one thread returns the result, the remaining threads might be cancelled. 

Wednesday, March 19, 2014

Operating System


11.What is Dual-Mode Operation? 
The dual mode operation provides us with the means for protecting the operating system from wrong users and wrong users from one another. User mode and monitor mode are  the two modes. Monitor mode is also called supervisor mode, system mode or  privileged mode. Mode bit is attached to the hardware of the computer to indicate the  current mode. Mode bit is '0' formonitor mode and '1' for user mode. 

12.What are privileged instructions? 
Some of the machine instructions that may cause harm to a system are designated as  privileged instructions. The hardware allows the privileged instructions to be executed only in monitor mode. 

13.How can a user program disrupt the normal operations of a system? 
A user program may disrupt the normal operation of a system by  
• Issuing illegal I/O operations 
• By accessing memory locations within the OS itself 
• Refusing to relinquish the CPU 

14.How is the protection for memory provided? 
The protection against illegal memory access is done by using two registers. The base register and the limit register.The base register holds the smallest legal physical address; the limit register contains the size of the range. The base and limit registers can be loaded only by the OS using special privileged instructions. 

15.What are the various OS components? 
The various system components are 
• Process management 
• Main-memory management 
• File management 
• I/O-system management 
• Secondary-storage management 
• Networking 
• Protection system 

• Command-interpreter system 

Saturday, March 8, 2014

Computer Network

14. Explain the term handoff?
            If the phone is involved in a call at the time , the call must be transferred to the new base station in what is called a hand off.

15. Define satphones?
            Satphones use communication satellites as base stations, communicating on frequency bands that have been reserved internationally for satellite use.

16. How to mediate access to a shared link?
            Ethernet,token ring, and several wireless protocols. Ethernet and token ring media access protocols have no central arbitrator of access. Media access in wireless networks is made more complicated by the fact that some nodes may be hidden from each other due to range limitations of radio transmission.

17. Define Aggregation points?
            It collects and processes the data they receive from neighboring nodes, and then transmit the processed data. By processing the data incrementally, instead of forwarding all the raw data to the base station, the amount of traffic in the network is reduced.

18. Define Beacons?
            Beacon to determine their own absolute locations based on GPS or manual configuration. The majority of nodes can then derive their absolute location by combining an estimate of their position relative to the beacons with the absolute location information provided by the beacons.

Friday, March 7, 2014

Computer Network

1. What are the functions of MAC?
            MAC sub layer resolves the contention for the shared media. It contains synchronization, flag, flow and error control specifications necessary to move information from one place to another, as well as the physical address of the next station to receive and route a packet.

2. What are the functions of LLC?
The IEEE project 802 models take the structure of an HDLC frame and divides it into 2 sets of functions. One set contains the end user portion of the HDLC frame – the logical address, control information, and data. These functions are handled by the IEEE 802.2 logical link control (LLC) protocol. 

3. What is Ethernet?
            Ethernet is a multiple-access network, meaning that a set of nodes send and receive frames over a shared link.

4. Define the term carrier sense in CSMA/CD?
            All the nodes can distinguish between idle and a busy-link and “collision detect” means that a node listens as it transmits and can therefore detect when a frame it is transmitting has interfered (collided) with a frame transmitted by another node.

5. Define Repeater?
            A repeater is a device that forwards digital signals, much like an amplifier forwards analog signals. However, no more than four repeaters may be positioned between any pairs of hosts, meaning that an Ethernet has a total reach of only 2,500m.

6. Define collision detection?
            In Ethernet, all these hosts are competing for access to the same link, and as a consequence, they are said to be in the same collision detection.

Saturday, March 1, 2014

Operating System

31.What are the various scheduling criteria for CPU scheduling? 
The various scheduling criteria are 
• CPU utilization 
• Throughput 
• Turnaround time 
• Waiting time 
• Response time 

32.Define throughput? 
Throughput in CPU scheduling is the number of processes that are completed per unit time. For long processes, this rate may be one process per hour; for short transactions, throughput might be 10 processes per second. 

33.What is turnaround time? 
Turnaround time is the interval from the time of submission to the time of completion of a process. It is the sum of the periods spent waiting to get into memory, waiting in the ready queue, executing on the CPU, and doing I/O. 

34.Define race condition
When several process access and manipulate same data concurrently, then the outcome of the execution depends on particular order in which the access takes place is called race condition. To avoid race condition, only one process at a time can manipulate the shared variable. 

35.What is critical section problem? 
Consider a system consists of 'n' processes. Each process has segment of code called a critical section, in which the process may be changing common variables, updating a table, writing a file. When one process is executing in its critical section, no other process can allowed to execute in its critical section. 

Saturday, January 11, 2014

Constraint Satisfaction Problem
Constraint satisfaction problems or CSPs are mathematical problems where one must
find states or objects that satisfy a number of constraints or criteria. A constraint is a
restriction of the feasible solutions in an optimization problem.
Many problems can be stated as constraints satisfaction problems. Here are some
examples:
Example 1: The n-Queen problem is the problem of putting n chess queens on an n×n
chessboard such that none of them is able to capture any other using the standard chess
queen's moves. The colour of the queens is meaningless in this puzzle, and any queen is
assumed to be able to attack any other. Thus, a solution requires that no two queens share
the same row, column, or diagonal.
The problem was originally proposed in 1848 by the chess player Max Bazzel, and over
the years, many mathematicians, including Gauss have worked on this puzzle. In 1874, S.
Gunther proposed a method of finding solutions by using determinants, and J.W.L.
Glaisher refined this approach.
The eight queens puzzle has 92 distinct solutions. If solutions that differ only by
symmetry operations (rotations and reflections) of the board are counted as one, the
puzzle has 12 unique solutions. The following table gives the number of solutions for n
queens, both unique and distinct.

A Constraint Satisfaction Problem (CSP) is characterized by:
• a set of variables {x1, x2, .., xn},
• for each variable xi a domain Di with the possible values for that variable, and
• a set of constraints, i.e. relations, that are assumed to hold between the values of
the variables. [These relations can be given intentionally, i.e. as a formula, or
extensionally, i.e. as a set, or procedurally, i.e. with an appropriate generating or
recognising function.] We will only consider constraints involving one or two
variables.

The constraint satisfaction problem is to find, for each i from 1 to n, a value in Di for xi
so that all constraints are satisfied.

Backtracking Search and Local search for CSP
Backtracking
We order the variables in some fashion, trying to place first the variables that are more
highly constrained or with smaller ranges. This order has a great impact on the efficiency
of solution algorithms and is examined elsewhere. We start assigning values to variables.
We check constraint satisfaction at the earliest possible time and extend an assignment if
the constraints involving the currently bound variables are satisfied.

Example 2 Revisited: In our crossword puzzle we may order the variables as follows:
1ACROSS, 2DOWN, 3DOWN, 4ACROSS, 7ACROSS, 5DOWN, 8ACROSS, 6DOWN.

Heuristic Search (Local Search) in CSP
In the last few years, greedy local search strategies became popular, again. These
algorithms incrementally alter inconsistent value assignments to all the variables. They
use a "repair" or "hill climbing" metaphor to move towards more and more complete
solutions. To avoid getting stuck at "local optima" they are equipped with various
heuristics for randomizing the search. Their stochastic nature generally voids the
guarantee of "completeness" provided by the systematic search methods.
The local search methodology uses the following terms:
state (configuration): one possible assignment of all variables; the number of
states is equal to the product of domains' sizes
evaluation value: the number of constraint violations of the state (sometimes
weighted)
neighbor: the state which is obtained from the current state by changing one
variable value
local-minimum: the state that is not a solution and the evaluation values of all of
its neighbors are larger than or equal to the evaluation value of this state
strict local-minimum: the state that is not a solution and the evaluation values of
all of its neighbors are larger than the evaluation value of this state
non-strict local-minimum: the state that is a local-minimum but not a strict

local-minimum.
Local Search Algorithms and Optimistic Problems
Local search methods work on complete state formulations. They keep only a small
number of nodes in memory.
Local search is useful for solving optimization problems:
o Often it is easy to find a solution
o But hard to find the best solution
Algorithm goal:
find optimal configuration (e.g., TSP),
• Hill climbing
• Gradient descent
• Simulated annealing
• For some problems the state description contains all of the information relevant
for a solution. Path to the solution is unimportant.
• Examples:
o map coloring
o 8-queens

• Start with a state configuration that violates some of the constraints for being a
solution, and make gradual modifications to eliminate the violations.
• One way to visualize iterative improvement algorithms is to imagine every
possible state laid out on a landscape with the height of each state corresponding
to its goodness. Optimal solutions will appear as the highest points. Iterative
improvement works by moving around on the landscape seeking out the peaks by
looking only at the local vicinity.

Iterative improvement
In many optimization problems, the path is irrelevant; the goal state itself is the solution.
An example of such problem is to find configurations satisfying constraints (e.g., nqueens).
Algorithm:
– Start with a solution
– Improve it towards a good solution
Example:
N queens
Goal: Put n chess-game queens on an n x n board, with no two queens on the same row,

column, or diagonal.
UNIT II
Searching Techniques
Introduction
We have outlined the different types of search strategies. In the earlier chapter we have
looked at different blind search strategies. Uninformed search methods lack problemspecific
knowledge. Such methods are prohibitively inefficient in many cases. Using
problem-specific knowledge can dramatically improve the search speed. In this chapter
we will study some informed search algorithms that use problem specific heuristics.
Review of different Search Strategies
1. Blind Search
a) Depth first search
b) Breadth first search
c) Iterative deepening search
d) Bidirectional search

2. Informed Search

Informed Search and Exploration
Graph Search Algorithm
We begin by outlining the general graph search algorithm below.
Graph search algorithm
Review of Uniform-Cost Search (UCS)
We will now review a variation of breadth first search we considered before, namely
Uniform cost search.
To review, in uniform cost search we enqueue nodes by path cost.
Let g(n) = cost of the path from the start node to the current node n.
Version 1 CSE IIT, Kharagpur
The algorithm sorts nodes by increasing value of g, and expands the lowest cost node of
the fringe.
Properties of Uniform Cost Search
• Complete
• Optimal/Admissible
• Exponential time and space complexity, O(bd)
The UCS algorithm uses the value of g(n) to select the order of node expansion. We will
now introduce informed search or heuristic search that uses problem specific heuristic

information. The heuristic will be used to select the order of node expansion.