Home »» Placement Papers »» All Papers »» HCL »» Placement Paper

C++/ Java Interview Questions - HCL


C++/ Java Interview Questions - HCL (01-3-2012)

1. Which of the statement will print the incorrect string, which says that, sum is equal to 10 and total is less than 20: 

a) if( (sum = 10) && (total < 20) )printf(“%d”, value);
b) if( (sum == 10) && (total < 20) )printf(“%d”, value);
c) if( (sum == 10) ¦¦ (total < 20) )printf(“%d”, value);
d) None of these options

2. What is the time taken to insert an element pointer inside a link list? 

a) O(log2n) 
b) O(n) 
c) O(1) 
d) O(n log2n)

3. What is the design methodology is used to write Object Oriented Programs? 

a) Declare - Define - Use 
b) Public functions and private variables 
c) Top - Down programming 
d) Bottom - Up programming

4. What is the element without which a recursive function would result in infinite recursion?

a) Base case 
b) Recursive call 
c) Subtraction 
d) Local variable declarations

5. _________is a relationship 

a) Polymorphism 
b) Inheritance 
c) Overloading 
d) None of these options

6. Abstract class cannot have ________

a) Zero instance. 
b) Multiple instance. 
c) Both Zero instance & Multiple instance. 
d) None of these options

7. What is the output of the following program?
printf(+7"%c","sundaram"); ?
a) sundaram
b) Garbage value
c) ASCII value
d) Error
e) None of these

8. Write a program that shows post and pre increment?
9. Which sorting method is optimum even in worst case?

a) Quick b) Insert c) Merge d) Bubble 

10. What is the use of garbage collector in JAVA?
11. Write a program to make reversing of a given array?


Comment

0 Answers