Interview Based Questions


1. What are the types of ServletEngines?
Standalone ServletEngine:A standalone engine is a server that includes built-in support for servlets.

Add-on ServletEngine:Its a plug-in to an existing server.It adds servlet support to a server that was not originally designed with servlets in mind.

Embedded ServletEngine:

2.What is the difference between a Generic Servlet and Http Servlet?

Generic Servlet Http Servlet
Class which internally implements An abstract class which acts as a child class both for Servlet and ServletConfig GenericServlet and in addition provides interfaces. some additional methods
like doGet(),doPost(),doDelete() &
doPut().

3.What is a Session Id?

It is a unique id assigned by the server to the user when a user first accesses a site or an application ie. when a request is made.

4. List out Differences between CGI Perl and Servlet?

Servlet CGI

Platform independent Platform dependent.
Language dependent Language independent.

5. What is Bootstrapping in RMI?

Dynamic loading of stubs and skeletons is known as Boot Strapping.

6. What are different types of Exceptions?.
Runtime exceptions, Errors, Program Exceptions

7. What are types of applets?.
Trusted Applets: Applets with predefined security
Untrusted Applets: Applets without any security

8. When does an Exception occur?.

Whenever an error occurs in an Application,(either at compile time)or runtime,it raises an Exception.

9. What is servlet tunnelling?.
Used in applet to servlet communications, a layer over http is built so as to enable object serialization.

10. What is a cookie?.

Cookies are a way for a server to send some information to a client to store and for the server to later retrieve its data from that client.Web browser supports 20 cookies/host of 4kb each.

11.What is the frontend in Java?.Also what is Backend?.
Frontend: Applet
Backend : Oracle, Ms-Access(Using JDBC).

12. Define a JSP?.
Java Server Pages includes scripplets of Servletcode in an Html page.This creates dynamism in the other-wise static HTML.A JSP is a document that describes how to process a request to creeate response.

13. The length of an identifier is

14. Stored procedures can be called by Callable Statement.

15. Stack class implements LIFO(Last In First Out).

16. Servlet Class defines init.

17. Reference of any instance variable inside a static method is legal if declared static.

18. What will a read() function do?.
A method in Input Stream.It reads a single byte or an array of bytes.Returns no of bytes read or -1 if EOF(End of file)is reached.

19.To implement a Throwable array,which class is used.
Vector
LinkedList
Stack
ArrayList - Answer(To be Confirmed)

20. The method for precompiled SQL Statement in JDBC is prepareStatement().

21. Static binding occurs at
Compile Time
Runtime
Both at compile and runtime.

22. Virtual Methods are default in
Java
C
C++ - Answer
All

23. Storage space in java is of the form
Stack
Queue
Heap
List

24. What is java code embedded in a web page known as
Applets
Servlets
scriptlets
snippets

25. Which of the following attributes are compulsory with an tag?.
code,height & width.

26. What does 'CODEBASE' in an applet tag specify?.
Files absolute path.

27. What are AccessSpecifiers & Access Modifiers.
Access Specifiers: Give access previleges to outside applications or users. They are :-
Public: any one can access
private:only class members can access.cannot be inherited.
protected: can be accessed by a derived class.
default: can access data from the current directory.

Access Modifiers: Which gives additional meaning to data, methods and classes.
(i) Final: cannot be modified at any point of time.

28. Tools provided by JDK
(i) javac - compiler
(ii) java - interpretor
(iii) jdb - debugger
(iv) javap - Disassembles
(v) appletviewer - Applets
(vi) javadoc - documentation generator
(vii) javah - 'C' header file generator

29.Hostile Applets:Its an applet which when downloaded attempts to exploit your system's resources in an inappropriate manner.It performs or causes you to perform an action which you would not otherwise care to perform.

30.RemoteObjects: Objects that have methods that can be called accross virtual machines are Remote Objects.An object becomes Remote by implementing Remote Interface.

31.Compiling: Conversion of Programmer-readable Text into Bytecodes,which are platform independent,is known as Compiling.

32.Java Primitive Data Types:
Byte-8-bit
short-16-bit
int-32-bit
Long-64-bit
Float-32-bit floating point
Bouble-64-bit floating point
Char-16-bit Unicode

33.What is a unicode?
Unicode is a standard that supports International Characters.

34. What are blocks?.
They are statements appearing within braces {}.

35. What are types of Java applications?.

(i) Standalone applications(No browser).
(ii) Applets(Browser).

36. What is the method that gets invoked first in a stand alone application?.

The main()method.

37. What is throwing an Exception?.
The act of passing an Exception Object to the runtime system is called Throwing an Exception.

38. What are the packages in JDK?.

There are 8 packages
(i) java.lang(ii)java.util(iii)java.io(iv)java.applet(v) java.awt
(vi) java.awt.image(vii)java.awt.peer(viii)java.awt.net

39. What is a thread?.
Its a single sequential stream of execution.

40. What is runnable?.
Its an Interface through which Java implements Threads.The class can extend from any class but if it implements Runnable,Threads can be used in that particular application.

41. What is preemptive and Non-preemptive Time Scheduling?.
Preemptive: Running tasks are given small portions of time to execute by using time-slicing.
Non-Preemptive: One task doesn't give another task a chance to run until its finished or has normally yielded its time.

