Pages>> 1 2 3 4 5 6 7 8
Here we are giving chapter wise notes of operating system based on operating system concepts by galvin
CPU Sheduling

q) what is idea behind multiprogramming?
a) a process is executed till it has to wait, generally for I/O request.then cpu given to some other process.

note:- the process execution consists of series of cpu and i/o bursts, starting and ending with cpu burst only.

q) when a process can go from running state to ready state directly?
a) when an interuppt occurs.

q) what is non-preemptive scheduling?
a) here once cpu is given to a process, then the process release it only if it terminates ot need to do i/o. windows3.1 is
eg.

q) what are cases to be considered in case of preemptive scheduling?
a) (we here may need timer)
case1:- a process in middle of updating a data is preempted, other process after it tries to use that inconsistent data.
case2:- when kernel data structures are inconsistent, then preemption should not take place.

q) what is a dispatcher?
a) it gives control of cpu to a process selected by cpu scheduler. its functions are:-
1) context switch.
2) switch to user mode.
3) jump to proper location in program to restart it.

q) what is dispatch latency?
a) time taken by dispatcher to stop 1 process and start another.

q) what is throughput?
a) it is defined as the number of processes completed per unit time.

q) what is response time?
a) it is time between submission of process to first response is produced.

note:- fcfs can be implemented using a queue.when a process is given cpu, then its pcb is removed from queue.

q) what is gantt chart?
a) it is used to find waiting time in case of cpu scheduling algorithms.

q) what is convoy effect?
a) it occurs in case of fcfs scheduling.it occurs as small processes wait in queue for big process to leave cpu.

note:- fcfs is non-preemptive, hence not at all suitable for time-sharing systems.

q) what is key logic of shortest job first scheduling algorithm?
a) here algorithm associates with each each process latter's next cpu burst. cpu is given to process with smallest next cpu
burst.

q) what is difficulty with SJF?
a) knowing the length of next cpu burst. it is generally used in long term scheduling.

q) can we implement it at the cpu level?
a) it is difficult to know next cpu burst length. to implement it cpu burst time is predicted on the basis of the previous
ones.

q) what is nature of SJF?
a) it can be preemptive(SRT) as well as non-preemptive.

q) what is priority scheduling?
a) here with each process a priority is attached, and process with highest priority is selected for cpu.

q) how to define these priorities?
a) can be defined internally or externally:-
*internally:- by factores like memory requirements,number of open files,ratio of average i/o burst and cpu burst.
*externally:- importance of process,funds paid, political factors.

note:- it can be preemptive or non-preemptive.

q) what is indefinite blocking or starvation?
a) a system where stream of high priority processes comes continously, then a low priority process in queue, keeps waiting
indefinitely.

q) what is solution to this?
a) solution is aging.here we keep on increasing the priority of a process waiting for long time after some fixed time, till
it becomes high priority process and gets executed.

q) what is RR scheduling?
a) it is special for time sharing systems.here timer also is set before process execution starts.

note:- the time unit above is called time quantum or time slice.

time quantum must be large than the context switch as context switch time is included in the time slice.

q) where we can use multilevel-queue-scheduling?
a) where we can classify the processes easily.some common categories are:- interactive processes,background(batch) processes,
system processes.

q) what is logic for multilevel queues?
a) separate processes in separate queues, each having its own scheduling needs.like interactive processe need RR and batch
processes can be done using FCFS.

note:- now ready queue is splitted into separate queue,on basis of type of process, and there must be scheduling among queues
also.

q) what is technique used in Solaris2?
a) higher order queues need be done before a lower level queue.if control in lower queue and a process come in higher order
, preemtion is required.

note:- time slice can also be used between the queues.

q) how is multilevel-feedback-queue scheduling different from multilevel-queues?
a) here the processes can move between the queues. here logic is to separate processes on basis of cpu burst.if process uses
too much cpu time, it is moved to lower queue.

q) what we do for load sharing in multi-processor scheduling?
a) use only 1 queue and schedule on to available processor. here each processor can select a process from queue for itself.
or a master-slave relationship is used.here 1 processor schedules other processors.other processors only execute user-code.


q) how process is submitted in hard real-time systems?
a) here process is given along with statement of amount of time it needs to complete or do I/O. here the scheduler then
admits process with guarantee that it will complete on time or it will reject it as impossible. it is called resource
reservation.

note:- here the scheduler must know that how much time each o.s function takes.

q) how to keep dispatch latency low in case of soft-real time processes?
a) to preempt system calls.in long duration system calls, preemption points are introduced,where check is made to see if
higher priority process wants to run. preemption points need to placed at safe positions. but only few preemption points
can be added to a system process.

Pages>> 1 2 3 4 5 6 7 8

Reblog this post [with Zemanta]
Pages>> 1 2 3 4 5 6 7 8

Here we are giving chapter wise notes of operating system based on operating system concepts by galvin

O.S STRUCTURES

q) what if 2 processes are associated with same program?
a) they are considered separate.

q) tell some impotant funcions of o.s?
a) process management,main memory management,file management,i/o system management, secondary storage management.

q) which protocol needs a clients to login before using server's resources and which does not need this?
a) that require log in are:- ftp,nfs(network file system).
do not require log in:- http

q) what is protection?
a) it is a mechanism for controlling access of programs,processes to resources defined by computer system.

