Wednesday, 2 November 2011

Top Interview Questions on Java

Is it possible to communicate from an applet to servlet and how many ways and how?- Yes, there are three ways to communicate from an applet to servlet and they are: a) HTTP Communication(Text-based and object-based) b) Socket Communication c) RMI Communication
What is connection pooling?- With servlets, opening a database connection is a major bottleneck because we are creating and tearing down a new connection for every page request and the time taken to create connection will be more. Creating a connection pool is an ideal approach for a complicated servlet. With a connection pool, we can duplicate only the resources we need to duplicate rather than the entire servlet. A connection pool can also intelligently manage the size of the pool and make sure each connection remains valid. A number of connection pool packages are currently available. Some like DbConnectionBroker are freely available from Java Exchange Works by creating an object that dispenses connections and connection Ids on request. The ConnectionPool class maintains a Hastable, using Connection objects as keys and Boolean values as stored values. The Boolean value indicates whether a connection is in use or not. A program calls getConnection() method of the ConnectionPool for getting Connection object it can use; it calls returnConnection() to give the connection back to the pool.
Why should we go for interservlet communication?- Servlets running together in the same server communicate with each other in several ways. The three major reasons to use interservlet communication are: a) Direct servlet manipulation - allows to gain access to the other currently loaded servlets and perform certain tasks (through the ServletContext object) b) Servlet reuse - allows the servlet to reuse the public methods of another servlet. c) Servlet collaboration - requires to communicate with each other by sharing specific information (through method invocation)
Is it possible to call servlet with parameters in the URL?- Yes. You can call a servlet with parameters in the syntax as (?Param1 = xxx || m2 = yyy).
What is Servlet chaining?- Servlet chaining is a technique in which two or more servlets can cooperate in servicing a single request. In servlet chaining, one servlet’s output is piped to the next servlet’s input. This process continues until the last servlet is reached. Its output is then sent back to the client. 
How do servlets handle multiple simultaneous requests?- The server has multiple threads that are available to handle requests. When a request comes in, it is assigned to a thread, which calls a service method (for example: doGet(), doPost() and service()) of the servlet. For this reason, a single servlet object can have its service methods called by many threads at once.

What is Inet address?- Every computer connected to a network has an IP address. An IP address is a number that uniquely identifies each computer on the Net. An IP address is a 32-bit number.

What is Domain Naming Service(DNS)?- It is very difficult to remember a set of numbers(IP address) to connect to the Internet. The Domain Naming Service(DNS) is used to overcome this problem. It maps one particular IP address to a string of characters. For example, www. mascom. com implies com is the domain name reserved for US commercial sites, moscom is the name of the company and www is the name of the specific computer, which is mascom’s server.

What is URL?- URL stands for Uniform Resource Locator and it points to resource files on the Internet. URL has four components: http://www. address. com:80/index.html, where http - protocol name, address - IP address or host name, 80 - port number and index.html - file path.

What is RMI and steps involved in developing an RMI object?- Remote Method Invocation (RMI) allows java object that executes on one machine and to invoke the method of a Java object to execute on another machine. The steps involved in developing an RMI object are: a) Define the interfaces b) Implementing these interfaces c) Compile the interfaces and their implementations with the java compiler d) Compile the server implementation with RMI compiler e) Run the RMI registry f) Run the application

What is RMI architecture?- RMI architecture consists of four layers and each layer performs specific functions: a) Application layer - contains the actual object definition. b) Proxy layer - consists of stub and skeleton. c) Remote Reference layer - gets the stream of bytes from the transport layer and sends it to the proxy layer. d) Transportation layer - responsible for handling the actual machine-to-machine communication.

what is UnicastRemoteObject?- All remote objects must extend UnicastRemoteObject, which provides functionality that is needed to make objects available from remote machines.

Explain the methods, rebind() and lookup() in Naming class?- rebind() of the Naming class(found in java. rmi) is used to update the RMI registry on the server machine. Naming. rebind(”AddSever”, AddServerImpl); lookup() of the Naming class accepts one argument, the rmi URL and returns a reference to an object of type AddServerImpl.

What is a Java Bean?- A Java Bean is a software component that has been designed to be reusable in a variety of different environments.

