hybris tech screening

Please finish the quiz in 30-40 minutes
1. Which methods are utilized to control the access to an object in multi threaded programming?
Asynchronized methods
Synchronized methods
Serialized methods
None of above
2. Constructor has return type
TRUE
FALSE
3. Which of the following is a valid declaration of an object of class Box?
Box obj = new Box();
Box obj = new Box;
obj = new Box();
new Box obj;
4. Which of the following statements is correct?
Public method is accessible to all other classes in the hierarchy
Public method is accessible only to subclasses of its parent class
Public method can only be called by object of its class.
Public method can be accessed by calling object of the public class.
5. Which cannot directly cause a thread to stop executing?
Calling the SetPriority() method on a Thread object.
Calling the wait() method on an object.
Calling notify() method on an object.
Calling read() method on an InputStream object.
6.  three guarantee that a thread will leave the running state?
1. yield()
2. wait()
3. notify()
4. notifyAll()
5. sleep(1000)
6. aLiveThread.join()
7. Thread.killThread()
1, 2 and 4
2, 5 and 6
3, 4, and 7
4, 5 and 7
7. public void test(int x)
{         
    int odd = 1;         
    if(odd)         
    {                
        System.out.println("odd");         
    }         
    else        
    {                
        System.out.println("even");         
    } 
}

Which statement is true?
Compilation fails.
odd will always be output.
even will always be output.
odd will be output for odd values of x, and "even" for even values.

8.

public class While 
{
    public void loop() 
    {
        int x= 0;
        while ( 1 ) /* Line 6 */
        {
            System.out.print("x plus one is " + (x + 1)); /* Line 8 */
        }
    }
}    

Which statement is true?

There is a syntax error on line 1.
There are syntax errors on lines 1 and 6.
There are syntax errors on lines 1, 6, and 8.
There is a syntax error on line 6.

9. 

class Bar { } 
class Test 
{  
    Bar doBar() 
    {
        Bar b = new Bar(); /* Line 6 */
        return b; /* Line 7 */
    } 
    public static void main (String args[]) 
    { 
        Test t = new Test();  /* Line 11 */
        Bar newBar = t.doBar();  /* Line 12 */
        System.out.println("newBar"); 
        newBar = new Bar(); /* Line 14 */
        System.out.println("finishing"); /* Line 15 */
    } 
}

At what point is the Bar object, created on line 6, eligible for garbage collection?

after line 12
after line 14
after line 7, when doBar() completes
after line 15, when main() completes

10. 

try 

    int x = 0; 
    int y = 5 / x; 

catch (Exception e) 
{
    System.out.println("Exception"); 

catch (ArithmeticException ae) 
{
    System.out.println(" Arithmetic Exception"); 

System.out.println("finished");    

What will be the output of the program?    

finished
Exception
Compilation fails
Arithmetic Exception
11.  You want subclasses in any package to have access to members of a superclass. Which is the most restrictive access that accomplishes this objective?
public
private
protected
transient

12. 

interface Base 
{
    boolean m1 ();
    byte m2(short s);
}    
    
which two code fragments will compile?    
1.    interface Base2 implements Base {}
2.    abstract class Class2 extends Base { public boolean m1() { return true; }}
3.    abstract class Class2 implements Base {}
4.    abstract class Class2 implements Base { public boolean m1() { return (7 > 4); }}
5.    abstract class Class2 implements Base { protected boolean m1() { return (5 > 7) }}

1 and 2
2 and 3
3 and 4
1 and 5
13.  Suppose that you would like to create an instance of a new Map that has an iteration order that is the same as the iteration order of an existing instance of a Map. Which concrete implementation of the Map interface should be used for the new instance?
TreeMap
HashMap
LinkedHashMap
The answer depends on the implementation of the existing instance.
14. You need to store elements in a collection that guarantees that no duplicates are stored and all elements can be accessed in natural order. Which interface provides that capability?
java.util.Map
java.util.Set
java.util.List
java.util.Collection
15. Which is valid declaration of a float?
float f = 1F;
float f = 1.0;
float f = "1";
float f = 1.0d;
16. Which is true about an anonymous inner class?
It can extend exactly one class and implement exactly one interface.
It can extend exactly one class and can implement multiple interfaces.
It can extend exactly one class or implement exactly one interface.
It can implement multiple interfaces regardless of whether it also extends a class.
17. A UML Class Diagram does not sufficiently describe an OO system because:
It does not show interfaces
It does not show composition
It does not show class relationships
It is a static diagram
18. The difference between aggregation and composition is:
They are both the same
Composition is an "owning" relationship
Aggregation is an "owning" relationship
Composition groups like objects, aggregation groups family's of objects
19. Java 5 Generics:
Ensure compile-time type safety
Ensure compile and runtime type safety
Have nothing to do with type safety
Are useful only for Java collections
20. What is the most significant cause of concern for Java Annotations?
You cannot create your own annotations
They cause additional classes to be loaded, slowing performance
The represent a tight coupling
There are no significant drawbacks
21. NoSql database performance can be restricted by:
Access via services, which are slower than direct calls .
The CAP theorum
The DAP theorum
Both c and d.
22. Cloud computing:
is always hosted by a third party like Amazon, Google or Rackspace
requires NoSQL databases
cannot be used to host Java Web Applications
achieves economy of scale

22题 | 被引用2次

使用此模板创建