42. What is synchronization?.
Two or more threads trying to access the same method at the same point of time leads to synchronization.If that particular method is declared as synchronized only one thread can access it at a time. Another thread can access it only if the first thread's task is complete.

43. What are the various thread priorities?.

(i) Min-Priority-value(1).
(ii) Normal-Priority-value(5).
(iii)Max-Priority-value(10).

44.What is Inter-Thread communication?.
To exchange information between two threads.

45.The package java.applet.* has only one class.

46.BorderLayout is the default layout of Dialog object.

47.executeQuery() returns ResultSet.

48.Throwable class is a sub-class of object and implements Serializable.

49.Super class of TextArea and TextField is TextComponent.

50. Skeletons are server side proxies and stubs are client side proxies.

51. GridBagConstraints class helps in positioning of parameters of a
component within an object laidout using GridBagLayout.

52. Netscape introduced JScript language - True

53. EventDelegation model was introduced by JDK 1.1 - False

54. StringTokenizer provides two constructors - False

55. java.applet is one of the smallest package in Java API - True

56. Drag and Drop API consist of java.awt.dnd package - False

57. What is IP?.
IP is Internet Protocol. It is the network protocol which is used to send information from one computer to another over the network over the internet in the form of packets.

58. What is a port?.
A port is an 16-bit address within a computer.Ports for some common Internet Application protocols.

File Transfer Protocol-21.
Telnet Protocol-23.
Simple Mail Transfer Protocol-25.
Hypertext Transfer Protocol-80.

59.What is hypertext?.
Sockets are endpoints of Internet Communication.They are associated with a host address and a port address.Clients create client sockets and connect them to server sockets.
UDP is a connectionless protocol.

MIME(Multipurpose Internet Mail Extension) is a general method by which the content of different types of Internet objects can be identified.

61. What is an abstract class?.
A class which cannot be Instantiated.

62.ServletRunner options are:
-p-port number(8080).
-b-backlog connections(50).
-m-maximum no.of connection handlers(100).
-t-connection timeout in milliseconds
-d-servlet directory (current directory)
-s-servlet properties file

63.How many standard ports are available?.
1024.

64.What is a policy?.
It's an abstract class for representing the system security policy for a Java application environment(specifying which permissions are available for code from various sources). Java security properties file resides in /lib/security/java.security directory. Value of "policy.provider" should be changed.

65. What are different ways of Session-Tracking?.
(i) User-Authorization
(ii) Hidden Files
(iii) Persistant Cookies
(iv) URL Rewriting.

66. If the browser does not support cookies or if they are disabled, how is session tracking done?.

Session tracking is done by URL Rewriting.
* Multiple requests can be handled by a servlet and it also can synchronize them.ex: On-line conferencing.
* Servlets have no Graphic User Interface.
* We can synchronize the service() method for a major performance impact as multiple requests are involved in case of servlets.
* We can make a servlet handle a single client/request by implementing single threadmodel interface.

67. What is a Swing?.
It is a GUI component with a pluggable look and feel.

68. What is default Look-and-Feel of a Swing Component?.
Java Look-and-Feel.

69. Awt Components and Swing Components can be inter-mingled in an Application - False

70. What are the features coming with JFC?.
(i) Pluggable Look-and-Feel
(ii) Accessibility API
(iii) Java 2D/API(JDK 1.2).
(iv) Drag and Drop Support(JDK 1.2)

71. What does x mean in javax.swing?.
Extension of java.
72. Images can be displayed on Swing Components
- True
73. Borders can be changed or added for a LightWeight Components
- True
74. Swing Components are always rectangular
- False
75. When Swing components overlap with Heavyweight components, it is the latter that is on the top
- True

76. What are the components which are termed to be Heavy-weight, available in Light-weight component?.

77. What are invisible components?.
They are light weight components that perform no painting, but can take space in the GUI.

78. What is the default layout for a ContentPane in JFC?.
BorderLayout.

79. What are the borders provided by Swing?.
(i) Simple (ii) Matte iii) Titled iv) Compound.

80. What does Realized mean?.
Realized mean that the component has been painted on screen or that is ready to be painted. Realization can take place by invoking any of these methods.
setVisible(true), show() or pack().

81. What is a convertor?.
Its an application that converts distance measurements between metric and U.S units.

82. What is the return type of interrupt method?. void.
83. What is the superclass of exception?. Throwable.
84. What is servlet exception?. It indicates that there is a problem in the servlet.
85. What is the difference between a Canvas and a Scroll Pane?.
Canvas ScrollPane

Its a component Its a container.

A rectangular area where the application Implements horizontal and vertical
can draw or trap input events. scrolling.

86. What are the restrictions imposed by a Security Manager on Applets?.

i) cannot read or write files on the host that's executing it.
ii) cannot load libraries or define native methods.
iii) cannot make network connections except to the host that it came from
iv) cannot start any program on the host that's executing it.
v) cannot read certain system properties.
vi) windows that an applet brings up look different than windows that an application brings up.

87. Can we access a database using applets?. Yes.
88. What is the default HttpRequest method?. doGet().
89. What is the life cycle of a servlet?.
Removing Handling zero or more client requests.Loading and Initializing.
90. RPC stands for Remote Procedure Call.
91. The three layers in RMI are Application Layer,RemoteReferenceLayer and Network Layer.