What is a Jar file?- Jar file allows to efficiently deploying a set of classes and their associated resources. The elements in a jar file are compressed, which makes downloading a Jar file much faster than separately downloading several uncompressed files. The package java. util. zip contains classes that read and write jar files.

What is BDK?- BDK, Bean Development Kit is a tool that enables to create, configure and connect a set of set of Beans and it can be used to test Beans without writing a code.

What is JSP?- JSP is a dynamic scripting capability for web pages that allows Java as well as a few special tags to be embedded into a web file (HTML/XML, etc). The suffix traditionally ends with .jsp to indicate to the web server that the file is a JSP files. JSP is a server side technology - you can’t do any client side validation with it. The advantages are: a) The JSP assists in making the HTML more functional. Servlets on the other hand allow outputting of HTML but it is a tedious process. b) It is easy to make a change and then let the JSP capability of the web server you are using deal with compiling it into a servlet and running it.

What are JSP scripting elements?- JSP scripting elements lets to insert Java code into the servlet that will be generated from the current JSP page. There are three forms: a) Expressions of the form <%= expression %> that are evaluated and inserted into the output, b) Scriptlets of the form<% code %>that are inserted into the servlet’s service method, and c) Declarations of the form <%! Code %>that are inserted into the body of the servlet class, outside of any existing methods.

What are JSP Directives?- A JSP directive affects the overall structure of the servlet class. It usually has the following form:<%@ directive attribute=”value” %> However, you can also combine multiple attribute settings for a single directive, as follows:<%@ directive attribute1=”value1? attribute 2=”value2? . . . attributeN =”valueN” %> There are two main types of directive: page, which lets to do things like import classes, customize the servlet superclass, and the like; and include, which lets to insert a file into the servlet class at the time the JSP file is translated into a servlet

What are Predefined variables or implicit objects?- To simplify code in JSP expressions and scriptlets, we can use eight automatically defined variables, sometimes called implicit objects. They are request, response, out, session, application, config, pageContext, and page.

What are JSP ACTIONS?- JSP actions use constructs in XML syntax to control the behavior of the servlet engine. You can dynamically insert a file, reuse JavaBeans components, forward the user to another page, or generate HTML for the Java plugin. Available actions include: jsp:include - Include a file at the time the page is requested. jsp:useBean - Find or instantiate a JavaBean. jsp:setProperty - Set the property of a JavaBean. jsp:getProperty - Insert the property of a JavaBean into the output. jsp:forward - Forward the requester to a newpage. Jsp: plugin - Generate browser-specific code that makes an OBJECT or EMBED

How do you pass data (including JavaBeans) to a JSP from a servlet?- (1) Request Lifetime: Using this technique to pass beans, a request dispatcher (using either “include” or forward”) can be called. This bean will disappear after processing this request has been completed. Servlet: request. setAttribute(”theBean”, myBean); RequestDispatcher rd = getServletContext(). getRequestDispatcher(”thepage. jsp”); rd. forward(request, response); JSP PAGE:(2) Session Lifetime: Using this technique to pass beans that are relevant to a particular session (such as in individual user login) over a number of requests. This bean will disappear when the session is invalidated or it times out, or when you remove it. Servlet: HttpSession session = request. getSession(true); session. putValue(”theBean”, myBean); /* You can do a request dispatcher here, or just let the bean be visible on the next request */ JSP Page: 3) Application Lifetime: Using this technique to pass beans that are relevant to all servlets and JSP pages in a particular app, for all users. For example, I use this to make a JDBC connection pool object available to the various servlets and JSP pages in my apps. This bean will disappear when the servlet engine is shut down, or when you remove it. Servlet: GetServletContext(). setAttribute(”theBean”, myBean); JSP PAGE:

How can I set a cookie in JSP?- response. setHeader(”Set-Cookie”, “cookie string”); To give the response-object to a bean, write a method setResponse (HttpServletResponse response) - to the bean, and in jsp-file:<% bean. setResponse (response); %>

How can I delete a cookie with JSP?- Say that I have a cookie called “foo, ” that I set a while ago & I want it to go away. I simply: <% Cookie killCookie = new Cookie(”foo”, null); KillCookie. setPath(”/”); killCookie. setMaxAge(0); response. addCookie(killCookie); %>