q) what is command interpreter?
a) it is one of the most important system program of o.s, which is interface b/w user and o.s .some o.s include it in their kernel,others run it when job is initiated.

q) what is shell?
a) a program that reads and interprets control statements(commands given to o.s) is executed automatically.this program is called command line interpreter or shell.

q) tell some important o.s services?
a) it provides environment for execution of programs. some services are:-
1) program execution:-
2) i/o operations:- user can't control these operations, o.s need to carry out these.
3) file-system manipulation:-
4) communications:- it may be implemented by shared memory or message passing.
5) error detection:-
6) resource allocaton:-
7) accounting:- it may be used to bill users or by researchers to reconfigure the system.
8) protection:-

q) what are system calls?
a) these provide inteface b/w the process and o.s, and are generally available as assembly language instructions.

q) name some languages where u can make system calls directly?
a) c,c++,perl,assembly language.

q) give example of certain system calls?
a) display message on screen,open files, closing files, terminate normally or abnormally,read from or write to file,etc.

note:- we need to specify certain information that will be passed to o.s as parameter with system calls.

q) what are the various methods to pass parameters to o.s by system calls?
a) there are 3 methods:-
1) pass parameters in registers.
2) if parameters more then parameter stored in block in memory and address to block passed as parameter in register (linux use this).
3) some use stack.

q) what are different categories of system calls?
a) process control,file management,device management,information maintainance and communications.

q) in case of processes tell a common system call?
a) create process.

q) name some system calls dealing with the coordination of system processes?
a) wait time,wait event,signal event.

q) name for file system calls?
a) create,delete,read,write,reposition,get/set file attributes.

note:- device also behave as files only, system calls like request,release,read,write etc are there.

q) name some information maintainance system calls?
a) system call that return date and time,number of current users,version of o.s,about all processes etc.

q) system calls in case of communications?
a) get hostid,get processid. what these 2 return are passed as parameters to openconnection,close connection calls.then we have read message ,write message.

q) what are deamons?
a) most processes that will be recieving connections are special purpose deamons(system programs). they execute wait for connection call and gets awakened when connection is made.

q) what are system programs?
a) these are generally user interfaces to system calls.

q) how many types of system programs are there?
a) 1)file management:- these programs create ,delete,copy,rename,manipulate files and directories.
2)status information:- date,time,number of users,available memory etc.
3)file modification:-
4)programming language support:- compilers,assemblers,interpreters.
5)loaders,linkage editors.
6)help to browse web pages,send e-mails,send messages to other's screen,file transfer etc.

note:- most important system program for o.s is command interpreter.

q) in how many ways the commands can be implemented in o.s?
a) 2 ways:-
1)code for command is within the interpreter program.we can jump to that part , set parameters and make appropriate system call.
2)this is used by unix. command only tells name of file to be loaded and executed.parameter is passed to it.

note:- unix system consist of 2 parts:- kernel and system programs.

q) what is there in kernel?
a) kernel has device drivers, it provides file system,cpu scheduling,memory management and other functions through sytem calls.

Pages>> 1 2 3 4 5 6 7 8



Reblog this post [with Zemanta]
Pages>> 1 2 3 4 5 6 7 8
Here we are giving chapter wise notes of operating system based on operating system concepts by galvin

COMPUTER SYSTEM STRUCTURES

q) tell about generaL purpose computer system?
a) it consists of cpu and number of device cntollers connected through common bus, that provides access to memory.

q) what is job of memory contoller?
a) to ensure orderly access to shared memory,ie provides synchonization.

q) when computer is powered which is first program that runs?
a) bootstrap loader(present in ROM). it loads o.s into memory .

q) what operating system do then?
a) it then start executing the first process, such as "init" and waits for some event to take place.

note:- modern o.s are interuppt driven.interuppt by hardware is called interuppt only.software do this by executing a special operation called system call.

q) what is interrupt vector?
a) given only predefined number of interrupts, a table of pointers to interrupt routines can be used . it is placed in low memory. this table of pointers is called interrupt vector.it is indexed by unique device numbers.

q) name some o.s that use interrupt vector scheme to dispatch interrupts?
a) ms-dos and unix.

q) what do device contoller has generally?
a) buffer storage and set of special registers.

q) give an example of interrupt by i/o device?
a) suppose cpu asked device controller to perform read operation. after read operation is performed and data is in device controllers's buffer, it makes interrupt to the cpu.

q) what is device status table?
a) it is the way by which o.s keeps track of many i/o requests at same time. it keeps information like device type,address,state. if device is busy then a queue is formed for that device entry.

q) if a interrupt arrives and cpu is in middle of some instruction, then what happens?
a) interrupt is held pending till execution of instruction completes.after that address of instruction about to be executed is saved then interrupt is handled by transferring control to appropriate service routine.

q) when a terminal sends input to computer ,who sends interrupt to cpu?
a) the serial port to which terminal is connected.

q) what do interrupt service routine do , when a character input interrupt is there?
a) takes character from device to buffer. sets pointer and flag for other parts of operating system for processing the buffer.

note:- fast devices like disk,tape etc transmit information close to memory speed, then cpu does not get much time for execution.

q) what is solution to above problem?
a) dma(direct memory access) for high speed i/o devices.

q) tell something about dma?
a) here device controller sends dierctly the entire block of data to or from its own buffer storage to memory.