Directions for questions 1-10: Expand the following terms (HexaWare)
1. ODBC Ans. Open Database Connectivity.
2. HTML Ans. Hyper Text Markup Language
3. RISC Ans. Reduced Instruction Set Computing
4. ASCII Ans. American Standard Code For Information Interchange
5.ANSI Ans. American National Standard Institute.
6. XML Ans. Extended Markup Language
7. FLOPS Ans. Floating Point Operating Per Second
8. SQL Ans. Sequential Query Language
9. QBE Ans. Query By Example
10. ALE Ans. Address Latch Enable
11. What is lagging in DBMS ? Ans. Reduced Redundancy.
Directions 12 to 20: For the following questions find the odd man out
12. Unix
OS/2
CMOS
MSDOS Ans. CMOS
13. Oracle
Informix
Sybase
LISP Ans. LISP
14. Laser
Inkjet
Dotmatirx
Mouse Ans. Mouse
15. Dir
Cls
Csh
Copy Ans. Csh
16. Bit
Byte
Nibble
Digit Ans. Digit
17. Hard Disk
Floppy Drive
CD ROM
Cache Ans. Cache
18. SQL
QUEL
QBE
ORACLE Ans. Oracle
19. C++
JAVA
VC++
PASCAL Ans. PASCAL
20. Projection Operation
Selection Operation
Intersection
Set Difference Operation Ans. Intersection
21. Which of the following is a universal gate ?
(a) OR
(b) AND
(c) XOR
(d) NOR Ans. NOR
22. The default back end of the VB is
(a) Oracle
(b) Sybase
(c) Informics Ans. Sybase
23. What is meant by Superconductivity? Ans. No reistance
24. Viscosity Ans. Friction
25. What is the Lock Based Protocol used for? Ans. Concurrency Control in DBMS
Directions for question 25 to 32: Convert the decimal numbers on the left to the required form
25. 9's complement of 28 Ans. 71
26. Binary of 58 Ans. 111010
27. Octal of 359 Ans.547
28. Hexadecimal of 650 Ans.28A
29. BCD of 18 Ans.0001 1000
30. BCD of 34.8 Ans.0011 0100.1000
31. Excess-3 code of 6 Ans.1001
32. Excess-3 code of 9 Ans.1100
33. If Ax + By = 1F16; Cx + Dy = 2510 .Find the value of x and y
34. Semaphore is used for
(a) synchronization
(b) dead-lock avoidence
(c) box
(d) none Ans. A
35. For addressing 1 MB memory, the number of address lines required,
(a)11
(b)16
(c)22
(d) 24 Ans. b
36. Which of the following remains in memory temporarily
(a) Resident portion of COMMAND.COM
(b) Transient portion of COMMAND.COM
(c) API
(d) Disk BIOS Ans. b
37. Pick the odd man out
(a) IO.SYS
(b) MSDOS.SYS
(c) ROM-BIOS
(d) COMMAND.COM Ans. C
38. OS/2 is a
(a) Single User OS
(b) Multi User OS
(c) Multi Tasking OS
(d) None of these Ans. C
39. Bootstrap loader program is a program belonging to
(a) ROM startup software
(b) ROM extension software
(c) ROM BIOS software
(d) ROM Basic software Ans. A
40. The entry of starting cluster of a file is present in
(a) Boot Parameters
(b) Directory
(c) FAT
(d) Partition Table and master boot program Ans. C
APTITUDE SECTION
Directions for questions 1-6: Find the correct meaning of the following phrases
1. A man of letters
2. A man of straw
3. To be in the air
4. To bite the dust
5. Man of few words
6. Penny wise pound foolish
7. Find the reminder when 333666777888999 divided by 3 or 9 or 11 ?
8. Which is the biggest perfect square amongst the following
15129, 12348, 23716, 20736
9. The greatest area of the following
(a) The radius of circle is 4
(b) The square of diagonal is 4
(c) The square of side is 4
10. The area of the maximum size of the circle described from the 10 square inch square?
11. In the series 0, 3, 8, 15,__ What is the next number?
12. X <> 0 then what is the possibility that the result is always positive?
Ans. xy
13. 3 red and 4 blue balls are in a basket. A member of PPTeam is drawing balls from the basket. What is the probablity
of getting the 3 red balls simultaneously?
14. Let ax2 + bx + c = 0
If the sum of the equal roots is equal to the product of the same roots.Then which of the following hold true
(a) a + b = 0
(b) a = 0
(c) c = 0
(d) a + c = 0