How are Servlets and JSP Pages related?- JSP pages are focused around HTML (or XML) with Java codes and JSP tags inside them. When a web server that has JSP support is asked for a JSP page, it checks to see if it has already compiled the page into a servlet. Thus, JSP pages become servlets and are transformed into pure Java and then compiled, loaded into the server and executed.

Large list of Intel interview questions

  1. Insights of an inverter. Explain the working?
  2. Insights of a 2 input NOR gate. Explain the working?
  3. Insights of a 2 input NAND gate. Explain the working?
  4. Implement F= not (AB+CD) using CMOS gates?
  5. Insights of a pass gate. Explain the working?
  6. Why do we need both PMOS and NMOS transistors to implement a pass gate?
  7. What does the above code synthesize to?
  8. Cross section of a PMOS transistor?
  9. Cross section of an NMOS transistor?
  10. What is a D-latch? Write the VHDL Code for it?
  11. Differences between D-Latch and D flip-flop?
  12. Implement D flip-flop with a couple of latches? Write a VHDL Code for a D flip-flop?
  13. What is latchup? Explain the methods used to prevent it?
  14. What is charge sharing?
  15. While using logic design, explain the various steps that r followed to obtain the desirable design in a well defined manner?
  16. Why is OOPS called OOPS? (C++)
  17. What is a linked list? Explain the 2 fields in a linked list?
  18. Implement a 2 I/P and gate using Tran gates?
  19. Insights of a 4bit adder/Sub Circuit?
  20. For f = AB+CD if B is S-a-1, what r the test vectors needed to detect the fault?
  21. Explain various adders and diff between them?
  22. Explain the working of 4-bit Up/down Counter?
  23. A circuit has 1 input X and 2 outputs A and B. If X = HIGH for 4 clock ticks, A = 1. If X = LOW for 4 clock ticks, B = 1. Draw a state diagram for this Spec?
  24. Advantages and disadvantages of Mealy and Moore?
  25. Id vs. Vds Characteristics of NMOS and PMOS transistors?
  26. Explain the operation of a 6T-SRAM cell?
  27. Differences between DRAM and SRAM?
  28. Implement a function with both ratioed and domino logic and merits and demerits of each logic?
  29. Given a circuit and asked to tell the output voltages of that circuit?
  30. How can you construct both PMOS and NMOS on a single substrate?
  31. What happens when the gate oxide is very thin?
  32. What is setup time and hold time?
  33. Write a pseudo code for sorting the numbers in an array?
  34. What is pipelining and how can we increase throughput using pipelining?
  35. Explain about stuck at fault models, scan design, BIST and IDDQ testing?
  36. What is SPICE?
  37. Differences between IRSIM and SPICE?
  38. Differences between netlist of HSPICE and Spectre?
  39. What is FPGA?
  40. Draw the Cross Section of an Inverter? Clearly show all the connections between M1 and poly, M1 and diffusion layers etc?
  41. Draw the Layout of an Inverter?
  42. If the current thru the poly is 20nA and the contact can take a max current of 10nA how would u overcome the problem?
  43. Implement F = AB+C using CMOS gates?
  44. Working of a 2-stage OPAMP?
  45. 6-T XOR gate?
  46. Differences between blocking and Non-blocking statements in Verilog?
  47. Differences between Signals and Variables in VHDL? If the same code is written using Signals and Variables what does it synthesize to?
  48. Differences between functions and Procedures in VHDL?
  49. What is component binding?
  50. What is polymorphism? (C++)
  51. What is hot electron effect?
  52. Define threshold voltage?
  53. Factors affecting Power Consumption on a chip?
  54. Explain Clock Skew?
  55. Why do we use a Clock tree?
  56. Explain the various Capacitances associated with a transistor and which one of them is the most prominent?
  57. Explain the Various steps in Synthesis?
  58. Explain ASIC Design Flow?
  59. Explain Custom Design Flow?
  60. Why is Extraction performed?
  61. What is LVS, DRC?
  62. Who provides the DRC rules?
  63. What is validation?
  64. What is Cross Talk?
  65. Different ways of implementing a comparator?
  66. What r the phenomenon which come into play when the devices are scaled to the sub-micron lengths?
  67. What is clock feed through?
  68. Implement an Inverter using a single transistor?
  69. What is Fowler-Nordheim Tunneling?
  70. Insights of a Tri-state inverter?
  71. If an/ap = 0.5, an/ap = 1, an/ap = 3, for 3 inverters draw the transfer characteristics?
  72. Differences between Array and Booth Multipliers?
  73. Explain the concept of a Clock Divider Circuit? Write a VHDL code for the same?
  74. Which gate is normally preferred while implementing circuits using CMOS logic, NAND or NOR? Why?
  75. Insights of a Tri-State Inverter?
  76. Basic Stuff related to Perl?
  77. Have you studied buses? What types?
  78. Have you studied pipelining? List the 5 stages of a 5 stage pipeline. Assuming 1 clock per stage, what is the latency of an instruction in a 5 stage machine? What is the throughput of this machine ?
  79. How many bit combinations are there in a byte?
  80. For a single computer processor computer system, what is the purpose of a processor cache and describe its operation?
  81. Explain the operation considering a two processor computer system with a cache for each processor.
  82. What are the main issues associated with multiprocessor caches and how might you solve them?
  83. Explain the difference between write through and write back cache.
  84. Are you familiar with the term MESI?
  85. Are you familiar with the term snooping?
  86. Describe a finite state machine that will detect three consecutive coin tosses (of one coin) that results in heads.
  87. In what cases do you need to double clock a signal before presenting it to a synchronous state machine?
  88. You have a driver that drives a long signal & connects to an input device. At the input device there is either overshoot, undershoot or signal threshold violations, what can be done to correct this problem?
  89. What are the total number of lines written by you in C/C++? What is the most complicated/valuable program written in C/C++?
  90. What compiler was used?
  91. What is the difference between = and == in C?
  92. Are you familiar with VHDL and/or Verilog?
  93. What types of CMOS memories have you designed? What were their size? Speed?
  94. What work have you done on full chip Clock and Power distribution? What process technology and budgets were used?
  95. What types of I/O have you designed? What were their size? Speed? Configuration? Voltage requirements?
  96. Process technology? What package was used and how did you model the package/system? What parasitic effects were considered?
  97. What types of high speed CMOS circuits have you designed?
  98. What transistor level design tools are you proficient with? What types of designs were they used on?
  99. What products have you designed which have entered high volume production?
  100. What was your role in the silicon evaluation/product ramp? What tools did you use?
  101. If not into production, how far did you follow the design and why did not you see it into production?