q) is in dma cpu is nowhere?
a) only 1 interrupt per block is generated . whereas low-speed devices generate 1 interrupt per byte.

q) what is role of device driver here?
a) it sets the dma contoller register to use appropriate source and destination addresses and transfer length.

q) what is cycle stealing?
a) since memory can transfer only 1 word at a time , dma steals memory cycles from cpu. this cycle stealing slows down the cpu execution.

q) how cpu access ram or main memory?
a) through load and store instructions.

q) what is memory -mapped i/o?
a) here ranges of memory addresses are set aside and are mapped to device registers.

q) what is programmed i/o?
a) when cpu constantly loops to see control bit, to see whether device is ready or not. this mode of operation is called programmed i/o.

q) to what is r/w head of disk attached?
a) to disk arm.

q) define transfer rate, positioning time?
a) 1) Tranfer rate:- rate at which data flows b/w drive and computer.

2) positioning time:- it consists of seek time ie time taken to move r/w head to desired cylinder and
rotaional latency ie time for derised sector to rotate to disk head.

q) what is head crash?
a) the head files over the disk surface, there is danger of its coming in contact with disk. sometimes head may damage the disk surface. this is called head crash.

q) give example of removable disk?
a) floppy disk. they have only 1 platter.

q) why floppy disks rotate slowly than the hard disks?
a) bcoz in them head sits directly on the surface.

q) how disk is attached to computer?
a) by i/o bus. different kinds of buses are "enhanced integrated drive electronics"(eide), advanced technology attachment
(ata).

q) tell little about data transfer b/w computer and disk?
a) transfer carried out by electronic processors called contollers. host controller(computer side of bus). disk controller on disk drive. disks have built in cache. transfer takes b/w cache and host controller.

q) tell hierarchy of storage meduim in decreasing order of speed and cost?
a) registers, cache, main memory (all these use semiconductor technology) ,electronic disk,magnetic disk,magnetic tape.

note:- left to electronic disk are volatile and to right are non volatile. it can be both.

note:- electronic disk have DRAM as well as hidden magnetin disk with battery backup.

note:- data transfer b/w cache and registers and cpu is a hardware function with no o.s intervention. o.s plays role in
disk to memory.

q) what is cache coherency?
a) multiprocessors with their own caches . so if same data in all caches. an update to data in 1 cache need to be updated in all. it is called cache coherency and is a hardware problem. it does not come into scene in case where only 1 process runs at a time.

note:-before o.s came complete control was in the hands of the programmer.

q) what was name given to early operating systems?
s) resident monitors.

q) what is mode bit?
a) it is a bit added to hardware of computer to tell whether it is user mode or monitor mode.

q) when system starts then it is in which mode?
a) monitor mode.

q) why we use dual mode?
a) it protects o.s from errant users and also users from one another. some machine instructions that may cause problem are called privileged instrucions can execute only in monitor mode.

q) what is system call?
a) when user request execution of priveleged instruction, such request is called system call. it is treated by hardware as software interrupt.

note:- ms-dos for intel8088 didn't had this facility.recent intel pentium provide dual mode.

q) what is given addittional with system call?
a) type of service needed as parameter.addittional info can be passed to registers,stack etc.

q) tell some previlege instructions?
a) all i/o instructions and instructions that modify operation of timer.

q) what main thing we need to protect in case of memory protection?
a) interrupt vector and interrupt service routines.

q) what in cpu protection?
a) user may get struck in loop, and not transferring control to operating system.

q) what is used to achieve this protection?
a) timer is used. counter decrements every 1 milliseconds(say) and when it reaches 0,interrupt occurs.

note:- timer also plays a important role in time sharing.

q) what is context switch?
a) after time slice of 1 process has finished, o.s add N to record that for how long process executed, saves its state and make changes for another process to get executed.
note:- some o.s use timer to compute current time. some have separate hardware for it, independent of o.s.


q) what for lan came?
a) to substitute mainframe computers.

q) main media in lan?
a) twisted pair cables and fibre optics.

q) media in wan?
a) telephone lines,microwave links,satellites.

note:- in wan special communication processors define interfaces through which sites communicate.

Pages>> 1 2 3 4 5 6 7 8

Reblog this post [with Zemanta]


Pages>> 1 2 3 4 5 6 7 8
Here we are giving chapter wise notes of operating system based on operating system concepts by galvin
Introduction


q) what is operating system?
a) manages the computer hardware..acts as intermediatery between user and hardware..provides environment for applications/ processes to work better.
---- resource allocator
---- control program

q) in how many parts a computer system can be divided?
a) four:-
1) hardware 2) o.s 3) application programs 4) users


q) early computer?
a) very large in size. were run only from console.user only used to give inputs manually.input devices were card readers and tape drives.output devices were line printers, tape drives and punch cards. batch programming was done. o.s of these batched system had only 1 task to do: transfer control automatically from 1 job to another.

q) What is job pool?
a) it is collection of jobs on disk,ready to come to main memory.

note:- job scheduling and cpu scheduling are different

q) when do o.s first thought for users means processes?
a) when concept of mutiprogramming came.

q) what is time sharing or multitasking systems?
a) here cpu executes multiple jobs by switching between them, and that also so fast that users interact with program when it is running.

q) how do we achieve time sharing concept?
a) using cpu scheduling and multiprogramming.

q) give example of desktop systems?
a) pc's running under windows and apple machintosh.