15. A fold density is 19 times greater than the water and for copper it is 9 times.At what ratio you can mix gold and copper to get 15 times denser than water.
Ans. 3 : 2
16. Find the value of (1.99)2 Ans. 3.9601
17. There is a room with 6' x 8'. A 1' tile is fixed along the 4 walls in one row. How many 1" tiles require to finish the work. Ans. 24
18. 2 persons can finish a job in 8 days. First person alone can finish the work in 24 days. How many daysdoes the second person take to finish the job? Ans. 12 days
19. A 4" cube is painted in all its faces and then it is cut down into 1" blocks. How many 1" blocks are there even without a single face being painted? Ans. 8
20. A cylinder is inserted in a sphere d/h = 2/3. Find the surface area of the cylinder ?
21. In a car wheel, two spokes cover 15 degree. Then for the entire car,how many spokes are there? Ans. 24.
22. What is the angle of degree suspended when two hands of clock showing the time 2.30. Ans. 105 degrees
23. The age difference between two brothers is 3 years. After 6 years the ratio between the age is 9:8 What are their ages? Ans. 21 and 18
24. A person's salary is getting reduced by 20%. What percentage should be added to get back his original salary? Ans. 25%
25. Two persons start at the same point, walk in opposite directions with 5km/hr and 5.5km/hr respectively.
What is the distance separated after 2 and half hrs? Ans. 26.25 (approx)
26. A person starts walking at a speed of 5km/hr through half the distance, rest of the distance he covers with a speed 4km/hr. Total time of travel is 9 hours. What is the maximum distance he can cover? Ans. 40km.
27. Initially two cups of same volume are present with milk filled upto 3/5th and 4/5th of their volumes.Water is then filled. Then two mixtures are mixed. Find the ratio of water to milk in the mixture. Ans. 3 : 7
28. 16 grams of radioactive material decays into 8 grams in 10 years. How long will it take to decay to 1 gram ? Ans. 70 yrs.
29. In a rectangle the length is increased by of the original length . By what proportion should the width be reduced so that the area will be the same? Ans. 33
30. Find the nth number in the series is 1, -3, 5, -7.___ Ans. (-1)*(2n-1)
31. If a square is formed by the diagonal of the square as an edge, what is the ratio between the area? Ans. 2
32. The perimeter of a rhombus is 52 units. One of its diagonal is 24 units.What is its second diagonals length? Ans. 10
33. A cubical rectangular bar has the dimensions with the ratio 5 : 4 : 3. Its volume is 7500. What is the surface area of the bar? Ans. 2350
34. In a class total 34 students, 16 are have a brother, 15 are have sisters, 9 students don't have either brothers or sisters.Find the number of students having both brother and sisters. Ans. 6
35. A batsman scored 18 runs in his 18th innings and that makes his average 18. Find his average upto the 17th innings? Ans. 19
36. 6 women can do 75 units of work in 8 days by working 5hrs/day. In how many days can 4 women do 30 units of work by working 8hrs/day ?
37. A persons salary iis decreased by steps of 20%, 15% and 10%. What will be the percentage decrease, if thesalary is decreased in a single shot?
38. The ratio of the length : breadth : height of a cuboid is 5 : 4: 3, and the volume is 7500. What will be its surface area ?
39. If the circumference of a circle is 100 units, Then what will the length of the arc described by an angle of 20 degree ?
40. 3 persons started placementpapers with a capital of Rs.3000 . B invest Rs.600 less than A, C invest Rs.300 less than B. Then what is the share amount of B in a profit of Rs.886 ?

Directions for 41-50: Which of the following is the correct spelling for the word
41. supercede and supersede
42. recommend and reccomend
43. superitendent and superitendant
44. separate and seperate
45. succeed and suceed
46. coolly and coolly
47. despair and dispair
48. ridiculous and rediculous
49. indespensible and indepensable
50. tranquility or tranquillity
C TEST

Directions: For the given sample program give the output of the program(30 marks)
main()
{
int a[]={ 2,4,6,8,10 };
int i;
change(a,5);
for( i = 0; i <= 4; i++)
printf("\n %d",a[i]);
}
change( int *b, int n){
int i;
for( i = 0; i < n; i++)
*(b+i) = *(b+i) + 5;
}





(IBM Papers)
1. In 1978, a kg of paper was sold at Rs25/-.
If the paper rate increases at 1.5% more than the inflation rate which is 6.5% a year,
then what wil be the cost of a kg of paper after 2 years?
(a) 29.12
(b) 29.72
(c) 30.12
(d) 32.65
(e) none of these
2. In A,B,C are having some marbles with each of them.
A has given B and C the same number of marbles each of them already have.
Then, B gave C and A the same number of marbles they already have.
Then C gave A and B the same number of marbles they already have.
At the end A,B,and C have equal number of marbles.
(i) If x,y,z are the marbles initially with A,B,C respectively.
Then the number of marbles B have at the end
(a) 2(x-y-z)
(b) 4(x-y-z)
(c) 2(3y-x-z)
(d) x + y-z Ans. (c)
(ii) If the total number of marbles are 72, then the number of marbles with A at the starting
(a) 20
(b) 30
(c) 32
(d) 39 Ans. (d)
3. If a car starts from A towards B with some velocity. Due to some problem in the engine after travelling 30km, the car goes with 4/5 th of its actual velocity The car reaches B 45 min later to the actual time. If the car engine fails ofter travelling 45km, the car reaches the destination B 36min late to the actual time What is the initial velocity of car and what is the distance between A and B in km Ans. 20 & 130.
4. A person has Rs 100/- in his pocket, he can as 25 pencils or 15 books. He kept 15% of the money for travelling expenses and purchased 5 pencils. So how many books he can purchase with the remaining money.
5. Ten questions on analogies.
eg: chief : tribe :: governer : state
epaulette : shoulder :: tiara : head
guttural : throat :: gastric : stomach
inept : clever :: languid : active
knife : butcher ::
hammer : carpenter ::
6. The values of shares (in Rs).of A, B and C from January to June are as follows.
Month A B C
January 30 60 80
February 35 65 85
March 45 75 65
April 40 75 82
May 55 75 85
June 50 75 80
i) During this period which share has undergone maximium fluctuation?
ii) In which month it is possible to buy B and C selling A?
iii) In which month the share values are very low?
iv) By purchasing one share of A and 4 each of B and C in the beginning of the period,
when shoudl these be sold to get maximum profit?

