One of my friend gone through the HCL Technologies, Noida written test for JAVA Technology. He remembered some of the questions from test and i am posting here to help the job seekers.
If any one else gone though the test and want to add some more questions, Please add through comments.
My friend forgot some of questions , so i just given a hint.
Question: what will be the output of the following program?
int i;
for(x=0;x<14;x++)
{
if(x<10)
{
system.out.println("value is: " + (i+x));
}
}
a. i is not initialized
b. if statement is false
c. both a and b is true
d. none of these
Ans. Find out.
Question 2:
int i = 1;
system.out.println("value is: " + i+2 + “3”);
Answer: 33
Question 3: What is difference between assignment and initialization?
Answer: in assignment we assign the value to initialize variable while in initialization we allocate the memory.
Question 4: What is difference between argument and parameters?
Answer: parameters are in calling function and arguments are in called function.
Question 5: What is use of finally keyword in exception handling?
Answer: finally block will always execute.
Question 6: what is use of garbage collector?
Answer: to release the memory after execution.
Question 7: A code was given and options were:
a. run time error.
b. compile time error
c. both a and b
d. none of these
Question 8: What is interface?
Answer: contains the prototype of functions.
Question 9: One ques on abstract class , can abstract class be the sub class of any concrete class?
Answer: find out.
Question 10: Difference between abstract class and interface?
Answer: interface only contains the prototype of function and abstract class can have abstract methods and full methods.
Question 11: difference between string and array?
Answer: string is internally char array while array an have int , float char etc.
Question 12: A question on thread?
Question 13: A question on synchronization?
Answere for Question 2 is 123.
ReplyDeleteand if it is like Sysout("value" + (i+1) + "3");
then answere is 33
Thanks Rajat,
ReplyDeleteI do not have java compiler so i am not able to verify the answer. I request all of you to kindly verify at your end.