You are on page 1of 14

http://placementpapers.

net/helpingroot/microsoft/Microsoft-Placement-Paper-

Computer-Architecture-1

1. What is pipelining?

2. What are the five stages in a DLX pipeline?

3. For a pipeline with 'n' stages, what�s the ideal throughput? What prevents us

from achieving this ideal throughput?

4. What are the different hazards? How do you avoid them?

5. Instead of just 5-8 pipe stages why not have, say, a pipeline with 50 pipe stages?

6. What are Branch Prediction and Branch Target Buffers?

7. How do you handle precise exceptions or interrupts?

8. What is a cache?

9. What's the difference between Write-Through and Write-Back Caches? Explain

advantages and disadvantages of each.

10. Cache Size is 64KB, Block size is 32B and the cache is Two-Way Set Associative.

For a 32-bit physical address, give the division between Block Offset, Index and

Tag.

11. What is Virtual Memory?

12. What is Cache Coherency?

13. What is MESI?

14. What is a Snooping cache?

1
15. What are the components in a Microprocessor?

16. What is ACBF(Hex) divided by 16?

17. Convert 65(Hex) to Binary

18. Convert a number to its two's compliment and back

19. The CPU is busy but you want to stop and do some other task. How do you do

it?

Computer Architecture
1. Explain what is DMA?

2. What is pipelining?

3. What are superscalar machines and vliw machines?

4. What is cache?

5. What is cache coherency and how is it eliminated?

6. What is write back and write through caches?

7. What are different pipelining hazards and how are they eliminated.

8. What are different stages of a pipe?

9. Explain more about branch prediction in controlling the control hazards

10. Give examples of data hazards with pseudo codes.

11. How do you calculate the number of sets given its way and size in a cache?

12. How is a block found in a cache?

13. Scoreboard analysis.

14. What is miss penalty and give your own ideas to eliminate it.

15. How do you improve the cache performance.

16. Different addressing modes.

17. Computer arithmetic with two's complements.

18. About hardware and software interrupts.

19. What is bus contention and how do you eliminate it.

2
20. What is aliasing?

21) What is the difference between a latch and a flip flop?

22) What is the race around condition? How can it be overcome?

23) What is the purpose of cache? How is it used?

24) What are the types of memory management?

1.) What is Virtual Memory?

This Memory is used extending the capability of physical memory. This memory is simulated by

the hard drive.When all the RAM is being used the computer will swap data to the hard drive

and back to give the impression that there is more memory

2.) What are the five stages in a DLX pipeline?

Instruction Fetch Stage Instruction Decode Stage Instruction Execution Stage Memory Stage

Write Back

3.) What is MESI?

MESI is a Cache Coherency protocol used in multi-processor systems to indicate the state in

which the data in the cache of a particular processor is. It stands of Modified, Exclusive, Shared

and Invalid

4.) What is cache memory?

Cache memory is random access memory (RAM) that a computer microprocessor can access

more quickly than it can access regular RAM. As the microprocessor processes data, it looks

first in the cache memory and if it finds the data there (from a previous reading of data), it

does not have to do the more time-consuming reading of data from larger memory.(cache

memory is used between the c.p.u and the ram to access dta fastly)

5.) What is hard disk and what is its purpose?

3
Hard disk is the secondary storage device, which holds the data in bulk, and it holds the data

on the magnetic medium of the disk.Hard disks have a hard platter that holds the magnetic

medium, the magnetic medium can be easily erased and rewritten, and a typical desktop

machine will have a hard disk with a capacity of between 10 and 40 gigabytes. Data is stored

onto the disk in the form of files.

6.) What?s the speed and device maximum specs for Firewire?

EEE 1394 (Firewire) supports the maximum of 63 connected devices with speeds up to 400

Mbps.

7.) What?s the difference between L1 and L2 cache?

Level 1 cache is internal to the chip, L2 is external. L1 Cache is of Higher speed than that of L2

Cache.

8.) What is the difference between primary & secondary storage device?

In primary storage device the storage capacity is limited. It has a volatile memory. In

secondary storage device the storage capacity is larger. It is a nonvolatile memory. Primary

devices are: RAM / ROM. Secondary devices are: Floppy disc / Hard disk.

1. What is DBMS?

It is a collection of programs that enables user to create & maintain a database.