7. In a computer institute 9 languages can be taught.The module is of 6 months duration and of the six languages only one can be taught each month. In addition to that BASIC is always taught and should be in first month itself
WORD PERFECT is to be taught in the preceeding week of WORD STAR.
FORTRAN can not be taught until COBAL is taught prior to that
BINO, FIFO can never be taught in single module
languages are BASIC, WORD STAR, WORD PERFECT, FORTRAN, COBAL, BINO, FIFO, LOTUS, C
i) If word star is in 3rd month , what could be in 6th month.
ii) If COBAL is in the 2nd month and BINO in 6th month. FORTRAN will be taught in which month.
8. In a class, except 18 all are above 50 years.
15 are below 50 years of age. How many people are there
(a) 30
(b) 33
(c) 36
(d) none of these. Ans. (d)
9. A square plate of some size is cut at four corners. Equal squares of the same size are cut and is formed as open box. If this open box carries 128 ml of oil. What is the size of the side of the plate?
(a) 17
(b) 14
(c) 13
(d) None of these
10. In a square, all the mid points are joined. The inner square is shaded.
If the area of the square is A, what is the area of the shaded area?
11. Two questions on basic angles i.e given a circle, a few chords or diameter is drawn etc.
12. If the follwoing statements are given
@(a,b)= (a+b)/2
/(a,b)= a/b
*(a,b)= ab
If a=1, b=2 then find
i) /(a,(@(a,b),*(a,b)))
ii) */(a,@(*(a,b)))
13. If the follwoing statements are given
(x#y) = x + y- xy
(x*y) = (x + y)/2
i) Find the values of x, y will satisfy this equation (x#y)#(x*y) < (x#y)
ii) Find the values of x, y will satisfy this equation (a*b)#(b*c)< (a#b)*(b*c)
14. Export PS1 results in(PS1 pwd)
a) primary prompt being your current directory
b) primary prompt and secondary prompts being the current directory
c) primary prompt prompt being your home directory
d) primary prompt and secondary prompts being the home directory
e) None of the above.
15. If you type in the command
nohup sort employees > list 2 > error out &
and log off ,the next time you log in, the output will be
a) in a file called list and the error will de typed in a file error out
b) there will be no file called list or error out
c) error will be logged in a file called list and o/p will be in error out
d) you will not be allowed to log in
e) none of the above
16. In UNIX a files i-node ......?
Ans. Is a data structure that defines all specifications of a file like the file size, number of lines to a file, permissions etc.