Infosys Logical questions

I have two coins for 75 paise. 1 coin is not 50 paise, how?
Latest Answer: 1 coin is not fifty paise, but another can be, so let another be 50 paise coin and the one you are talking about is 25 paise coin so here we make 75paise with two coins.

Once there came many birds to a pond. There were certain number of lotus flowers in the pond. If each bird occupied one lotus one bird was left alone without any flower. If two birds sat in a flower one
Latest Answer: Let no. of birds is "b" and no. of lotus be "l" Now, a/c to first condition--> b = l+1 & a/c to snd condition--> b/2 = l-1 Solving above equations, we get, No. of Bird=4 & No. of Lotus = 3 ...

 A pipe can fill a tank in 3 hours due to leakage it takes 3.5 hours to fill the same tank then how many hours will the leakage can empty the tank
Latest Answer: Let the tank be 1 ltr. It takes 180 min(3 hr) to fill this tank.Hence 1 min's work is 1/180After the tank got a hole in it, it takes 3 and 1/2 hrs ie.. 210 min.hence work expended in 210 min is 210*1/180=7/6Hence extra work spended due to hole is ...

Two coins one with HEAD IN BOTH SIDES and the other coin HEAD IN ONE SIDE AND TAIL IN THE OTHER SIDE is in a box,a coin is taken at random and FOUND HEAD IN ONE SIDE .what is the probability that THE OTHER SIDE IS HEAD?
Ans:::::::1.Two coins one with HEAD IN BOTH SIDES and the other coin HEAD IN ONE SIDE AND TAIL IN THE OTHER SIDE is in a box,a coin is taken at random and FOUND HEAD IN