In other words it is general-purpose software that provides the users with the processes of
defining, constructing & manipulating the database for various applications.

2. What is Database?

4
A database is a logically coherent collection of data with some inherent meaning, representing
some aspect of real world & which is designed, built & populated with data for a specific
purpose.

3. What is a Database system?

The database & DBMS software together is called as Database system.

4. Advantages of DBMS? Redundancy is controlled. Unauthorised access is restricted.


Providing multiple user interfaces. Enforcing integrity constraints. Providing backup &
recovery.

5. Disadvantage in File Processing System? Data redundancy & inconsistency. Difficult in


accessing data. Data isolation. Data integrity. Concurrent access is not possible. Security
Problems.

6. Describe the three levels of data abstraction?

The are three levels of abstraction: Physical level: The lowest level of abstraction describes
how data are stored. Logical level: The next higher level of abstraction, describes what data
are stored in database & what relationship among those data. View level: The highest level of
abstraction describes only part of entire database.

7. Define the "integrity rules"

There are two Integrity rules. Entity Integrity: States that "Primary key cannot have NULL
value" Referential Integrity: States that "Foreign Key can be either a NULL value

5
Or should be Primary Key value of other relation.

8. What is extension & intension in DBMS?

Extension -

It is the number of tuples present in a table at any instance. This is time

dependent.

Intension -

It is a constant value that gives the name, structure of table & the constraints laid on it.

9. What is System R? What are its two major subsystems?

System R was designed & developed over a period of 1974-79 at IBM San Jose Research Center.
It is a prototype & its purpose was to demonstrate that it is possible to build a Relational
System that can be used in a real life environment to solve real life problems, with
performance at least comparable to that of existing system.

Its two subsystems are Research Storage System Relational Data System.

10. How is the data structure of System R different from the relational DBMS structure?

Unlike Relational systems in System R Domains are not supported Enforcement of candidate key
uniqueness is optional Enforcement of entity integrity is optional Referential integrity is not
enforced

1. Explain about your current project.?


2. While using Apache Tomcat4.1 where can place all the jsp files.

6
3. What is a jsp?.
4. what is a servlet?
5. Which type of connection using in JDBC?. (Whether it is Pooled connection
like..)
6. what r the implicit objects in jsp?.
7. what r the directives in jsp.?
8. what r the actions in jsp.?
9. what is diff b/w forward and redirect()?.
10. what r the steps involved in JDBC connection.?
11. How u can configure Tomcat server?
12. what is method overloading?
13. what is method overriding?
14. what r the oops concepts in java?
15. what is polymorphism?
16. what is an abstract class?
17. what is the diff b/w an abstract class and an interface?
18. how can call jsp from servlets?
19. how can call servlets from jsp?
20. how can handle errors in jsp?
21. what r the sessions?
22. what is the diff b/w String and String Buffer class?
23. what is the adv of jsp over servlets?
24. what is the diff b/w Apache Tomcat4.1 and other versions?

1) What is diffrence between StateFul and Stateless Session Bean?

A Stateful Session Bean is a bean that is designed to service business processes that span
multiple method requests or transactions. Stateful Session beans retain state on behalf of
an individual client. Stateless Session Beans do not maintain state.

EJB containers pools stateless session beans and reuses them to service many clients.
Stateful session beans can be passivated and reused for other clients. But this involves
I/O bottlenecks. Because a stateful session bean caches client conversation in memory, a
bean failure may result in loosing the entire client conversation. Therefore, while writing
a stateful session bean the bean developer has to keep the bean failure and client
conversation loss in mind.

In case of stateless session beans, client specific data has to be pushed to the bean for
each method invocation which will result in increase in the network traffic. This can be
avoided in a number of ways like persisting the client specific data in database or in
JNDI. But this also results in I/O performance bottlenecks.

If the business process spans multiple invocations thereby requiring a conversation then
stateful session bean will be the ideal choice. On the other hand, if business process lasts
only for a single method call, stateless session bean model suits.

7
Stateful session beans remembers the previous request and responses. But stateless beans
do not. stateful does not have pooling concept, whereas the stateless bean instances are
pooled

2) What is difference between BeanMangedPersistance and


ContainerMangedPersistance?

CMP: Tx behaviour in beans are defined in transaction attributes of the methods


BMP: Programmers has to write a code that implements Tx behaviour to the bean class.