17. The UNIX shell ....
a) does not come with the rest of the system
b) forms the interface between the user and the kernal
c) does not give any scope for programming
d) deos not allow calling one program from with in another
e) all of the above Ans. (b)
18. enum number { a=-1, b= 4,c,d,e} What is the value of e ?
(a) 7
(b) 4
(c) 5
(d) 15
(e) 3
19. The very first process created by the kernal that runs till the kernal process is halts is
a) init
b) getty
c) both (a) and (b)
d) none of these Ans. (a)
20. Output of the following program is
main()
{int i=0;
for(i=0;i<20;i++)
{switch(i)
case 0:i+=5;
case 1:i+=2;
case 5:i+=5;
default i+=4;
break;}
printf("%d,",i);
}
}
a) 0,5,9,13,17
b) 5,9,13,17
c) 12,17,22
d) 16,21
e) Syntax error Ans. (d)
21. What is the ouptut in the following program
main()
{char c=-64;int i=-32; unsigned int u =-16;
if(c>i) { printf("pass1,");
if(celse
printf("Fail2");
}
else
printf("Fail1);
if(iprintf("pass2");
else
printf("Fail2")
}
a) Pass1,Pass2
b) Pass1,Fail2
c) Fail1,Pass2
d) Fail1,Fail2
e) None of these Ans. (c)
22. In the process table entry for the kernel process, the process id value is
(a) 0
(b) 1
(c) 2
(d) 255
(e) it does not have a process table entry Ans. (a)
23. Which of the following API is used to hide a window
a) ShowWindow
b) EnableWindow
c) MoveWindow
d) SetWindowPlacement
e) None of the above Ans. (a)
24. What will the following program do?
void main()
{
int i;
char a[]="String";
char *p="New Sring";
char *Temp;
Temp=a;
a=malloc(strlen(p) + 1);
strcpy(a,p); //Line number:9//
p = malloc(strlen(Temp) + 1);
strcpy(p,Temp);
printf("(%s, %s)",a,p);
free(p);
free(a);
} //Line number 15//
a) Swap contents of p & a and print:(New string, string)
b) Generate compilation error in line number 8
c) Generate compilation error in line number 5
d) Generate compilation error in line number 7
e) Generate compilation error in line number 1 Ans. (b)
25. In the following code segment what will be the result of the function,
value of x , value of y
{unsigned int x=-1;
int y;
y = ~0; if(x == y)
printf("same");
else printf("not same");
}
a) same, MAXINT, -1
b) not same, MAXINT, -MAXINT
c) same , MAXUNIT, -1
d) same, MAXUNIT, MAXUNIT
e) not same, MAXINT, MAXUNIT Ans. (a)
26. PATH = /bin : /usr : /yourhome The file /bin/calender has the following line in it cal 10 1997
The file /yourhome/calender has the following line in it cal 5 1997 If the current directory is /yourhome and calender is executed
a) The calendar for May 1997 will be printed on screen
b) The calendar for Oct 1997 will be printed on screen
c) The calendar for the current month( whatever it is) will be printed
d) Nothing will get printed on screen
e) An error massage will be printed
27. What will be the result of the following program ?
char *gxxx()
{static char xxx[1024];
return xxx;
}
main()
{char *g="string";
strcpy(gxxx(),g);
g = gxxx();
strcpy(g,"oldstring");
printf("The string is : %s",gxxx());
}
a) The string is : string
b) The string is :Oldstring
c) Run time error/Core dump
d) Syntax error during compilation
e) None of these Ans. (b)
28. What will be result of the following program?
void myalloc(char *x, int n)
{x= (char *)malloc(n*sizeof(char));
memset(x,\0,n*sizeof(char));
}
main()
{char *g="String";
myalloc(g,20);
strcpy(g,"Oldstring");
printf("The string is %s",g);
}
a) The string is : String
b) Run time error/Core dump
c) The string is : Oldstring
d) Syntax error during compilation
e) None of these
29. Which of the following function is used to repaint a window immediately
a) Sendmessage(hWnd,WM_PAINt,......)
b) InvalidateRect(.......)
c) MoveWindow
d) WM_COPY
e) None
30. Which function is the entry point for a DLL in MS Windows 3.1
a) Main
b) Winmain
c) Dllmain
d) Libmain
e) None Ans. (b)
31. The standard source for standard input, standard output and standard error is
a) the terminal
b) /dev/null
c) /usr/you/input, /usr/you/output/, /usr/you/error respectively
d) None Ans. (a)
32. What will be the result of the following program?
main()
{char p[]="String";
int x=0;
if(p=="String")
{printf("Pass 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
else
{
printf("Fail 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
}
a) Pass 1, Pass 2
b) Fail 1, Fail 2
c) Pass 1, Fail 2
d) Fail 1, Pass 2
e) syntax error during compilation
33. Which of the choices is true for the mentioned declaration ?
const char *p;
and
char * const p;
a) You can't change the character in both
b) First : You can't change the characterr & Second : You can;t change the pointer
c) You can't change the pointer in both
d) First : You can't change the pointer & Second : You can't chanage the character
e) None
34. The redirection operators > and >>
a) do the same function
b) differ : > overwrites, while >> appends
c) differ : > is used for input while >> is used for output
d) differ : > write to any file while >> write only to standard output
e) None of these Ans. (b)
35. The command grep first second third /usr/you/myfile
a) prints lines containing the words first, second or third from the file /usr/you/myfile
b) searches for lines containing the pattern first in the files
second, third, and /usr/you/myfile and prints them
c) searches the files /usr/you/myfiel and third for lines containing the words first or second and prints them
d) replaces the word first with the word second in the files third and /usr/you/myfile
e) None of the above Ans. (b)

(TCS Papers1)
VERBAL SECTION
Directions for questions 1-15:Find the synonyms of the following words
1. Merry Ans. Gay,Happy
2. Alienate Ans. Estrange
3. Solicit Ans. To request
4.Heap Ans. To pile
5.Cargo Ans. Freight
6.Momentary Ans. Transient
7. Volume Ans.Quantity
8.Veer Ans.Diverge
9.Dispel Ans.Dissipate
10.Admonish Ans.Cautious
11.Meager Ans.Scanty
12.Latitude Ans.Scope
13.Latent Ans.Potential
14.Covet Ans.Crave
15.Discretion Ans. Prudence
QUANTITATIVE SECTION
1. If two pencils cost 8 cents, then how much do 5 pencils cost? Ans. 20 cents
2. Some work is done by two people in 24 minutes. One of them can do this work alone in 40 minutes. How much time does the second person take to do the same work ? Ans. 60 minutes
3. A car is filled with four and half gallons of fuel for a round trip.If the amount of fuel taken while going is 1/4 more than the amount taken for coming, what is the amount of fuel consumed while coming back? Ans.2 gallons
4. The lowest temperature in the night in a city A is 1/3 more than 1/2 the highest during the day. Sum of the lowest temperature and the highest temperature is 100 degrees. Then what is the low temp? Ans.40 degrees
5. Javagal, who decided to go to weekened trip should not exceed 8 hours driving in a day. The average speed of forward journey is 40 miles/hr.Due to traffic on sundays, the return journey's average speed is 30 m/h. How far he can select a picnic spot?
a) 120 miles
b) between 120 and 140 miles
c) 160 miles Ans. 120 miles
6. A salesperson by mistake multiplied a number and got the answer as 3, instead of dividing the number by 3.What is the answer he should have actually got? Ans. 3
7. A building with height D shadow upto G. What is the height of a neighbouring building with a shadow of C feet. Ans. (C*D)/G
8. A person was fined for exceeding the speed limit by 10 mph. Another person was also fined for exceeding the same speed limit by twice the same. If the second person was travelling at a speed of 35 mph, find the speed limit. Ans. 15 mph
9. A bus started from bustand at 8.00am, and after staying for 30 minutes at a destination, it returned back to the busstand. The destination is 27 miles from the busstand. The speed of the bus is 18mph. During the return journey bus travels with 50% faster speed.At what time does it return to the busstand? Ans. 11.00am
10. In a mixture, R is 2 parts and S is 1 part. In order to make S to 25% of the mixture, how much of R is to be added? Ans.One part of R
11. Wind flows 160 miles in 330 min, for travelling 80 miles how much time does it require?
Ans. 2 hrs 45 mins
12. With a 4/5 full tank a vehicle can travel 12 miles, how far can it travel with a 1/3 full tank
Ans. 5 miles
13. There are two trees in a lawn. One grows at a rate 3/5 of the other in 4 years. If the total growth of trees is 8 ft. What is the height of the smaller tree after 2 years
Ans. 1 1/2 feet
14. Refer to the figure below.A ship started from P and moves at a speed of I miles per hour and another ship starts from L and moving with H miles per hour simultaneously.Where do the two ships meet? ||---g---||---h---||---i---||---j---||---k---||---l---||
PG H I J K L are the various stops in between denoted by || . The values g, h, i, j, k, l denote the distance between the ports. Ans. Between I and J, closer to J
15. If A is travelling at 72 km per hour on a highway. B is travelling at a speed of 25 meters per second on a highway. What is the difference in their speeds in m/sec. Ans. 1 m/sec