When Arthur is as old as his father Hailey is now, he shall be 5 times as old as his son Clarke is now. By then Clarke will be 8 times older than Arthur is now. The combined ages of Hailey and Arthur are
Latest Answer: Let Age of Haley is = H, Arthur is = A, Clarke =CA+H =100 ---------------(1)H=5C ---------------------(2)(H-A) + C = 8A ----------- (3)Solving them gives H = 1500/17 , A = 200/17, C = 200/17 ...

A car is traveling at a uniform speed. The driver sees a milestone showing a 2-digit number. After traveling for an hour thedriver sees another milestone with the same digits in reverse order. After another hour the driver sees another milestone containingthe same two digits with a zero in between(0). What is the average speed of the driver.
Ans:
Let 10'splace digit is x and unit's place digit y

First milestone :      10x+y
Second milestone : 10y+x
Third milestone:      100x+y

Since the speed is uniform so
  Distance covered in first Hr = Distance covered in Second Hr
  (10y+x)-(10x+y) = (100x+y)-(10y+x)
After solving, we get  ---->   y=6x  but since x and y are digits so only possible combination is x=1 and y=6,
  So average speed = 45 KM/HR




A mathamatical word contain 10 letters.Without first four letter you can't plan your life.Last six letter specify particular time.

Ans: "TimePeriod" 

My son is half of my age & was 1/3rd of my age 10 yrs back. What is my present age?

 let the fathers age be f and son's age be s
s=.5f => f=2s..................1
(f-10)/3=(s-10) => f-10=3s-30
3s-f=20.............................2
solving 1 and 2
we get son's age as 20 and fathers age as 40

 


Tuesday, 1 November 2011

Aptitude Questions IV

1.If 2x-y=4 then 6x-3y=?
(a)15
(b)12
(c)18
(d)10

Ans. (b)
2.If x=y=2z and xyz=256 then what is the value of x?

(a)12
(b)8
(c)16
(d)6

Ans. (b)
3. (1/10)18 - (1/10)20 = ?
(a) 99/1020
(b) 99/10
(c) 0.9
(d) none of these
Ans. (a)
4.Pipe A can fill in 20 minutes and Pipe B in 30 mins
and Pipe C can
empty the same in 40 mins.If all of them work
together, find the time
taken to fill the tank
(a) 17 1/7 mins
(b) 20 mins
(c) 8 mins
(d) none of these
Ans. (a)
5. Thirty men take 20 days to complete a job working 9
hours a day.How
many hour a day should 40 men work to complete the
job?
(a) 8 hrs
(b) 7 1/2 hrs
(c) 7 hrs
(d) 9 hrs
Ans. (b)
6. Find the smallest number in a GP whose sum is 38
and product 1728
(a) 12
(b) 20
(c) 8
(d) none of these
Ans. (c)
7. A boat travels 20 kms upstream in 6 hrs and 18 kms
downstream in 4
hrs.Find the speed of the boat in still water and the
speed of the
water current?
(a) 1/2 kmph
(b) 7/12 kmph
(c) 5 kmph
(d) none of these
Ans. (b)
8. A goat is tied to one corner of a square plot of
side 12m by a rope
7m long.Find the area it can graze?
(a) 38.5 sq.m
(b) 155 sq.m
(c) 144 sq.m
(d) 19.25 sq.m
Ans. (a)
9. Mr. Shah decided to walk down the escalator of a
tube station. He
found that if he walks down 26 steps, he requires 30
seconds to
reach the bottom. However, if he steps down 34 stairs
he would only
require 18 seconds to get to the bottom. If the time
is measured from
the moment the top step begins to descend to the
time he steps off
the last step at the bottom, find out the height of
the stair way in
steps?
Ans.46 steps.
10. The average age of 10 members of a committee is
the same as it was
4 years ago, because an old member has been replaced
by a young
member. Find how much younger is the new member ?
Ans.40 years.
11. Three containers A, B and C have volumes a, b, and
c respectively;
and container A is full of water while the other two
are empty. If
from container A water is poured into container B
which becomes 1/3
full, and into container C which becomes 1/2 full, how
much water is
left in container A?
12. ABCE is an isosceles trapezoid and ACDE is a
rectangle. AB = 10
and EC = 20. What is the length of AE?
Ans. AE = 10.
13. In the given figure, PA and PB are tangents to the
circle at A and
B respectively and the chord BC is parallel to
tangent PA. If AC = 6
cm, and length of the tangent AP is 9 cm, then what
is the length of
the chord BC?
Ans. BC = 4 cm.
15 Three cards are drawn at random from an ordinary
pack of cards.
Find the probability that they will consist of a king,
a queen and an ace.
Ans. 64/2210.
16. A number of cats got together and decided to kill
between them
999919 mice. Every cat killed an equal number of
mice. Each cat
killed more mice than there were cats. How many cats
do you think
there were ?
Ans. 991.
17. If Log2 x - 5 Log x + 6 = 0, then what would the
value / values of
x be?
Ans. x = e2 or e3.
18. The square of a two digit number is divided by
half the number.
After 36 is added to the quotient, this sum is then
divided by 2.
The digits of the resulting number are the same as
those in the
original number, but they are in reverse order. The
ten's place of
the original number is equal to twice the difference
between its
digits. What is the number?
Ans. 46
19.Can you tender a one rupee note in such a manner
that there shall
be total 50 coins but none of them would be 2 paise
coins.?
Ans. 45 one paisa coins, 2 five paise coins, 2 ten
paise coins, and 1
twenty-five paise coins.
20.A monkey starts climbing up a tree 20ft. tall. Each
hour, it hops
3ft. and slips back 2ft. How much time would it take
the monkey to
reach the top?
Ans.18 hours.
21. What is the missing number in this series? 8 2
14 6 11 ? 14 6 18 12
Ans. 9
22. A certain type of mixture is prepared by mixing
brand A at Rs.9 a
kg. with brand B at Rs.4 a kg. If the mixture is worth
Rs.7 a kg., how
many kgs. of brand A are needed to make 40kgs. of
the mixture?
Ans. Brand A needed is 24kgs.
23. A wizard named Nepo says "I am only three times my
son's age. My
father is 40 years more than twice my age. Together
the three of us
are a mere 1240 years old." How old is Nepo?
Ans. 360 years old.
24. One dog tells the other that there are two dogs in
front of me.
The other one also shouts that he too had two behind
him. How many are
they?
Ans. Three.
25. A man ate 100 bananas in five days, each day
eating 6 more than
the previous day. How many bananas did he eat on the
first day?
Ans. Eight.
26. If it takes five minutes to boil one egg, how long
will it take to
boil four eggs?
Ans. Five minutes.
27. The minute hand of a clock overtakes the hour hand
at intervals of
64 minutes of correct time. How much a day does the
clock gain or lose?
Ans. 32 8/11 minutes.
28. Solve for x and y: 1/x - 1/y = 1/3, 1/x2 + 1/y2
= 5/9.
Ans. x = 3/2 or -3 and y = 3 or -3/2.
29. Daal is now being sold at Rs. 20 a kg. During last
month its rate
was Rs. 16 per kg. By how much percent should a family
reduce its
consumption so as to keep the expenditure fixed?
Ans. 20 %.
30. Find the least value of 3x + 4y if x2y3 = 6.
Ans. 10.
31. Can you find out what day of the week was January
12, 1979?
Ans. Friday.
32. A garrison of 3300 men has provisions for 32 days,
when given at a
rate of 850 grams per head. At the end of 7 days a
reinforcement
arrives and it was found that now the provisions will
last 8 days
less, when given at the rate of 825 grams per head.
How, many more men
can it feed?
Ans. 1700 men.
33. From 5 different green balls, four different blue
balls and three
different red balls, how many combinations of balls
can be chosen
taking at least one green and one blue ball?
Ans. 3720.
34. Three pipes, A, B, & C are attached to a tank. A &
B can fill it
in 20 & 30 minutes respectively while C can empty it
in 15 minutes.
If A, B & C are kept open successively for 1 minute
each, how soon
will the tank be filled?
Ans. 167 minutes.
35. A person walking 5/6 of his usual rate is 40
minutes late. What is
his usual time? Ans. 3 hours 20 minutes.

36.For a motorist there are three ways going from City
A to City C. By
way of bridge the distance is 20 miles and toll is
$0.75. A tunnel
between the two cities is a distance of 10 miles and
toll is $1.00 for
the vehicle and driver and $0.10 for each passenger. A
two-lane
highway without toll goes east for 30 miles to city B
and then 20
miles in a northwest direction to City C.

Search here for "Freshers Jobs"