Tuned CMP entity beans offer better performance than BMP entity beans.
Moving towards the CMP based approach provides database independence since it does
not contain any database storage APIs within it. Since the container performs database
operations on behalf of the CMP entity bean, they are harder to debug. BMP beans offers
more control and flexibility that CMP beans.

Diff 1) In BMP you will take care of all the connection and you write the SQL code
inside the bean whereas in CMP the container will take care of it
Diff 2) The BMP is not portable across all DB s.whereas the CMP is

(3)Draw and explain MVC architecture?

MVC Architecture is Module ViewController Architecture. Controller is the one which


controls the flow of application / services the requests from the View. Module is the
other layer which performs the exact operations. Each layer should be loosely coupled as
much as possible.

(4)Difference between forward(request,response) and SendRedirect(url) in Servlet?

With Forward, request & response would be passed to the destination URL which should
be relative (means that the destination URL shud be within a servlet context). Also, after
executing forward method, the control will return back to the same method from where
the forward method was called. All the opposite to the above points apply to
sendRedirect. (OR)The forward will redirect in the application server itself. It does not
come to the client. wherea Response.sendredirect() will come to the client and
go back ...ie. URL appending will happen.

(5)What is Synchornize?

Synchronize is a technique by which a particular block is made accessible only by a


single instance at any time. (OR) When two or more objects try to access a resource, the
method of letting in one object to access a resource is called sync

8
(6)How to prevent Dead Lock?
Using synchronization mechanism. For Deadlock avoidance use Simplest algorithm
where each process tells max number of resources it will ever need. As process runs, it
requests resources but never exceeds max number of resources. System schedules
processes and allocates resoures in a way that ensures that no deadlock results.

7)Explain different way of using thread? :


The thread could be implemented by using runnable interface or by inheriting from the
Thread class. The former is more advantageous, cause when you are going for multiple
inheritance..the only interface can help

(8)what are pass by reference and passby value?


Pass By Reference means the passing the address itself rather than passing the value.
Passby Value means passing a copy of the value to be passed.

(9)How Servlet Maintain Session and EJB Maintain Session?


Servlets maintain session in ServleContext and EJB s in EJBContext.

(10)Explain DOM and SAX Parser?

DOM parser is one which makes the entire XML passed as a tree Structure and will have
it in memory. Any modification can be done to the XML.

SAX parser is one which triggers predefined events when the parser encounters the tags
in XML. Eventdriven parser. Entire XML will not be stored in memory. Bit faster than
DOM. NO modifications can be done to the XML.

(11)What is HashMap and Map?

Map is Interface and Hashmap is class that implements that and its not serialized
HashMap is non serialized and Hashtable is serialized

(12)Difference between HashMap and HashTable?

The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized


and permits nulls. (HashMap allows null values as key and value whereas Hashtable
doesnt allow). HashMap does not guarantee that the order of the map will remain
constant over time.

9
(12a) Difference between Vector and ArrayList?
Vector is serialized whereas arraylist is not

(13)Difference between Swing and Awt?

AWT are heavyweight componenets. Swings are lightweight components. Hence


swing works faster than AWT.

14) Explain types of Enterprise Beans?

Session beans > Associated with a client and keeps states for a client
Entity Beans > Represents some entity in persistent storage such as a database

15) What is enterprise bean?


Server side reusable java component

Offers services that are hard to implement by the programmer


Sun: Enterprise Bean architecture is a component architecture for the deployment and
development of componentbased distributed business applications. Applications written
using enterprise java beans are scalable, transactional and multiuser secure. These
applications may be written once and then deployed on any server plattform that
supports enterprise java beans specification.

Enterprise beans are executed by the J2EE server.

First version 1.0 contained session beans, entity beans were not included. Entity beans
were added to version 1.1 which came out during year 1999. Current release is EJB
version 1.2

16)Services of EJB?
Database management :
?Database connection pooling
?DataSource, offered by the J2EE server. Needed to access connection pool of the
server.
?Database access is configured to the J2EE server > easy to change database / database
driver

Transaction management :
?Distributed transactions
?J2EE server offers transaction monitor which can be accessed by the client.

Security management :

?Authetication

10
?Authorization
?encryption

Enterprise java beans can be distributed /replicated into separate


machines Distribution/replication offers
?Load balancing, load can be divided into separate servers.
?Failover, if one server fails, others can keep on processing normally.
?Performance, one server is not so heavy loaded. Also, for example Weblogic has thread
pools for improving performance in one server.

17)When to choose EJB?

Server will be heavy loaded :


?Distribution of servers helps to achieve better performance.
Server should have replica for the case of failure of one server:
?Replication is invisible to the programmer
Distributed transactions are needed "
?J2EE server offers transaction monitor that takes care of transaction management.
?Distributed transactions are invisible to the programmer
Other services vs. money :
Weblogic J2EE server ~ 80 000 mk and Jbuilder X Professional Edition ~ 5 000mk

18) Why not to use free J2EE servers?

?no tecnical support


?harder to use (no graphical user interface ...)
?no integration to development tools (for example, Jbuilder)
?Bugs? Other problems during project?

19) Alternative:Tuxedo
Tuxedo is a middleware that offers scalability services and transaction monitors.
C or C++ based.
Can be used with Java client by classes in JOLT package offered by BEA.

Faster that J2EE server?


Harder to program?
Harder to debug?
Implementation is platform dependent.

20) J2EE server offers

DataSource:

11
?Object that can be used to achieve database connection from the connection pool.
?Can be accessed by the interface DataSource

Transaction monitor:

?Can be accessed by the interface UserTransaction.

21)Java Naming and the Directory Service

Naming service is needed to locate beans home interfaces or other objects (DataSource,
UserTransaction): ?For example, jndi name of the DataSource
Directory service is needed to store and retrieve properties by their name: ?jndi name:
java:comp/env/propertyName

22) XML ? deployment descriptor

ejbjar.xml + serverspecific xml file Which is then Packed in a jar ? file together with
bean classes. Beans are packaged into EJB JAR file , Manifest file is used to list EJB?s
and jar file holding Deployment descriptor.

23) Session Bean

Developer programs three classes:


?Home interface, contains methods for creating (and locating for entity beans) bean
instances.
?Remote interface, contains business methods the bean offers.
?Bean class, contains the business logic of the enterprise bean.

24)Entity Beans

Represents one row in the database:


?Easy way to access database
?business logic concept to manipulate data.
Container managed persistence vs. bean managed persistence:

Programmer creates three or four classes:

?Home interface for locating beans


?Remote interface that contains business methods for clients.
?Bean class that implements bean?s behaviour.

12
?Primary key class ? that represents primary key in the database. Used to locate beans.
Primary key class is not needed if primary key is a single field that could

25) When to use which bean?

Entity beans are effective when application wants to access one row at a time. If many
rows needs to be fetched, using session beans can be better alternative ava class (for
example, Integer). Entity beans are efficient when working with one row at a time
Cause a lot of network trafic. Session Beans are efficient when client wants to access
database directry. ?fetching/updating multiple rows from the database

26) Explain J2EE Arch?

Normally, thinclient multitiered applications are hard to write because they involve
many lines of intricate code to handle transaction and state management, multithreading,
resource pooling, and other complex lowlevel details. The componentbased and
platformindependent J2EE architecture makes J2EE applications easy to write because
business logic is organized into reusable components and the J2EE server provides
underlying services in the form of a container for every component type. Because you do
not have to develop these services yourself, you are free to concentrate on solving the
business problem at hand.

Containers and Services :

Component are installed in their containers during deployment and are the interface
between a component and the lowlevel platformspecific functionality that supports the
component. Before a web, enterprise bean, or application client component can be
executed, it must be assembled into a J2EE application and deployed into its container.
The assembly process involves specifying container settings for each component in the
J2EE application and for the J2EE application itself. Container settings customize the
underlying support provided by the J2EE Server, which include services such as
security, transaction management, Java Naming and Directory InterfaceTM (JNDI)
lookups, and remote connectivity.

Container Types :

The deployment process installs J2EE application components in the following types of
J2EE containers. The J2EE components and container addressed in this tutorial are
shown in Figure 5. An Enterprise JavaBeans (EJB) container manages the execution of
all enterprise beans for one J2EE application. Enterprise beans and their container run on
the J2EE server. A web container manages the execution of all JSP page and servlet
components for one J2EE application. Web components and their container run on the
J2EE server. An application client container manages the execution of all
application client components for one J2EE application. Application clients and

13
their container run on the client machine. An applet container is the web browser and
Java Plugin combination running on the client machine.

14