CRITICAL REASONING SECTION
Directions: Answer the questions given below the passage as true, false or can't say.
PASSAGE A: My father has no brothers. He has three sisters who has two childs each.
Answer 1-5 based on the passage A
1.My grandfather has two sons . Ans. False
2. Three of my aunts have two sons Ans. Can't say
3. My father is only child to his father Ans. False
4. I have six cousins from my mother side Ans. Can't say
5. I have one uncle Ans. Can't say(uncle can be from the mother's side as well)
PASSAGE B: Ether injected into gallablader to dissolve colestrol based gallstones. This type one day treatment is enough for gallstones not for calcium stones. This method is alternative to surgery for millions of people who are suffering from this disease.
Answer questions 6-9 based on passage B
6.Calcium stones can be cured in oneday Ans. False
7. Hundreds of people contains calcium stones Ans. Can't say
8. Surgery is the only treatment to calcium stones Ans. True
9. Ether will be injected into the gallbleder to cure the cholestrol based gall stones
Ans. True
PASSAGE C: Hacking is illegal entry into another computer. This happens mostly because of lack of knowledge of computer networking. With networks one machine can access to another machine.Hacking go about without knowing that each network is accredited to use network facility.
Answer questions 10-12 based on passage B
10. Hackers never break the code of the company which they work for Ans. Can't say
11. Hacking is the only vulnerability of the computers for the usage of the data Ans. False
12.Hacking is done mostly due to the lack of computer knowledge Ans. False
PASSAGE C: Alphine tunnels are closed tunnels.In the past 30 yrs not even a single accident has been recorded for there is one accident in the rail road system. Even in case of a fire accident it is possible to shift the passengers into adjacent wagons and even the live fire can be detected and extinguished with in the duration of 30 min.
Answer questions 13-16 based on passage C
13. No accident can occur in the closed tunnels Ans. True
14. Fire is allowed to live for 30 min Ans. False
16. All the care that travel in the tunnels will be carried by rail shutters. Ans.True
PASSAGE D: In the past helicopters were forced to ground or crash because of the formation of the ice on the rotors and engines. A new electronic device has been developed which can detect the watercontent in the atmosphere and warns the pilot if the temperature is below freezing temperature about the formation of the ice on the rotors and wings.
Answer questions 17-20 based on passage D
17.The electronic device can avoid formation of the ice on the wings Ans.False
18. There will be the malfunction of rotor & engine because of formation of ice Ans.True
19. The helicopters were to be crashed or grounded Ans.True
20. There is only one device that warn about the formation of ice Ans.True