q) what is multiprocessor system?
a) also called parallel system and tightly coupled system.more than 1 processor in close communication with same clock,and bus or may be memory and i/o devices.

q) what is meant by graceful degradation?
a) suppose we have 10 processors. 1 fails then other 9 can share work of failed 1.thus system runs only 10% slower than totally failing.this ability to continue providing service propotional to level of surviving hardware is called graceful degradation. systems are called fault tolerant.

q) what is tandem system?
a) uses duplication of hardware and software both. 2 identical processors with own memory and connected by bus. 1 act as primary and other as backup.checkpoints are used to give information to backup processor.

q) explain smp?
a) symmetric multiprocessing. here each processor runs copy of o.s and communicate with each other as required.

q) define asmp?
a) asymmteric (here we have master slave relationship b/w processors)

q) give an example of smp?
a) Encore's verion of unix.

q) what issues in multiprocessing?
a) * i/o (data must reach appropriate processor)
* 1 is idle and other is overloaded.

q) what is distibuted system?
a) take use of networking. processors at different places and use different clocks and donot share memory also.

q) name protocols supported by windows and unix?
a) tcp/ip.

q) types of server systems?
a) 1) compute servers 2) File servers

q) what is distributed lock manager service?
a) clusters donot allow shared access to data on disk. for this distributed file system provide access control and locking to files to avoid conflicts.

q) what are real time systems?
a) here rigid time requirement is placed on the operation of processor or data flow. processing must be done in defined time constraint.

q) give area of application of real time systems?
a) medical imaging,scientific experiments,weapon systems,home appliance controller etc.

q) types of real time systems?
a) hard and soft.

q) features of hard?
a) * critical tasks done. * limited or no secondary memory , only ROM. *no virtual memory * no time sharing concept. * o.s is very simple

q) what are handheld systems?
a) include pda ie personal digital assistants. eg cellular phones.

q) limitations of handheld systems?
a) small memory, small display and slow processor due to small battery.

q) under what category do pc's come?
a) microcomputers.

note: clusters share a storage.




Exercise:-


q1) three main purpose of o.s?
a) 1) resouce allocator 2) control program 3) manage hardware 4) file system

q2)difference b/w operating system for mainframes and pc's?
a) pc's os were mainly concerned with convenience and responsiveness rather than cpu and device utilization.they lacked multiuser and multitasking.file protection ,new feature of operating system.

q) what are security problem related to multiprogramminG and multitasking environment?
a) more than 1 program in memory , so need mamory management and protection.need to take care of cpu scheduling,job synchronisation, and also take care of deadlock prevention.

q) some properties:-
a) type of operating system features

1) batch very big, run from console,input on tapes,card readers,o.s only used to transfer control from 1 job to next.

2)interactive direct communication b/w user and o.s or program.

3)time sharing executes multiple jobs by switching b/w them,user can interact with jobs.uses cpu scheduling and multiprogramming.virtual memory came.
disk management(as file system), take care of job synchronization and communication, memory management.

4)real time rigid time requirements are placed on the processor or flow of data.can be hard or soft.

5)parallel more than 1 processor with same clock and share same memory.concept of graceful degradation. can be smp or asmp

6)Distributed depend on network.mutiple processors but at distant places. they donot share same memory and clock.

7)clustered 2 or more individual systems coupled together.linked through lan and share storage. can be asymmetric or symmetric clustering.also we have
parallel clusteing. they have facility called dlm(distributed lock manager).

8)handheld small memory, slow processor,not having virtual memory concept,

note:- o.s waste resources in case of PC's where user convenience and responsiveness is major aim to achieve.

q) what is being used in multiprocessing along with main CPU?
a) microprocessors with its own memory.

Pages>> 1 2 3 4 5 6 7 8

Reblog this post [with Zemanta]

Free, official test preparation materials for the computer- and paper-based GRE® tests are available to anyone who registers for the GRE tests worldwide.
Very Helpful and full paper for practice for GRE.






Download Now>>

Reblog this post [with Zemanta]

Hi friends this is the stuff for Object oriented programming concepts and the OOAD concepts based on previous year papers and the various faq's. Hope this will help in your placements...

OOPS

1. Name some pure object oriented languages.
Ø Smalltalk,
Ø Java,
Ø Eiffel,
Ø Sather.
2. What do you mean by the words ‗Abstraction‘, ‗Separation‘, ‘Composition‘, and ‗Generalization‘?
Abstraction:
Simplifying the description of a real world entity to its essentials.
Separation:
Treating what an entity does and how it does it independently of each other.
Composition:
Building complex whole components by assembling simpler parts in one of the two ways, Association and aggregation.
Generalization:
Identifying common elements in an entity.
3. What is information hiding?
Information hiding is a mechanism that separates the implementation of the class from its user.
4. Differentiate between the message and method.
Message Method
Objects communicate by sending messages Provides response to a message.
to each other.
A message is sent to invoke a method. It is an implementation of an
operation.
5. What is the interface of a class?
The interface of the class is the view provided to the outside world, which hides its internal structure and behaviour.
6. What is an adaptor class or Wrapper class?
A class that has no functionality of its own. Its member functions hide the use of a third party software component or an object with the non-compatible interface or a non- object- oriented implementation.
7. What is a node class?
A node class is a class that,
Ø relies on the base class for services and implementation,
Ø provides a wider interface to te users than its base class,
Ø relies primarily on virtual functions in its public interface
Ø depends on all its direct and indirect base class
Ø can be understood only in the context of the base class
Ø can be used as base for further derivation
Ø can be used to create objects.
A node class is a class that has added new services or functionality beyond the services inherited from its base class.
8. What is an orthogonal base class?
If two base classes have no overlapping methods or data they are said to be independent of, or orthogonal to each other. Orthogonal in the sense means that two classes operate in different dimensions and do not interfere with each other in any way. The same derived class may inherit such classes with no difficulty.
9. What is a container class? What are the types of container classes?
A container class is a class that is used to hold objects in memory or external storage. A container class acts as a generic holder. A container class has a predefined behavior and a well-known interface. A container class is a supporting class whose purpose is to hide the topology used for maintaining the list of objects in memory. When a container class contains a group of mixed objects, the container is called a heterogeneous container; when the container is holding a group of objects that are all the same, the container is called a homogeneous container.
10. What is a protocol class?
An abstract class is a protocol class if:
Ø it neither contains nor inherits from classes that contain member data, non-virtual functions, or private (or protected) members of any kind.
Ø it has a non-inline virtual destructor defined with an empty implementation,
Ø all member functions other than the destructor including inherited functions, are declared pure virtual functions and left undefined.
11. What is a mixin class?
A class that provides some but not all of the implementation for a virtual base class is often called mixin. Derivation done just for the purpose of redefining the virtual functions in the base classes is often called mixin inheritance. Mixin classes typically don't share common bases.
12. What is a concrete class?
A concrete class is used to define a useful object that can be instantiated as an automatic variable on the program stack. The implementation of a concrete class is defined. The concrete class is not intended to be a base class and no attempt to minimize dependency on other classes in the implementation or behavior of the class.
13. What is the handle class?
A handle is a class that maintains a pointer to an object that is programmatically accessible through the public interface of the handle class.
In case of abstract classes, unless one manipulates the objects of these classes through pointers and references, the benefits of the virtual functions are lost. User code may become dependent on details of implementation classes because an abstract type cannot be allocated statistically or on the stack without its size being known. Using pointers or references implies that the burden of memory management falls on the user. Another limitation of abstract class object is of fixed size. Classes however are used to represent concepts that require varying amounts of storage to implement them.
A popular technique for dealing with these issues is to separate what is used as a single object in two parts: a handle providing the user interface and a representation holding all or most of the object's state. The connection between the handle and the representation is typically a pointer in the handle. Often, handles have a bit more data than the simple representation pointer, but not much more. Hence the layout of the handle is typically stable, even when the representation changes and also that handles are small enough to move around relatively freely so that the user needn‘t use the pointers and the references.
14. What is an action class?
The simplest and most obvious way to specify an action in C++ is to write a function. However, if the action has to be delayed, has to be transmitted 'elsewhere' before being performed, requires its own data, has to be combined with other actions, etc then it often becomes attractive to provide the action in the form of a class that can execute the desired action and provide other services as well. Manipulators used with iostreams is an obvious example.
A common form of action class is a simple class containing just one virtual function.
class Action{
public:
virtual int do_it( int )=0;
virtual ~Action( );
}
Given this, we can write code say a member that can store actions for later execution without using pointers to functions, without knowing anything about the objects involved, and without even knowing the name of the operation it invokes. For example:
class write_file : public Action{
File& f;
public:
int do_it(int){
return fwrite( ).suceed( );
}
};
class error_message: public Action{
response_box db(message.cstr( ),"Continue","Cancel","Retry");
switch (db.getresponse( )) {
case 0: return 0;
case 1: abort();
case 2: current_operation.redo( );return 1;
}
};
A user of the Action class will be completely isolated from any knowledge of derived classes such as write_file and error_message.
15. What are seed classes?
In C++, you design classes to fulfill certain goals. Usually you start with a sketchy idea of class requirements, filling in more and more details as the project matures. Often you wind up with two classes that have certain similarities. To avoid duplicating code in these classes, you should split up the classes at this point, relegating the common features to a parent and making separate derived classes for the different parts. Classes that are made only for the purpose of sharing code in derived classes are called seed classes.
16. What is an accessor?
An accessor is a class operation that does not modify the state of an object. The accessor functions need to be declared as const operations
17. What is an inspector?
Messages that return the value of an attribute are called inspector.
18. What is a modifier?
A modifier, also called a modifying function is a member function that changes the value of at least one data member. In other words, an operation that modifies the state of an object. Modifiers are also known as ‗mutators‘.
19. What is a predicate?
A predicate is a function that returns a bool value.
20. What is a facilitator?
A facilitator causes an object to perform some action or service.
21. State the "Rule of minimality" and its corollary?
The rule of minimality states that unless a behavior is needed, it shouldn't be part of the ADT.
Corollary of the rule of minimality: If the function or operator can be defined such that, it is not a member. This practice makes a non-member function or operator generally independent of changes to the class's implementation.
22. What is reflexive association?
The 'is-a' is called a reflexive association because the reflexive association permits classes to bear the is-a association not only with their super-classes but also with themselves. It differs from a 'specializes-from' as 'specializes-from' is usually used to describe the association between a super-class and a sub-class. For example:
Printer is-a printer.
23. What is slicing?
Slicing means that the data added by a subclass are discarded when an object of the subclass is passed or returned by value or from a function expecting a base class object.
Consider the following class declaration:
class base{
...
base& operator =(const base&);
base (const base&);
}
void fun( ){
base e=m;
e=m;
}
As base copy functions don't know anything about the derived only the base part of the derived is copied. This is commonly referred to as slicing. One reason to pass objects of classes in a hierarchy is to avoid slicing. Other reasons are to preserve polymorphic behavior and to gain efficiency.
24. What is a Null object?
It is an object of some class whose purpose is to indicate that a real object of that class does not exist. One common use for a null object is a return value from a member function that is supposed to return an object with some specified properties but cannot find such an object.
25. Define precondition and post-condition to a member function.
Precondition:
A precondition is a condition that must be true on entry to a member function. A class is used correctly if preconditions are never false. An operation is not responsible for doing anything sensible if its precondition fails to hold.
For example, the interface invariants of stack class say nothing about pushing yet another element on a stack that is already full. We say that isful() is a precondition of the push operation.
Post-condition:
A post-condition is a condition that must be true on exit from a member function if the precondition was valid on entry to that function. A class is implemented correctly if post-conditions are never false.
For example, after pushing an element on the stack, we know that isempty() must necessarily hold. This is a post-condition of the push operation.
26. What is class invariant?
A class invariant is a condition that defines all valid states for an object. It is a logical condition to ensure the correct working of a class. Class invariants must hold when an object is created, and they must be preserved under all operations of the class. In particular all class invariants are both preconditions and post-conditions for all operations or member functions of the class.
27. What are the conditions that have to be met for a condition to be an invariant of the class?
Ø The condition should hold at the end of every constructor.
Ø The condition should hold at the end of every mutator(non-const) operation.
28. What are proxy objects?
Objects that points to other objects are called proxy objects or surrogates. Its an object that provides the same interface as its server object but does not have any functionality. During a method invocation, it routes data to the true server object and sends back the return value to the object. template class Array2D{
public:
class Array1D{
public:
T& operator[] (int index);
const T& operator[] (int index) const;
...
};
Array1D operator[] (int index);
const Array1D operator[] (int index) const;
...
};
The following then becomes legal:
Array2Ddata(10,20);
........
cout<B, B=>c then A=>c.
A. Salesman, B. Employee, C. Person.
Note:
All the other relationships satisfy all the properties like Structural properties, Interface properties, Behaviour properties.
12. Differentiate Aggregation and containment?
Aggregation is the relationship between the whole and a part. We can add/subtract some properties in the part (slave) side. It won't affect the whole part.
Best example is Car, which contains the wheels and some extra parts. Even though the parts are not there we can call it as car.
But, in the case of containment the whole part is affected when the part within that got affected. The human body is an apt example for this relationship. When the whole body dies the parts (heart etc) are died.
13. Can link and Association applied interchangeably?
No, You cannot apply the link and Association interchangeably. Since link is used represent the relationship between the two objects.
But Association is used represent the relationship between the two classes.
14. List out some of the object-oriented methodologies.
Ø Object Oriented Development (OOD) (Booch 1991,1994).
Ø Object Oriented Analysis and Design (OOA/D) (Coad and Yourdon 1991).
Ø Object Modelling Techniques (OMT) (Rumbaugh 1991).
Ø Object Oriented Software Engineering (Objectory) (Jacobson 1992).
Ø Object Oriented Analysis (OO (Shlaer and Mellor 1992).
Ø The Fusion Method (Coleman 1991).
15. What is meant by "method-wars"?
Before 1994 there were different methodologies like Rumbaugh, Booch, Jacobson, Meyer etc who followed their own notations to model the systems. The developers were in a dilemma to choose the method which best accomplishes their needs. This particular time-span was called as "method-wars".
16. Whether unified method and unified modeling language are same or different?
Unified method is convergence of the Rumbaugh and Booch. Unified modeling lang. is the fusion of Rumbaugh, Booch and Jacobson as well as Betrand Meyer (whose contribution is "sequence diagram"). Its' the superset of all the methodologies.
17. Who were the three famous amigos and what was their contribution to the object community?
The Three amigos namely,
Ø James Rumbaugh (OMT): A veteran in analysis who came up with an idea about the objects and their Relationships (in particular Associations).
Ø Grady Booch: A veteran in design who came up with an idea about partitioning of systems into subsystems.
Ø Ivar Jacobson (Objectory): The father of USECASES, who described about the user and system interaction.
17. Differentiate the class representation of Booch,Rumbaugh and UML?
If you look at the class representaiton of Rumbaugh and UML, It is some what similar and both are very easy to draw.
Representation:
OMT
ClassName
+Public Attribute;#protected Attribute;-private Attribute;
+Public Method();#Protected Method();-private Method();
UML.
ClassName<>
+Public Attribute;#protected Attribute;-private Attribute;classattribute;
+Public Method();#Protected Method();-private Method();classmethod();
Booch:
In this method classes are represented as "Clouds" which are not very easy to draw as for as the developer's view is concern.
Representation:
18. What is an USECASE?why it is needed?
A Use Case is a description of a set of sequence of actions that a system
performs that yields an observable rsult of value to a particular action.
Simply, in SSAD process <=> In OOAD USECASE. It is represented elliptically.
Representation:
19. Who is an Actor?
An Actor is someone or something that must interact with the system.In addition to that an Actor initiates the process (that is USECASE).
It is represesnted as a stickman like this.
Representation:
20. What is guard condition?
Guard condition is one which acts as a firewall. The access from a particular object can be made only when the particular condition is met.
For Example,
here the object on the customer acccess the ATM facility only when the guard condition is met.
21. Differentiate the following notations?
I:
II:
In the above I represention Student Class sends message to Course Class
but in the case of second , the data is transfered from student Class to Course Class
22. USECASE is an implementaion independent notation. How will the designer give the implementaion details of a particular USECASE to the programmer?
This can be accompllished by specifying the relationship called "refinement" that talkes about the two different abstraction of the same thing.
For example,
In the above example calculate Pay is an USECASE. It is refined in terms of giving the implementation details. This kind of connection is related by means of ―refinement‖.
23. Suppose a class acts an Actor in the problem domain,how can i represent it in the
static model?
In this senario you can use ―stereotype‖.since stereotype is just a string that gives extra semantic to the particular entity/model element.
It is given with in the << >>.
Class<< Actor>>
Attributes
MemberFunctions
24. Why does the function arguments are called as "signatures"?
The arguments distinguishes functions with the same name (functional polymorphism). The name alone does not necessarily identify a unique function. However, the name and its arguments (signatures) will uniquely identify a function.
In real life we see suppose,in class there are two guys with same name.but they can be easily identified by their signatures.The same concept is applied here.
For example:
class person
{
public:
char getsex();
void setsex(char);
void setsex(int);
};
In this example we can see that there is a function setsex() with same name but with different signature.


Reblog this post [with Zemanta]
cudgp4kq9a

Hi guys this is the placement paper pattern of Amazon given on 19 th june 2008

1. Given a Binary Search Tree, write a program to print the kth smallest element without using any static/global variable. You can?t pass the value k to any function also.

2. What are the 4 basics of OOP?

3. Define Data Abstraction. What is its importance?

4. Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 2 numbers. Find the missing numbers.

5. Given an array of size n. It contains numbers in the range 1 to n. Find the numbers which aren?t present.

6. Given a string,find the first un-repeated character in it? Give some test cases

7. You are given a dictionary of all valid words. You have the following 3 operations permitted on a word: delete a character, insert a character, replace a character. Now given two words - word1 and word2 - find the minimum number of steps required to convert word1 to word2. (one operation counts as 1 step.)

8. Given a cube of size n*n*n (i.e made up of n^3 smaller cubes), find the number of smaller cubes on the surface. Extend this to k-dimension.

9. What is a C array and illustrate the how is it different from a list.

10. What is the time and space complexities of merge sort and when is it preferred over quick sort?

11. Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.

12. Given n red balls and m blue balls and some containers, how would you distribute those balls among the containers such that the probability of picking a red ball is maximized, assuming that the user randomly chooses a container and then randomly picks a ball from that.

13. Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.

14. Given an array of size n, containing every element from 1 to n+1, except one. Find the missing element.

15. How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same

16. Explain polymorphism. Provide an example.

17. Given an array all of whose elements are positive numbers, find the maximum sum of a subsequence with the constraint that no 2 numbers in the sequence should be adjacent in the array. So 3 2 7 10 should return 13 (sum of 3 and 10) or 3 2 5 10 7 should return 15 (sum of 3, 5 and 7)

18. You are given some denominations of coins in an array (int denom[])and infinite supply of all of them. Given an amount (int amount), find the minimum number of coins required to get the exact amount. What is the method called?

19. Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 1 number. Find the missing number



Reblog this post [with Zemanta]

Hi guys this is the placement paper pattern of Amazon given on 27th august in hyderabad ....

Written Test has 2 Sections A, B In Section A there were 20 Questions:

Time :30 min
Small Answer Type
Multiple choice
Aptitude

1.Two tables emp (empid,name,deptid,sal) and dept(deptid,deptname) are there.write a query which displays empname,corresponding deptname also display those employee names who donot belong to any dept.
2.Display the employees whose salary is less than average salary.
3.what is the output of the program
main()int c=5;
printf("%d\n%d\n%d",c,c<<2,c>> 2);
}

4. main()
{
int a[8][10],c=0,i,j;
for(i=0;i<10;
i++) for(j=0;
j<8;j++) a[j][i]=c++;
printf("%d",a[3][6]);
}
5.What is the wrong in this program
main()
{
char *p,*q;
p=(char *)malloc(25);
q=(char*) malloc(25);
strcpy(p,"amazon" );
strcpy(q,"hyd");
strcat(p,q);
printf("%s",p);
}
6.write prefix and post fix notation for (a+b)*c-(d+e)^(f-g)
7.what is the output of the program
main()
{
int i=5;
printf("%d",fun(fun(fun(fun( fun(i))))));
}
void fun (int i)
{ if(i%2) return (i+(7*4)-(5/2)+(2*2));
else return (i+(17/5)-(34/15)+(5/2));
}
8.When it is always true boolean fun
(node *p)
{
return ((p==null)||(p->next==null)|| (p->info<=p->next->info)&&( fun(p->next)));
}
a) when list is empty or has one node
b) when the ele are sorted in non decreasing order
c) when the ele are sorted in non increasing order
9.what is x here (x&&!(x&(x-1))==1)
a) x is always a prime
b) x is a power of 2
c) x is even d)x is odd
10 .What is the difference between deep copy and shallow copy
11.In java what is the difference between sleep() and wait()12.What happens when the parent process of a child process exits before the child ?
13.There are three persons A,B,C .A shots the target 6 times out of 7 shots .B shots 4 out of 5 shots .Then what is the probability of hitting the target twice when 2 persons are selected at random.
14.what is valid in cpp char *cp; const char *cpp; 1) cpp=cp; 2) cp=cpp;
15.write program to swap 2 variables without using extra memory.
16.write a shell command to find all java files present in nested directories.
17.There are 6 pairs of black socks and 6 pairs of white socks.What is the probability to pick a pair of black or white socks when 2 socks are selected randomly in darkness.
18.A string of alphanumeric is there.Find a string that starts with b and ends with 3 characters. section B (we have to write programs) time:30 min
1.There is a sorted array which is of very large size.In that all except one no. are repeated once.How to find that non repeated no.
2.There are 2 linked lists.Those 2 lists are meeting at a point.How to find that meeting point.



Reblog this post [with Zemanta]

The paper was prepared by INSTITUTE OF BANKING PERSONNEL SELECTIONS-MUMBAI.

Aptitude Written Test (Total time: 90 Min, 150 questions)

Section-1 English Language Ability (50 questions)

Section-2 Quantitative Aptitude (50 questions)

Section-3 Logical Reasoning (50 questions)

All 150 questions are given in the beginning, and you can attempt any section at any time. There is individual cut-off in each section. Negative marking 0.25 marks for each wrong answer.

Section- 1:

Q1-15: Comprehension, Antonyms, Synonyms There is a big paragraph (one full page) about regularization of banking acts, etc.

Q1-9 are based on the content of the paragraph.

Q10-12 are Antonyms for some words appeared in the paragraph.

Q13-15 are Synonyms for some words appeared in the paragraph.

Q16-20 (Incomplete Paragraph about Development and Education in Punjab and U.P. was given) In these questions, we need to insert the appropriate word from the options given.

Q21-25: (Ordering sentences in a paragraph) There are 5 Sentences given. They have asked for the correct sequence of those sentences. For example the asked question is which sentence is 2nd? 3rd? etc.

Q26-35: (Sentence improvement) There are 10 sentences. A part of the sentence is in bold part. From the options, we need to improve the meaning of the sentence.

Q36-45: (Identifying error in the sentence) Each Sentence was broken in to 5 parts. We need to find out which portion is having error. Sorry I forgot the other 5 questions.

Except the questions 1-9, I answered all confidently.

Conclusion: Practice Comprehension more, because reading the paragraph itself will take10-15 min. Then answering questions is too difficult.

So, go for other questions which are relatively simple and you feel comfortable.

Section- 2:

Quantitative Aptitude: ( R.S.Agrawal level, but time is very crucial) I am giving you, the topics covered.

1.Compound interest (1q)

2.Simplification (10q)

3.Data Interpretation(15q)

There are 3 Tables and each table comprises of 5 questions.

4.Series Completion (5q)

5.Squre root (1q)

6. Trains (1q)

7.Probability (5q)

Actually I overlooked the other 7 questions, because I have answered only 25 in 30 min. Then I moved to other section. There is no time to see any question 2nd time. So, do it right first confidently. Some questions are (none of these) options type. So doing confidently first time is important.

Do not check your calculation if u get none as your answer. Because they will test confidence by putting none option.

Conclusion: Do all questions in R.S.Agrawal atleast once to get confidence. Emphasize more on DI, Probability. Questions are simple but managing time is imp.

Section- 3:

Logical Reasoning :

Two puzzles on seating arrangement of students- 10q. These puzzles are simple.

example: There are 10 students, five will sit in Row A, and others in Row B. K will sit in between D and E. M is not interested to sit at the end in a row……. like that conditions will be given, Accordingly we can arrange.

Statements and Conclusions- 5q.

There are 4 statements, All cats are dogs, some dogs are squirrels. No Squirrel is Dove. Some doves are cats. etc . Then 3 conclusions were given. and we need to identify which are following. This question is not correct. DO not try to solve it. Just to have an idea I have mentioned.

Blood relations (5q)

The model is like this: A+B means A is brother of B

A-B means A is mother of
AxB means A is father of B

A/B means A is sister of B

Then what will be p+q-r? etc. Please refer R.S.Agrawal Blood Relations Type 3 Coded Relations. (P.NO.237)

Coding & Decoding (7q)

For the numbers 0-9, They have given some letters as their codes. And if a word starts with vowel then code should start with $ symbol, if a word ends with vowel then code should end with # symbol. etc . Now 5 words were given we need to find out their codes.

Odd man out (1q)

A.27 B.64 C.125 D.512 E.216.

ans b

64 is cube as well as square but the others are only cubes.

Data sufficiency (5q):

Three statements were given and one question was given. To answer this question, we need to find out which data is required from the above 3 statements?

Like this total 5 q were given

New model questions (7q)

Five three digits numbers were given. 1 is added to the first digit of all numbers and 1 is subtracted from the middle digit.

Then QUESTIONS are which is lowest, highest? ect.

Example: 546, 687, 456, 274, 487

After modifying according to the given conditions, 636, 777, 546, 364, 577. Now you can arrange these numbers either ascending or descending order to answer the questions.


Reblog this post [with Zemanta]