PASSAGE E:In the survey conducted in mumbai out of 63 newly married house wives not a single house wife felt that the husbands should take equal part in the household work as they felt they loose their power over their husbands. Inspite of their careers they opt to do the kitchen work themselves after coming back to home. the wives get half as much leisure time as the husbands get at the week ends.
Answer questions 21-23 based on passage E
21.Housewives want the husbands to take part equally in the household Ans.False
22. Wives have half as much leisure time as the husbands have Ans. False
23. 39% of the men will work equally in the house in cleaning and washing Ans. False
PASSAGE F:Copernicus is the intelligent. In the days of copernicus the transport and technology development was less & it took place weeks to comunicate a message at that time,wherein we can send it through satellite with in no time.Even with this fast developments it has become difficult to understand each other.
Answer questions 24-27 based on passage F
24. People were not intelligent during Copernicus days Ans.False
25. Transport facilities are very much improved in noe a days Ans.Can't say
26. Even with the fast developments of the techonology we can't live happily. Ans. Can't say
27.We can understand the people very much with the development of communication Ans.False.
PASSAGE G:Senior managers warned the workers that because of the intfoductors of japanese industry in the car market. There is the threat to the workers.They also said that there will be the reduction in the purchase of the sales of car in public.the interest rates of the car will be increased with the loss in demand.
Answer questions 28-31 based on passage G
28. Japanese workers are taking over the jobs of indian industry. Ans.False
29.Managers said car interests will go down after seeing the raise in interest rates. Ans.True
30. Japanese investments are ceasing to end in the car industry. Ans. False
31. People are very interested to buy the cars. Ans.False
PASSAGE H:In the totalitariturican days,the words have very much devalued.In the present day,they are becoming domestic that is the words will be much more devalued. In that days, the words will be very much effected in political area.but at present,the words came very cheap .We can say they come free at cost.
Answer questions 32-34 based on passage H
32.Totalitarian society words are devalued. Ans.False
33. Totalitarians will have to come much about words Ans.True
34. The art totalitatian society the words are used for the political speeches. Ans. False
PASSAGE I:There should be copyright for all arts. The reele has came that all the arts has come under one copy right society,they were use the money that come from the arts for the developments . There may be a lot of money will come from the Tagore works. We have to ask the benifiters from Tagore work to help for the development of his works.
Answer questions 35-39 based on passage I
35. Tagore works are came under this copy right rule. Ans. False
36. People are free to go to the public because of the copy right rule. Ans.Can't say
38. People gives to theater and collect the money for development. Ans.Can't say
39. We have ask the Tagore resedents to help for the developments of art. Ans.Can't say
PYSCHOMETERIC TEST
You don't need to fret much about this test. This test consists of 150 questions and is just a pyshcology test which should be answered confidently and doesn't require any preparation.One must try being consistent while answering as the same questions are repeatedly asked in different forms.Also one must answer all questions.Questions are of yes,no or can't say kind.
1. Will you be interested in social activities.
2. While going upstairs do you move two steps at a time.
3. Can you make friends with people of the same sex or with opposite sex also
4. Your friends consider you as a leader in your group
5. People think that your'e serious minded.
6. There are times you feel dull without any reason.
7. You host several parties
8. When relatives come to your house do you entertain them.
9. You can work for long hours without tireness.
10. In your company you want to lead the organisation.

(TCS Papers2)
VERBAL SECTION
Directions for questions 1-15:Find the synonyms of the following words
1. Depreciation Ans. Deflation, Depression, Devaluation, fall, slump in value
2. Deprecate Ans. Feel and express disapproval of
3. Incentive Ans. Thing one encourages a person to do something
4. Echelon Ans. Level of authority or responsibility
5. Innovation Ans.To make changes or introduce new things
6. Intermittant Ans. Externally stopping and then starting
7. Detrimental Ans.Harmful
8. Aberration Ans. Deviation
9. Conciliation Ans.To make less angry or more friendly
10. Orthodox Ans.Conventional or superstitious
11. Fallible Ans.Liable to err
12. Volatile Ans.Ever changing
13. Manifestion Ans.Clear or obvious
14. Connotation Ans. Suggest in addition to the fundamental meaning
15. Reciprocal Ans. Reverse, Opposite

QUANTITATIVE SECTION
1. There are 150 weights .Some are 1 kg weights and some are 2 kg weights. The sum of the weights is 260.What is the number of 1kg weights? Ans. 40
2. A is driving on a highway when the police fines him for overspeeding and exceeding the limit by 10 km/hr.At the same time B is fined for overspeeding by twice the amount by which A exceeded the limit.If he was driving at 35 km/hr what is the speed limit for the road? Ans. 15 kmph
3. A moves 3 kms east from his starting point . He then travels 5 kms north. From that point he moves 8 kms to the east.How far is A from his starting point? Ans. 13 kms
4. A car travels 12 kms with a 4/5th filled tank.How far will the car travel with 1/3 filled tank? Ans. 5 kms
5. The sum of the digits of a two digit number is 8. When 18 is added to the number, the digits are reversed. Find the number? Ans. 35
6. The cost of one pencil, two pens and four erasers is Rs.22 while the cost of five pencils, four pens and two erasers is Rs.32.How much will three pencils, three pens and three erasers cost? Ans. 27
7. Fathers age is 5 times his son's age. 4 years back the father was 9 times older than son.Find the fathers' present age. Ans. 40 years
8. What number should be added to or subtracted from each term of the ratio 17 : 24 so that it becomes equal to 1 : 2. Ans. 10 should be subtracted
9. What is the 12th term of the series 2, 5, 8, .... Ans. 35
10. If 20 men take 15 days to to complete a job, in how many days can 25 men finish that work? Ans. 12 days
11. In a fraction, if 1 is added to both the numerator at the denominator, the fraction becomes 1/2. If numerator is subtracted from the denominator, the fraction becomes 3/4. Find the fraction. Ans. 3/7
12. If Rs.1260 is divided between between A, B and C in the ratio 2:3:4, what is C's share? Ans. Rs. 560
13. A shopkeeper bought a watch for Rs.400 and sold it for Rs.500.What is his profit percentage? Ans. 25%
14. What percent of 60 is 12? Ans. 20%
15. Hansie made the following amounts in seven games of cricket in India: Rs.10, Rs.15, Rs.21, Rs.12, Rs.18, Rs.19 and Rs.17(all figures in crores of course).Find his average earnings. Ans. Rs.16 crore



No comments: