Interview Questions on vlsi

Embed Size (px)

Citation preview

  • 8/23/2019 Interview Questions on vlsi

    1/87

    INTERVIEW QUESTIONS IN C++

    1. What is encapsulation??A. Containing and hiding information about an object, such as internal datastructures and

    code. Encapsulation isolates the internal complexity of an object's operation fromthe restof the application. For example, a client component asking for net revenue from abusiness object need not know the data's origin.

    2. What is inheritance?A. Inheritance allows one class to reuse the state and behavior of another class.The derived class inherits the properties and method implementations of the baseclass and extends it by overriding methods and adding additional properties andmethods.

    3. What is Polymorphism?A. Polymorphism allows a client to treat different objects in the same way even ifthey were created from different classes and exhibit different behaviors. You canuse implementation inheritance to achieve polymorphism in languages such as C++ and Java. Base class object's pointer can invoke methods in derived classobjects. You can also achieve polymorphism in C++ by function overloading andoperator overloading.

    4. What is constructor or ctor?Constructor creates an object and initializes it. It also creates vtable for virtualfunctions. It is different from other methods in a class.

    5. What is destructor?Destructor usually deletes any extra resources allocated by the object.

    6. What is default constructor?Constructor with no arguments or all the arguments has default values.7. What is copy constructor?A. Constructor which initializes the it's object member variables ( by shallowcopying) with another object of the same class. If you don't implement one inyour class then compiler implements one for you.

    for example:Boo Obj1(10); // calling Boo constructorBoo Obj2(Obj1); // calling boo copy constructorBoo Obj2 = Obj1;// calling boo copy constructor8. When are copy constructors called?A. Copy constructors are called in following cases:a) when a function returns an object of that class by value

    1

  • 8/23/2019 Interview Questions on vlsi

    2/87

    b) when the object of that class is passed by value as an argument to a functionc) when you construct an object based on another object of the same classd) When compiler generates a temporary object9. What is assignment operator?

    A. Default assignment operator handles assigning one object to another of thesame class.Member to member copy (shallow copy)10. What are all the implicit member functions of the class? Or what are all thefunctions which compiler implements for us if we don't define one.??A. )default ctorB)copy ctorC)assignment operatorD)default destructorE)address operator

    11)What is conversion constructor?A. Constructor with a single argument makes that constructor as conversion ctorand it can be used for type conversion.for example:class Boo{public:Boo( int i );};Boo BooObject = 10 ; // assigning int 10 Boo object

    12. What is conversion operator?A. Class can have a public method for specific data type conversions.for example:class Boo{double value;public:Boo(int i )operator double(){return value;}};Boo BooObject;double i = BooObject; // assigning object to variable i of type double. nowconversionoperator gets called to assign the value.

    2

  • 8/23/2019 Interview Questions on vlsi

    3/87

    13. What is diff between malloc()/free() and new/delete?A. malloc allocates memory for object in heap but doesn't invoke object'sconstructor toinitiallize the object.new allocates memory and also invokes constructor to initialize the object.

    malloc() and free() do not support object semanticsDoes not construct and destruct objectsstring * ptr = (string *)(malloc (sizeof(string)))Are not safeDoes not calculate the size of the objects that it constructReturns a pointer to voidint *p = (int *) (malloc(sizeof(int)));int *p = new int;Are not extensiblenew and delete can be overloaded in a class"delete" first calls the object's termination routine (i.e. its destructor) and then

    releases the space the object occupied on the heap memory. If an array of objectswascreated using new, then delete must be told that it is dealing with an array byprecedingthe name with an empty []:-Int_t *my_ints = new Int_t[10];...delete []my_ints;

    14. What is the diff between "new" and "operator new" ?A. "operator new" works like malloc.

    15. What is difference between template and macro??A. There is no way for the compiler to verify that the macro parameters are ofcompatibletypes. The macro is expanded without any special type checking.If macro parameter has a post incremented variable ( like c++ ), the increment isperformed two times. Because macros are expanded by the preprocessor, compilererror messages will refer to the expanded macro, rather than the macro definitionitself. Also, the macro will show up in expanded form during debugging.for example:Macro:#define min(i, j) (i < j ? i : j)template:templateT min (T i, T j){ return i < j ? i : j; }

    16. What are C++ storage classes?

    3

  • 8/23/2019 Interview Questions on vlsi

    4/87

    autoregisterstaticexternauto: the default. Variables are automatically created and initialized when they are

    defined and are destroyed at the end of the block containing their definition. Theyare not visible outside that blockregister: a type of auto variable. a suggestion to the compiler to use a CPU registerforperformancestatic: a variable that is known only in the function that contains its definition butisnever destroyed and retains its value between calls to that function. It exists fromthetime the program begins executionextern: a static variable whose definition and placement is determined when all

    object and library modules are combined (linked) to form the executable code file.It can be visible outside the file where it is defined.

    17. What are storage qualifiers in C++ ?A. They are..constvolatilemutable

    Const keyword indicates that memory once initialized, should not be altered by aprogram.

    volatile keyword indicates that the value in the memory location can be alteredeven though nothing in the program code modifies the contents. for example ifyou have a pointer to hardware location that contains the time, where hardwarechanges the value of this pointer variable and not the program. The intent of thiskeyword to improve the optimization ability of the compiler.

    mutable keyword indicates that particular member of a structure or class can bealtered even if a particular structure variable, class, or class member function isconstant.

    struct data{char name[80];mutable double salary;}const data MyStruct = { "Satish Shetty", 1000 }; //initlized by complierstrcpy ( MyStruct.name, "Shilpa Shetty"); // compiler error

    4

  • 8/23/2019 Interview Questions on vlsi

    5/87

    MyStruct.salaray = 2000 ; // complier is happy allowed

    18. What is reference ?A. reference is a name that acts as an alias, or alternative name, for a previouslydefined

    variable or an object. prepending variable with "&" symbol makes it as reference.forexample:int a;int &b = a;

    19. What is passing by reference?A. Method of passing arguments to a function which takes parameter of typereference. forexample:void swap( int & x, int & y )

    {int temp = x;x = y;y = x;}int a=2, b=3;swap( a, b );Basically, inside the function there won't be any copy of the arguments "x" and"y" instead they refer to original variables a and b. so no extra memory needed topass arguments and it is more efficient.

    20. When do use "const" reference arguments in function?a) Using const protects you against programming errors that inadvertently alterdata.b) Using const allows function to process both const and non-const actualarguments, while a function without const in the prototype can only accept nonconstant arguments.c) Using a const reference allows the function to generate and use a temporaryvariableappropriately.

    21. When are temporary variables created by C++ compiler?A. Provided that function parameter is a "const reference", compiler generatestemporaryvariable in following 2 ways.a) The actual argument is the correct type, but it isn't Lvaluedouble Cuberoot ( const double & num ){num = num * num * num;return num;

    5

  • 8/23/2019 Interview Questions on vlsi

    6/87

    }double temp = 2.0;double value = cuberoot ( 3.0 + temp ); // argument is a expression and not aLvalue;b) The actual argument is of the wrong type, but of a type that can be converted to

    thecorrect typelong temp = 3L;double value = cuberoot ( temp); // long to double conversion

    22. What is virtual function?A. When derived class overrides the base class method by redefining the samefunction, then if client wants to access redefined the method from derived classthrough a pointer from base class object, then you must define this function inbase class as virtual function.class parent

    {void Show(){cout

  • 8/23/2019 Interview Questions on vlsi

    7/87

    parent * parent_object_ptr = new child;parent_object_ptr->show() // calls child->show()

    23. What is pure virtual function? or what is abstract class?A. When you define only function prototype in a base class without and do the

    completeimplementation in derived class. This base class is called abstract class and clientwon'table to instantiate an object using this base class.You can make a pure virtual function or abstract class this way..class Boo{void foo() = 0;}Boo MyBoo; // compilation error

    24. What is Memory alignment??A. The term alignment primarily means the tendency of an address pointer valueto be a multiple of some power of two. So a pointer with two byte alignment has azero in the least significant bit. And a pointer with four byte alignment has a zeroin both the two least significant bits. And so on. More alignment means a longersequence of zero bits in the lowest bits of a pointer.

    25.What problem does the namespace feature solve?A. Multiple providers of libraries might use common global identifiers causing aname collision when an application tries to link with two or more such libraries.The namespace feature surrounds a library's external declarations with a uniquenamespace that eliminates the potential for those collisions.namespace [identifier] { namespace-body }A namespace declaration identifies and assigns a name to a declarative region.The identifier in a namespace declaration must be unique in the declarative regionin which it is used. The identifier is the name of the namespace and is used toreference itsmembers.

    26. What is the use of 'using' declaration?A. A using declaration makes it possible to use a name from a namespace withoutthe scope operator.

    27.What is an Iterator class?A. A class that is used to traverse through the objects maintained by a container

    7

  • 8/23/2019 Interview Questions on vlsi

    8/87

    class. There are five categories of iterators: input iterators, output iterators,forward iterators,bidirectional iterators, random access. An iterator is an entity that gives access tothecontents of a container object without violating encapsulation constraints. Access

    to thecontents is granted on a one-at-a-time basis in order. The order can be storageorder (as inlists and queues) or some arbitrary order (as in array indices) or according to some

    ordering relation (as in an ordered binary tree). The iterator is a construct, whichprovides an interface that, when called, yields either the next element in thecontainer, orsome value denoting the fact that there are no more elements to examine. Iteratorshide the details of access to and update of the elements of a container class.Something like a

    pointer.

    28. What is a dangling pointer?A. A dangling pointer arises when you use the address of an object after itslifetime is over. This may occur in situations like returning addresses of theautomatic variables from a function or using the address of the memory blockafter it is freed.

    29. What do you mean by Stack unwinding?A. It is a process during exception handling when the destructor is called for alllocalobjects in the stack between the place where the exception was thrown and whereit iscaught.

    30. Name the operators that cannot be overloaded??A. sizeof, ., .*, .->, ::, ?:

    31. What is a container class? What are the types of container classes?A. A container class is a class that is used to hold objects in memory or externalstorage. A container class acts as a generic holder. A container class has apredefined behavior and a well-known interface. A container class is a supportingclass whose purpose is to hide the topology used for maintaining the list of objectsin memory. When a container class contains a group of mixed objects, thecontainer is called a heterogeneous container; when the container is holding agroup of objects that are all the same, the container is called a homogeneous

    8

  • 8/23/2019 Interview Questions on vlsi

    9/87

    container.

    32. What is inline function??A. The __inline keyword tells the compiler to substitute the code within thefunction

    definition for every instance of a function call. However, substitution occurs onlyat thecompiler's discretion. For example, the compiler does not inline a function if itsaddressis taken or if it is too large to inline.

    33. What is overloading??A. With the C++ language, you can overload functions and operators.Overloading is the practice of supplying more than one definition for a givenfunction name in the same scope.- Any two functions in a set of overloaded functions must have different argument

    lists.- Overloading functions with argument lists of the same types, based on returntype alone,is an error.34. What is Overriding?A. To override a method, a subclass of the class that originally declared themethod mustdeclare a method with the same name, return type (or a subclass of that returntype), andsame parameter list.The definition of the method overriding is: Must have same method name. Must have same data type. Must have same argument list.Overriding a method means that replacing a method functionality in child class.To implyoverriding functionality we need parent and child classes. In the child class youdefine the same method signature as one defined in the parent class.

    35. What is "this" pointer?A. The this pointer is a pointer accessible only within the member functions of aclass,struct, or union type. It points to the object for which the member function iscalled.Static member functions do not have a this pointer.When a nonstatic member function is called for an object, the address of theobject ispassed as a hidden argument to the function. For example, the following functioncall

    9

  • 8/23/2019 Interview Questions on vlsi

    10/87

    myDate.setMonth( 3 );can be interpreted this way:setMonth( &myDate, 3 );The object's address is available from within the member function as the thispointer. It is

    legal, though unnecessary, to use the this pointer when referring to members ofthe class.36. What happens when you make call "delete this;" ?A. The code has two built-in pitfalls. First, if it executes in a member function foranextern, static, or automatic object, the program will probably crash as soon as thedeletestatement executes. There is no portable way for an object to tell that it wasinstantiatedon the heap, so the class cannot assert that its object is properly instantiated.Second,

    when an object commits suicide this way, the using program might not knowabout its demise.As far as the instantiating program is concerned, the object remains in scope andcontinues to exist even though the object did itself in. Subsequent dereferencingof the pointer can and usually does lead to disaster.You should never do this. Since compiler does not know whether the object wasallocated on the stack or on the heap, "delete this" could cause a disaster.

    37. How virtual functions are implemented C++?A. Virtual functions are implemented using a table of function pointers, called thevtable.There is one entry in the table per virtual function in the class. This table iscreated bythe constructor of the class. When a derived class is constructed, its base class isconstructed first which creates the vtable. If the derived class overrides any of thebaseclasses virtual functions, those entries in the vtable are overwritten by the derivedclassconstructor. This is why you should never call virtual functions from aconstructor: because the vtable entries for the object may not have been set up bythe derived class constructor yet, so you might end up calling base classimplementations of those virtual functions.

    38. What is name mangling in C++??A. The process of encoding the parameter types with the function/method nameinto a unique name is called name mangling. The inverse process is calleddemangling.For example Foo::bar(int, long) const is mangled as `bar__C3Fooil'.For a constructor, the method name is left out. That is Foo::Foo(int, long) const is

    10

  • 8/23/2019 Interview Questions on vlsi

    11/87

    mangledas `__C3Fooil'.

    39. What is the difference between a pointer and a reference?A. A reference must always refer to some object and, therefore, must always be

    initialized; pointers do not have such restrictions. A pointer can be reassigned topoint to different objects while a reference always refers to an object with which itwas initialized.

    40. How are prefix and postfix versions of operator++() differentiated?A. The postfix version of operator++() has a dummy parameter of type int. Theprefix version does not have dummy parameter.

    41. What is the difference between const char *myPointer and char *constmyPointer?A. Const char *myPointer is a non constant pointer to constant data; while char

    *constmyPointer is a constant pointer to non constant data.

    42. How can I handle a constructor that fails?A. throw an exception. Constructors don't have a return type, so it's not possible tousereturn codes. The best way to signal constructor failure is therefore to throw anexception.

    43. How can I handle a destructor that fails?A. Write a message to a log-file. But do not throw an exception.The C++ rule is that you must never throw an exception from a destructor that isbeingcalled during the "stack unwinding" process of another exception. For example, ifsomeone says throw Foo(), the stack will be unwound so all the stack framesbetween the throw Foo() and the } catch (Foo e) { will get popped. This is calledstack unwinding.During stack unwinding, all the local objects in all those stack frames aredestructed. Ifone of those destructors throws an exception (say it throws a Bar object), the C++runtime system is in a no-win situation: should it ignore the Bar and end up inthe } catch (Foo e){ where it was originally headed? Should it ignore the Foo and look for a } catch(Bar e) {handler? There is no good answer -- either choice loses information.So the C++ language guarantees that it will call terminate() at this point, andterminate()kills the process. Bang you're dead.

    11

  • 8/23/2019 Interview Questions on vlsi

    12/87

    44. What is Virtual Destructor?A. Using virtual destructors, you can destroy objects without knowing their type -the correct destructor for the object is invoked using the virtual functionmechanism. Note that destructors can also be declared as pure virtual functionsfor abstract classes.

    if someone will derive from your class, and if someone will say "new Derived",where"Derived" is derived from your class, and if someone will say delete p, where theactualobject's type is "Derived" but the pointer p's type is your class.Can you think of a situation where your program would crash without reachingthe breakpoint

    45. which you set at the beginning of main()?A. C++ allows for dynamic initialization of global variables before main() isinvoked. It is possible that initialization of global will invoke some function. If

    this function crashesthe crash will occur before main() is entered.

    46. Name two cases where you MUST use initialization list as opposed toassignment inconstructors.A. Both non-static const data members and reference data members cannot beassigned values; instead, you should use initialization list to initialize them.

    47. Can you overload a function based only on whether a parameter is a value or areference?A. No. Passing by value and by reference looks identical to the caller.

    48. What are the differences between a C++ struct and C++ class?A. The default member and base class access specifiers are different.The C++ struct has all the features of the class. The only differences are that astructdefaults to public member access and public base class inheritance, and a classdefaults tothe private access specifier and private base class inheritance.

    49. What does extern "C" int func(int *, Foo) accomplish?A. It will turn off "name mangling" for func so that one can link to code compiledby a Ccompiler.

    50. How do you access the static member of a class?A.

    12

  • 8/23/2019 Interview Questions on vlsi

    13/87

    ::

    51. What is multiple inheritance(virtual inheritance)? What are its advantages anddisadvantages?A. Multiple Inheritance is the process whereby a child can be derived from more

    than one parent class. The advantage of multiple inheritance is that it allows aclass to inherit thefunctionality of more than one base class thus allowing for modeling of complexrelationships. The disadvantage of multiple inheritance is that it can lead to a lotofconfusion(ambiguity) when two base classes implement a method with the samename.

    52. What are the access privileges in C++? What is the default access level?A. The access privileges in C++ are private, public and protected. The defaultaccess level assigned to members of a class is private. Private members of a class

    are accessible only within the class and by friends of the class. Protected membersare accessible by the class itself and it's sub-classes. Public members of a classcan be accessed by anyone.

    53. What is a nested class? Why can it be useful?A. A nested class is a class enclosed within the scope of another class. Forexample:// Example 1: Nested class//class OuterClass{class NestedClass{// ...};// ...};Nested classes are useful for organizing code and controlling access anddependencies.Nested classes obey access rules just like other parts of a class do; so, in Example1, ifNestedClass is public then any code can name it as OuterClass::NestedClass.Often nestedclasses contain private implementation details, and are therefore made private; in

    Example1, if NestedClass is private, then only OuterClass's members and friends can useNestedClass. When you instantiate as outer class, it won't instantiate inside class.

    13

  • 8/23/2019 Interview Questions on vlsi

    14/87

    54. What is a local class? Why can it be useful?A. local class is a class defined within the scope of a function -- any function,whether amember function or a free function. For example:// Example 2: Local class

    //int f(){class LocalClass{// ...};// ...};Like nested classes, local classes can be a useful tool for managing codedependencies.

    55. Can a copy constructor accept an object of the same class as parameter,instead of reference of the object?A. No. It is specified in the definition of the copy constructor itself. It shouldgenerate anerror if a programmer specifies a copy constructor with a first argument that is anobjectand not a reference.

    56. (From Microsoft) Assume I have a linked list contains all of the alphabetsfrom A to Z. I want to find the letter Q in the list, how does you perform thesearch to find the Q?57. How do you write a function that can reverse a linked-list? (Cisco System)void reverselist(void){if(head==0)return;if(head->next==0)return;if(head->next==tail){head->next = 0;tail->next = head;}else{node* pre = head;node* cur = head->next;node* curnext = cur->next;head->next = 0;

    14

  • 8/23/2019 Interview Questions on vlsi

    15/87

    cur->next = head;for(; curnext!=0; ){cur->next = pre;pre = cur;

    cur = curnext;curnext = curnext->next;}curnext->next = cur;}}

    58. How do you find out if a linked-list has an end? (i.e. the list is not a cycle)A. You can find out by using 2 pointers. One of them goes 2 nodes each time. Thesecond one goes at 1 nodes each time. If there is a cycle, the one that goes 2 nodeseach time will

    eventually meet the one that goes slower. If that is the case, then you will knowthe linked-list is a cycle.

    59. How can you tell what shell you are running on UNIX system?A. You can do the Echo $RANDOM. It will return a undefined variable if you arefrom the C-Shell, just a return prompt if you are from the Bourne shell, and a 5digit random numbers if you are from the Korn shell. You could also do a ps -land look for the shell with the highest PID.

    60. What is Boyce Codd Normal form?A. A relation schema R is in BCNF with respect to a set F of functionaldependencies if for all functional dependencies in F+ of the form a->b, where aand b is a subset of R, at least one of the following holds: a->b is a trivial functional dependency (b is a subset of a) a is a superkey for schema R

    61. Could you tell something about the Unix System Kernel?A. The kernel is the heart of the UNIX openrating system, its reponsible forcontrolling the computers resouces and scheduling user jobs so that each one getsits fair share ofresources.

    62. What is a Make file?A. Make file is a utility in Unix to help compile large programs. It helps by onlycompiling the portion of the program that has been changed

    63. How do you link a C++ program to C functions?A. By using the extern "C" linkage specification around the C functiondeclarations.

    15

  • 8/23/2019 Interview Questions on vlsi

    16/87

    64. Explain the scope resolution operator.A. Design and implement a String class that satisfies the following:

    Supports embedded nullsProvide the following methods (at least)ConstructorDestructorCopy constructorAssignment operatorAddition operator (concatenation)Return character at locationReturn substring at locationFind substringProvide versions of methods for String and for char* arguments

    65. Suppose that data is an array of 1000 integers. Write a single function call thatwill sort the 100 elements data [222] through data [321].Answer: quicksort ((data + 222), 100);

    66. What is a modifier?67. What is an accessor?68. Differentiate between a template class and class template.69. When does a name clash occur?70. Define namespace.71. What is the use of using declaration.72. What is an Iterator class?73. List out some of the OODBMS available.74. List out some of the object-oriented methodologies.75. What is an incomplete type?76. What is a dangling pointer?77. Differentiate between the message and method.78. What is an adaptor class or Wrapper class?79. What is a Null object?80. What is class invariant?81. What do you mean by Stack unwinding?82. Define precondition and post-condition to a member function.83. What are the conditions that have to be met for a condition to be an invariantof the class?84. What are proxy objects?85. Name some pure object oriented languages.86. Name the operators that cannot be overloaded.87. What is a node class?88. What is an orthogonal base class?89. What is a container class? What are the types of container classes?

    16

  • 8/23/2019 Interview Questions on vlsi

    17/87

    90. What is a protocol class?91. What is a mixin class?

    92. What is a concrete class?93. What is the handle class?

    94. What is an action class?95. When can you tell that a memory leak will occur?96. What is a parameterized type?97. Differentiate between a deep copy and a shallow copy?98. What is an opaque pointer?99. What is a smart pointer?100. What is reflexive association?101. What is slicing?102. What is name mangling?103. What are proxy objects?104. What is cloning?

    105. Describe the main characteristics of static functions.106. Will the inline function be compiled as the inline function always? Justify.107. Define a way other than using the keyword inline to make a function inline.108. How can a '::' operator be used as unary operator?109. What is placement new?

    17

  • 8/23/2019 Interview Questions on vlsi

    18/87

    UML

    1. What do you mean by analysis and design?2. What are the steps involved in designing?3. What are the main underlying concepts of object orientation?4. What do u meant by "SBI" of an object?5. Differentiate persistent & non-persistent objects?6. What do you meant by active and passive objects?7. What is meant by software development method?8. What do you meant by static and dynamic modeling?9. How to represent the interaction between the modeling elements?10. Why generalization is very strong?11. Differentiate Aggregation and containment?12. Can link and Association applied interchangeably?13. What is meant by "method-wars"?14. Whether unified method and unified modeling language are same or different?

    15. Who were the three famous amigos and what was their contribution to theobject community?16. Differentiate the class representation of Booch, Rumbaugh and UML?17. What is an USECASE? Why it is needed?18. Who is an Actor?19. What is guard condition?20. Differentiate the following notations?21. USECASE is an implementation independent notation. How will the designergive the implementation details of a particular USECASE to the programmer?22. Suppose a class acts an Actor in the problem domain, how to represent it inthe static

    model?23. Why does the function arguments are called as "signatures"?

    18

  • 8/23/2019 Interview Questions on vlsi

    19/87

    INTERVIEW QUESTIONS IN Java

    1. What is a transient variable?A. A transient variable is a variable that may not be serialized.

    2. Which containers use a border Layout as their default layout?A. The window, Frame and Dialog classes use a border layout as their defaultlayout.

    3. Why do threads block on I/O?A. Threads block on I/O (that is enters the waiting state) so that other threads mayexecute while the I/O Operation is performed.

    4. How are Observer and Observable used?A. Objects that subclass the Observable class maintain a list of observers. Whenan Observable object is updated it invokes the update() method of each of its

    observers to notify the observers that it has changed state. The Observer interfaceis implemented by objects that observe Observable objects.

    5. What is synchronization and why is it important?A. With respect to multithreading, synchronization is the capability to control theaccess of multiple threads to shared resources. Without synchronization, it ispossible for one thread to modify a shared object while another thread is in theprocess of using or updating that object's value. This often leads to significanterrors.

    6. Can a lock be acquired on a class?

    A. Yes, a lock can be acquired on a class. This lock is acquired on the class'sClass object.

    7. What's new with the stop(), suspend() and resume() methods in JDK 1.2?A. The stop(), suspend() and resume() methods have been deprecated in JDK 1.2.

    8. Is null a keyword?A. The null value is not a keyword.

    9. What is the preferred size of a component?A. The preferred size of a component is the minimum component size that will

    allow the component to display normally.

    10. What method is used to specify a container's layout?A. The setLayout() method is used to specify a container's layout.

    11. Which containers use a FlowLayout as their default layout?A. The Panel and Applet classes use the FlowLayout as their default layout.

    19

  • 8/23/2019 Interview Questions on vlsi

    20/87

    12. What state does a thread enter when it terminates its processing?A. When a thread terminates its processing, it enters the dead state.13. What is the Collections API?A. The Collections API is a set of classes and interfaces that support operationson collections of objects.

    14. which characters may be used as the second character of an identifier, but notas the first character of an identifier?A. The digits 0 through 9 may not be used as the first character of an identifier butthey may be used after the first character of an identifier.

    15. What is the List interface?A. The List interface provides support for ordered collections of objects.

    16. How does Java handle integer overflows and underflows?A. It uses those low order bytes of the result that can fit into the size of the type

    allowed by the operation.

    17. What is the Vector class?A. The Vector class provides the capability to implement a growable array ofobjects

    18. What modifiers may be used with an inner class that is a member of an outerclass?A. A (non-local) inner class may be declared as public, protected, private, static,final, or abstract.

    19. What is an Iterator interface?A. The Iterator interface is used to step through the elements of a Collection.

    20. What is the difference between the >> and >>> operators?A. The >> operator carries the sign bit when shifting right. The >>> zero-fills bitsthat have been shifted out.

    21. Which method of the Component class is used to set the position and size of acomponent?A. setBounds()

    22. How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8characters?A. Unicode requires 16 bits and ASCII require 7 bits. Although the ASCIIcharacter set uses only 7 bits, it is usually represented as 8 bits. UTF-8 representscharacters using 8, 16, and 18 bit patterns. UTF-16 uses 16-bit and larger bitpatterns.

    23 What is the difference between yielding and sleeping?

    20

  • 8/23/2019 Interview Questions on vlsi

    21/87

    A. When a task invokes its yield() method, it returns to the ready state. When atask invokes its sleep() method, it returns to the waiting state.

    24. Which java.util classes and interfaces support event handling?A. The EventObject class and the EventListener interface support event

    processing.

    25. Is sizeof a keyword?A. The sizeof operator is not a keyword.

    26. What are wrapper classes?A. Wrapper classes are classes that allow primitive types to be accessed asobjects.

    27. Does garbage collection guarantee that a program will not run out of memory?A. Garbage collection does not guarantee that a program will not run out of

    memory. It is possible for programs to use up memory resources faster than theyare garbage collected. It is also possible for programs to create objects that are notsubject to garbage collection.

    28. What restrictions are placed on the location of a package statement within asource code file?A. A package statement must appear as the first line in a source code file(excluding blank lines and comments).

    29. Can an object's finalize() method be invoked while it is reachable?A. An object's finalize() method cannot be invoked by the garbage collector whilethe object is still reachable. However, an object's finalize() method may beinvoked by other objects.

    30. What is the immediate superclass of the Applet class?A. Panel

    31. What is the difference between preemptive scheduling and time slicing?A. Under preemptive scheduling, the highest priority task executes until it entersthe waiting or dead states or a higher priority task comes into existence. Undertime slicing, a task executes for a predefined slice of time and then reenters thepool of ready tasks. The scheduler then determines which task should executenext, based on priority and other factors.

    32. Name three Component subclasses that support painting.A. The Canvas, Frame, Panel, and Applet classes support painting.

    33. What value does readLine() return when it has reached the end of a file?A. The readLine() method returns null when it has reached the end of a file.

    21

  • 8/23/2019 Interview Questions on vlsi

    22/87

    34. What is the immediate superclass of the Dialog class?A. Window.

    35. What is clipping?A. Clipping is the process of confining paint operations to a limited area or shape.

    36. What is a native method?A. A native method is a method that is implemented in a language other thanJava.

    37. Can a for statement loop indefinitely?A. Yes, a for statement can loop indefinitely. For example, consider thefollowing:for(;;) ;

    38. What are order of precedence and associativity, and how are they used?

    A. Order of precedence determines the order in which operators are evaluated inexpressions. Associatity determines whether an expression is evaluated left-to-right or right-to-left

    39. When a thread blocks on I/O, what state does it enter?A. A thread enters the waiting state when it blocks on I/O.

    40. To what value is a variable of the String type automatically initialized?A. The default value of a String type is null.

    41. What is the catch or declare rule for method declarations?A. If a checked exception may be thrown within the body of a method, themethod must either catch the exception or declare it in its throws clause.

    42. What is the difference between a MenuItem and a CheckboxMenuItem?A. The CheckboxMenuItem class extends the MenuItem class to support a menuitem that may be checked or unchecked.

    43. What is a task's priority and how is it used in scheduling?A. A task's priority is an integer value that identifies the relative order in which itshould be executed with respect to other tasks. The scheduler attempts to schedulehigher priority tasks before lower priority tasks.

    44. What class is the top of the AWT event hierarchy?A. The java.awt.AWTEvent class is the highest-level class in the AWT event-class hierarchy.

    45. When a thread is created and started, what is its initial state?A. A thread is in the ready state after it has been created and started.

    22

  • 8/23/2019 Interview Questions on vlsi

    23/87

    46. Can an anonymous class be declared as implementing an interface andextending a class?A. An anonymous class may implement an interface or extend a superclass, butmay not be declared to do both.

    47. What is the range of the short type?A. The range of the short type is -(2^15) to 2^15 - 1.

    48. What is the range of the char type?A. The range of the char type is 0 to 2^16 - 1.

    49. In which package are most of the AWT events that support the event-delegation model defined?A. Most of the AWT-related events of the event-delegation model are defined inthe java.awt.event package. The AWTEvent class is defined in the java.awtpackage.

    50. What is the immediate superclass of Menu?A. MenuItem

    51. What is the purpose of finalization?A. The purpose of finalization is to give an unreachable object the opportunity toperform any cleanup processing before the object is garbage collected.

    52. Which class is the immediate superclass of the MenuComponent class.A. Object

    53. What invokes a thread's run() method?A. After a thread is started, via its start() method or that of the Thread class, theJVM invokes the thread's run() method when the thread is initially executed.

    54. What is the difference between the Boolean & operator and the && operator?A. If an expression involving the Boolean & operator is evaluated, both operandsare evaluated. Then the & operator is applied to the operand. When an expressioninvolving the && operator is evaluated, the first operand is evaluated. If the firstoperand returns a value of true then the second operand is evaluated. The &&operator is then applied to the first and second operands. If the first operandevaluates to false, the evaluation of the second operand is skipped.

    55. Name three subclasses of the Component class.A. Box.Filler, Button, Canvas, Checkbox, Choice, Container, Label, List,Scrollbar, or TextComponent

    56. What is the GregorianCalendar class?A. The GregorianCalendar provides support for traditional Western calendars.

    23

  • 8/23/2019 Interview Questions on vlsi

    24/87

    57. Which Container method is used to cause a container to be laid out andredisplayed?A. validate()

    58. What is the purpose of the Runtime class?

    A. The purpose of the Runtime class is to provide access to the Java runtimesystem.

    59. How many times may an object's finalize() method be invoked by thegarbage collector?A. An object's finalize() method may only be invoked once by the garbagecollector.

    60. What is the purpose of the finally clause of a try-catch-finally statement?A. The finally clause is used to provide the capability to execute code no matter

    whether or not an exception is thrown or caught.

    61. What is the argument type of a program's main() method?A. A program's main() method takes an argument of the String[] type.

    62. Which Java operator is right associative?A. The = operator is right associative.

    63. What is the Locale class?A. The Locale class is used to tailor program output to the conventions of aparticular geographic, political, or cultural region.

    64. Can a double value be cast to a byte?A. Yes, a double value can be cast to a byte.

    65. What is the difference between a break statement and a continue statement?A. A break statement results in the termination of the statement to which it applies(switch, for, do, or while). A continue statement is used to end the current loopiteration and return control to the loop statement.

    66. What must a class do to implement an interface?A. It must provide all of the methods in the interface and identify the interface inits implements clause.

    67. What method is invoked to cause an object to begin executing as a separatethread?A. The start() method of the Thread class is invoked to cause an object to beginexecuting as a separate thread.

    68. Name two subclasses of the TextComponent class.

    24

  • 8/23/2019 Interview Questions on vlsi

    25/87

    A. TextField and TextArea

    69. What is the advantage of the event-delegation model over the earlier event-inheritance model?A. The event-delegation model has two advantages over the event-inheritance

    model. First, it enables event handling to be handled by objects other than theones that generate the events (or their containers). This allows a clean separationbetween a component's design and its use. The other advantage of the event-delegation model is that it performs much better in applications where manyevents are generated. This performance improvement is due to the fact that theevent-delegation model does not have to repeatedly process unhandled events, asis the case of the event-inheritance model.

    70. Which containers may have a MenuBar?A. Frame

    71. How are commas used in the initialization and iteration parts of a forstatement?A. Commas are used to separate multiple statements within the initialization anditeration parts of a for statement.

    72. What is the purpose of the wait(), notify(), and notifyAll() methods?A. The wait(),notify(), and notifyAll() methods are used to provide an efficientway for threads to wait for a shared resource. When a thread executes an object'swait() method, it enters the waiting state. It only enters the ready state afteranother thread invokes the object's notify() or notifyAll() methods.

    73. What is an abstract method?A. An abstract method is a method whose implementation is deferred to asubclass.

    74. How are Java source code files named?A. A Java source code file takes the name of a public class or interface that isdefined within the file. A source code file may contain at most one public class orinterface. If a public class or interface is defined within a source code file, thenthe source code file must take the name of the public class or interface. If nopublic class or interface is defined within a source code file, then the file musttake on a name that is different than its classes and interfaces. Source code filesuse the .java extension.

    75. What is the relationship between the Canvas class and the Graphics class?A. A Canvas object provides access to a Graphics object via its paint() method.

    76. What are the high-level thread states?A. The high-level thread states are ready, running, waiting, and dead.

    25

  • 8/23/2019 Interview Questions on vlsi

    26/87

    77. What value does read() return when it has reached the end of a file?A. The read() method returns -1 when it has reached the end of a file.

    78. Can a Byte object be cast to a double value?

    A. No, an object cannot be cast to a primitive value.

    79. What is the difference between a static and a non-static inner class?A. A non-static inner class may have object instances that are associated withinstances of the class's outer class. A static inner class does not have any objectinstances.

    80. What is the difference between the String and StringBuffer classes?A. String objects are constants. StringBuffer objects are not.

    81. If a variable is declared as private, where may the variable be accessed?

    A. A private variable may only be accessed within the class in which it isdeclared.

    82. What is an object's lock and which objects have locks?A. An object's lock is a mechanism that is used by multiple threads to obtainsynchronized access to the object. A thread may execute a synchronized methodof an object only after it has acquired the object's lock. All objects and classeshave locks. A class's lock is acquired on the class's Class object.

    83. What is the Dictionary class?A. The Dictionary class provides the capability to store key-value pairs.

    84. How are the elements of a BorderLayout organized?A. The elements of a BorderLayout are organized at the borders (North, South,East, and West) and the center of a container.

    85. What is the % operator?A. It is referred to as the modulo or remainder operator. It returns the remainderof dividing the first operand by the second operand.

    86. When can an object reference be cast to an interface reference?A. An object reference be cast to an interface reference when the objectimplements the referenced interface.

    87. What is the difference between a Window and a Frame?A. The Frame class extends Window to define a main application window thatcan have a menu bar.

    88. Which class is extended by all other classes?A. The Object class is extended by all other classes.

    26

  • 8/23/2019 Interview Questions on vlsi

    27/87

    89. Can an object be garbage collected while it is still reachable?A. A reachable object cannot be garbage collected. Only unreachable objects maybe garbage collected..

    90. Is the ternary operator written x : y ? z or x ? y : z ?A. It is written x ? y : z.

    91. What is the difference between the Font and FontMetrics classes?A. The FontMetrics class is used to define implementation-specific properties,such as ascent and descent, of a Font object.92. How is rounding performed under integer division?A. The fractional part of the result is truncated. This is known as rounding towardzero.

    93. What happens when a thread cannot acquire a lock on an object?

    A. If a thread attempts to execute a synchronized method or synchronizedstatement and is unable to acquire an object's lock, it enters the waiting state untilthe lock becomes available.

    94. What is the difference between the Reader/Writer class hierarchy and theInputStream/OutputStream class hierarchy?A. The Reader/Writer class hierarchy is character-oriented, and theInputStream/OutputStream class hierarchy is byte-oriented.

    95. What classes of exceptions may be caught by a catch clause?A. A catch clause can catch any exception that may be assigned to the Throwabletype. This includes the Error and Exception types.

    96. If a class is declared without any access modifiers, where may the class beaccessed?A. A class that is declared without any access modifiers is said to have packageaccess. This means that the class can only be accessed by other classes andinterfaces that are defined within the same package.

    97. What is the SimpleTimeZone class?A. The SimpleTimeZone class provides support for a Gregorian calendar.

    98. What is the Map interface?A. The Map interface replaces the JDK 1.1 Dictionary class and is used associatekeys with values.

    99. Does a class inherit the constructors of its superclass?A. A class does not inherit constructors from any of its super classes.

    100. For which statements does it make sense to use a label?

    27

  • 8/23/2019 Interview Questions on vlsi

    28/87

    A. The only statements for which it makes sense to use a label are thosestatements that can enclose a break or continue statement.

    101. What is the purpose of the System class?A. The purpose of the System class is to provide access to system resources.

    102. Which TextComponent method is used to set a TextComponent to the read-only state?A. setEditable()

    103. How are the elements of a CardLayout organized?A. The elements of a CardLayout are stacked, one on top of the other, like a deckof cards.

    104. Is &&= a valid Java operator?A. No, it is not.

    105. Name the eight primitive Java types.A. The eight primitive types are byte, char, short, int, long, float, double, andboolean.

    106. Which class should you use to obtain design information about an object?A. The Class class is used to obtain information about an object's design.

    107. What is the relationship between clipping and repainting?A. When a window is repainted by the AWT painting thread, it sets the clippingregions to the area of the window that requires repainting.

    108. Is "abc" a primitive value?A. The String literal "abc" is not a primitive value. It is a String object.

    109. What is the relationship between an event-listener interface and an event-adapter class?A. An event-listener interface defines the methods that must be implemented byan event handler for a particular kind of event. An event adapter provides adefault implementation of an event-listener interface.

    110. What restrictions are placed on the values of each case of a switchstatement?A. During compilation, the values of each case of a switch statement mustevaluate to a value that can be promoted to an int value.

    111. What modifiers may be used with an interface declaration?A. An interface may be declared as public or abstract.

    112. Is a class a subclass of itself?

    28

  • 8/23/2019 Interview Questions on vlsi

    29/87

    A. A class is a subclass of itself.

    113. What is the highest-level event class of the event-delegation model?A. The java.util.EventObject class is the highest-level class in the event-delegation class hierarchy.

    114. What event results from the clicking of a button?A. The ActionEvent event is generated as the result of the clicking of a button.

    115. How can a GUI component handle its own events?A. A component can handle its own events by implementing the required event-listener interface and adding itself as its own event listener.

    116. What is the difference between a while statement and a do statement?A. A while statement checks at the beginning of a loop to see whether the nextloop iteration should occur. A do statement checks at the end of a loop to see

    whether the next iteration of a loop should occur. The do statement will alwaysexecute the body of a loop at least once.

    117. How are the elements of a GridBagLayout organized?A. The elements of a GridBagLayout are organized according to a grid. However,the elements are of different sizes and may occupy more than one row or columnof the grid. In addition, the rows and columns may have different sizes.

    118. What advantage do Java's layout managers provide over traditionalwindowing systems?A. Java uses layout managers to lay out components in a consistent manner acrossall windowing platforms. Since Java's layout managers aren't tied to absolutesizing and positioning, they are able to accommodate platform-specificdifferences among windowing systems.

    119. What is the Collection interface?A. The Collection interface provides support for the implementation of amathematical bag - an unordered collection of objects that may contain duplicates.

    120. What modifiers can be used with a local inner class?A. A local inner class may be final or abstract.

    121. What is the difference between static and non-static variables?A. A static variable is associated with the class as a whole rather than withspecific instances of a class. Non-static variables take on unique values with eachobject instance.

    29

  • 8/23/2019 Interview Questions on vlsi

    30/87

    122. What is the difference between the paint() and repaint() methods?A. The paint() method supports painting via a Graphics object. The repaint()method is used to cause paint() to be invoked by the AWT painting thread.

    123. What is the purpose of the File class?

    A. The File class is used to create objects that provide access to the files anddirectories of a local file system.

    124. Can an exception be rethrown?A. Yes, an exception can be rethrown.

    125. Which Math method is used to calculate the absolute value of a number?A. The abs() method is used to calculate absolute values.

    126. How does multithreading take place on a computer with a single CPU?A. The operating system's task scheduler allocates execution time to multiple

    tasks. By quickly switching between executing tasks, it creates the impression thattasks execute sequentially.127. When does the compiler supply a default constructor for a class?A. The compiler supplies a default constructor for a class if no other constructorsare provided.

    128. When is the finally clause of a try-catch-finally statement executed?A. The finally clause of the try-catch-finally statement is always executed unlessthe thread of execution terminates or an exception occurs within the execution ofthe finally clause.

    129. Which class is the immediate superclass of the Container class?A. Component

    130. If a method is declared as protected, where may the method be accessed?A. A protected method may only be accessed by classes or interfaces of the samepackage or by subclasses of the class in which it is declared.

    131. How can the Checkbox class be used to create a radio button?A. By associating Checkbox objects with a CheckboxGroup.

    132. Which non-Unicode letter characters may be used as the first character of anidentifier?A. The non-Unicode letter characters $ and _ may appear as the first character ofan identifier

    133. What restrictions are placed on method overloading?A. Two methods may not have the same name and argument list but differentreturn types.

    30

  • 8/23/2019 Interview Questions on vlsi

    31/87

    134. What happens when you invoke a thread's interrupt method while it issleeping or waiting?A. When a task's interrupt() method is executed, the task enters the ready state.The next time the task enters the running state, an InterruptedException is thrown.

    135. What is casting?A. There are two types of casting, casting between primitive numeric types andcasting between object references. Casting between numeric types is used toconvert larger values, such as double values, to smaller values, such as bytevalues. Casting between object references is used to refer to an object by acompatible class, interface, or array type reference.

    136. What is the return type of a program's main() method?A. A program's main() method has a void return type.

    137. Name four Container classes.

    A. Window, Frame, Dialog, FileDialog, Panel, Applet, or ScrollPane.

    138. What is the difference between a Choice and a List?A. A Choice is displayed in a compact form that requires you to pull it down tosee the list of available choices. Only one item may be selected from a Choice. AList may be displayed in such a way that several List items are visible. A Listsupports the selection of one or more List items.

    139. What class of exceptions are generated by the Java run-time system?A. The Java runtime system generates RuntimeException and Error exceptions.

    140. What class allows you to read objects directly from a stream?A. The ObjectInputStream class supports the reading of objects from inputstreams.

    141. What is the difference between a field variable and a local variable?A. A field variable is a variable that is declared as a member of a class. A localvariable is a variable that is declared local to a method.

    142. Under what conditions is an object's finalize() method invoked by thegarbage collector?A. The garbage collector invokes an object's finalize() method when it detects thatthe object has become unreachable.

    143. How are this () and super () used with constructors?A. this() is used to invoke a constructor of the same class. super() is used toinvoke a superclass constructor.

    31

  • 8/23/2019 Interview Questions on vlsi

    32/87

    144. What is the relationship between a method's throws clause and theexceptions that can be thrown during the method's execution?A. A method's throws clause must declare any checked exceptions that are notcaught within the body of the method.

    145. What is the difference between the JDK 1.02 event model and the event-delegation model introduced with JDK 1.1?A. The JDK 1.02 event model uses an event inheritance or bubbling approach. Inthis model, components are required to handle their own events. If they do nothandle a particular event, the event is inherited by (or bubbled up to) thecomponent's container. The container then either handles the event or it is bubbledup to its container and so on, until the highest-level container has been tried.In the event-delegation model, specific objects are designated as event handlersfor GUI components. These objects implement event-listener interfaces. Theevent-delegation model is more efficient than the event-inheritance modelbecause it eliminates the processing required to support the bubbling of unhandled

    events.

    146. How is it possible for two String objects with identical values not to be equalunder the == operator?A. The == operator compares two objects to determine if they are the same objectin memory. It is possible for two String objects to have the same value, butlocated indifferent areas of memory.

    147. Why are the methods of the Math class static?A. So they can be invoked as if they are a mathematical code library.

    148. What Checkbox method allows you to tell if a Checkbox is checked?A. getState()

    149. What state is a thread in when it is executing?A. An executing thread is in the running state.

    150. What are the legal operands of the instanceof operator?A. The left operand is an object reference or null value and the right operand is aclass, interface, or array type.

    151. How are the elements of a GridLayout organized?A. The elements of a GridBad layout are of equal size and are laid out using thesquares of a grid.

    152. What an I/O filter?A. An I/O filter is an object that reads from one stream and writes to another,usually altering the data in some way as it is passed from one stream to another.

    32

  • 8/23/2019 Interview Questions on vlsi

    33/87

    153. If an object is garbage collected, can it become reachable again?A. Once an object is garbage collected, it ceases to exist. It can no longer becomereachable again.

    154. What is the Set interface?

    A. The Set interface provides methods for accessing the elements of a finitemathematical set. Sets do not allow duplicate elements.

    155. What classes of exceptions may be thrown by a throw statement?A. A throw statement may throw any expression that may be assigned to theThrowable type.

    156. What are E and PI?A. E is the base of the natural logarithm and PI is mathematical value pi.

    157. Are true and false keywords?

    A. The values true and false are not keywords.

    158. What is a void return type?A. A void return type indicates that a method does not return a value.

    159. What is the purpose of the enableEvents() method?A. The enableEvents() method is used to enable an event for a particular object.Normally, an event is enabled when a listener is added to an object for a particularevent. The enableEvents() method is used by objects that handle events byoverriding their event-dispatch methods.

    160. What is the difference between the File and RandomAccessFile classes?A. The File class encapsulates the files and directories of the local file system.The RandomAccessFile class provides the methods needed to directly access datacontained in any part of a file.

    161. What happens when you add a double value to a String?A. The result is a String object.162. What is your platform's default characterencoding?If you are running Java on English Windows platforms, it is probably Cp1252. Ifyou are running Java on English Solaris platforms, it is most likely 8859_1..

    163. Which package is always imported by default?A. The java.lang package is always imported by default.

    164. What interface must an object implement before it can be written to a streamas an object?A. An object must implement the Serializable or Externalizable interface before itcan be written to a stream as an object.

    33

  • 8/23/2019 Interview Questions on vlsi

    34/87

    165. How are this and super used?A. this is used to refer to the current object instance. super is used to refer to thevariables and methods of the superclass of the current object instance.

    166. What is the purpose of garbage collection?

    A. The purpose of garbage collection is to identify and discard objects that are nolonger needed by a program so that their resources may be reclaimed andreused.

    167. What is a compilation unit?A. A compilation unit is a Java source code file.

    168. What interface is extended by AWT event listeners?A. All AWT event listeners extend the java.util.EventListener interface.169. What restrictions are placed on method overriding?Overridden methods must have the same name, argument list, and return type.

    The overriding method may not limit the access of the method it overrides.The overriding method may not throw any exceptions that may not be thrownby the overridden method.

    170. How can a dead thread be restarted?A dead thread cannot be restarted.

    171. What happens if an exception is not caught?A. An uncaught exception results in the uncaughtException() method of thethread's ThreadGroup being invoked, which eventually results in the terminationof the program in which it is thrown.

    172. What is a layout manager?A. A layout manager is an object that is used to organize components in acontainer.

    173. Which arithmetic operations can result in the throwing of anArithmeticException?A. Integer / and % can result in the throwing of an ArithmeticException.

    174. What are three ways in which a thread can enter the waiting state?A. A thread can enter the waiting state by invoking its sleep() method, byblocking on I/O, by unsuccessfully attempting to acquire an object's lock, or byinvoking an object's wait() method. It can also enter the waiting state by invokingits(deprecated) suspend() method.

    175. Can an abstract class be final?A. An abstract class may not be declared as final.

    34

  • 8/23/2019 Interview Questions on vlsi

    35/87

    176. What is the ResourceBundle class?A. The Resource Bundle class is used to store locale-specific resources that can beloaded by a program to tailor the program's appearance to the particular locale inwhich it is being run.

    177. What happens if a try-catch-finally statement does not have a catch clause tohandle an exception that is thrown within the body of the try statement?A. The exception propagates up to the next higher level try-catch statement (ifany) or results in the program's termination.

    178. What is numeric promotion?A. Numeric promotion is the conversion of a smaller numeric type to a largernumeric type, so that integer and floating-point operations may take place. Innumerical promotion, byte, char, and short values are converted to int values. Theint values are also converted to long values, if necessary. The long and floatvalues are converted to double values, as required.

    179. What is the difference between a Scrollbar and a ScrollPane?A. A Scrollbar is a Component, but not a Container. A ScrollPane is a Container.A ScrollPane handles its own events and performs its own scrolling.

    180. What is the difference between a public and a non-public class?A. A public class may be accessed outside of its package. A non-public class maynot be accessed outside of its package.

    181. To what value is a variable of the boolean type automatically initialized?A. The default value of the boolean type is false.

    182. Can try statements be nested?A. Try statements may be tested.

    183. What is the difference between the prefix and postfix forms of the ++operator?A. The prefix form performs the increment operation and returns the value of theincrement operation. The postfix form returns the current value all of theexpression and then performs the increment operation on that value.

    184. What is the purpose of a statement block?A. A statement block is used to organize a sequence of statements as a singlestatement group.

    185. What is a Java package and how is it used?A. A Java package is a naming context for classes and interfaces. A package isused to create a separate name space for groups of classes and interfaces.Packages are also used to organize related classes and interfaces into a single APIunit and to control accessibility to these classes and interfaces.

    35

  • 8/23/2019 Interview Questions on vlsi

    36/87

    186. What modifiers may be used with a top-level class?A. A top-level class may be public, abstract, or final.

    187. What are the Object and Class classes used for?

    A. The Object class is the highest-level class in the Java class hierarchy. TheClass class is used to represent the classes and interfaces that are loaded by a Javaprogram.

    188. How does a try statement determine which catch clause should be used tohandle an exception?A. When an exception is thrown within the body of a try statement, the catchclauses of the try statement are examined in the order in which they appear. Thefirst catch clause that is capable of handling the exception is executed.The remaining catch clauses are ignored.

    189. Can an unreachable object become reachable again?A. An unreachable object may become reachable again. This can happen when theobject's finalize() method is invoked and the object performs an operation whichcauses it to become accessible to reachable objects.190. When is an object subjectto garbage collection?A. An object is subject to garbage collection when it becomes unreachable to theprogram in which it is used.

    191. What method must be implemented by all threads?A. All tasks must implement the run() method, whether they are a subclass ofThread or implement the Runnable interface.

    192. What methods are used to get and set the text label displayed by a Buttonobject?A. getLabel() and setLabel()

    193. Which Component subclass is used for drawing and painting?A. Canvas

    194. What are synchronized methods and synchronized statements?A. Synchronized methods are methods that are used to control access to an object.A thread only executes a synchronized method after it has acquired the lock forthe method's object or class. Synchronized statements are similar to synchronizedmethods. A synchronized statement can only be executed after a thread hasacquired the lock for the object or class referenced in the synchronized statement.

    195. What are the two basic ways in which classes that can be run as threads maybe defined?A. A thread class may be declared as a subclass of Thread, or it may implementthe Runnable interface.

    36

  • 8/23/2019 Interview Questions on vlsi

    37/87

    196. What are the problems faced by Java programmers who don't use layoutmanagers?A. Without layout managers, Java programmers are faced with determining howtheir GUI will be displayed across multiple windowing systems and finding acommon sizing and positioning that will work within the constraints imposed by

    each windowing system.

    197. What is the difference between an if statement and a switch statement?A. The if statement is used to select among two alternatives. It uses a booleanexpression to decide which alternative should be executed. The switch statementis used to select among multiple alternatives. It uses an int expression todetermine which alternative should be executed.

    37

  • 8/23/2019 Interview Questions on vlsi

    38/87

    J2EE1. What is "abstract schema"A. The part of an entity bean's deployment descriptor that defines the bean'spersistent fields and relationships.

    2. What is "abstract schema name"A. A logical name that is referenced in EJB QL queries.

    3. What is "access control"A. The methods by which interactions with resources are limited to collections ofusers or programs for the purpose of enforcing integrity, confidentiality, oravailability constraints.

    4.What is "ACID"A. The acronym for the four properties guaranteed by transactions: atomicity,consistency, isolation, and durability.

    5. What is "activation"A. The process of transferring an enterprise bean from secondary storage tomemory. (See passivation.) What is "anonymous access"Accessing a resource without authentication.

    6. What is "applet"A. A J2EE component that typically executes in a Web browser but can executein a variety of other applications or devices thatsupport the applet programming model.

    7. What is "applet container"A. A container that includes support for the applet programming model.

    8. What is "application assembler"A. A person who combines J2EE components and modules into deployableapplication units.

    9. What is "application client"A. A first-tier J2EE client component that executes in its own Java virtualmachine. Application clients have access to someJ2EE platform APIs.

    10. What is "application client container"A. A container that supports application client components.

    11. What is "application client module"A. A software unit that consists of one or more classes and an application clientdeployment descriptor.

    38

  • 8/23/2019 Interview Questions on vlsi

    39/87

    12. What is "application component provider"A. A vendor that provides the Java classes that implement components' methods,JSP page definitions, and any required deploymentdescriptors.

    13.What is "application configuration resource file"A. An XML file used to configure resources for a JavaServer Faces application, todefine navigation rules for the application,and to register converters, validators, listeners, renderers, and components withthe application.

    14. What is "archiving"A. The process of saving the state of an object and restoring it.

    15. What is "asant"?A. A Java-based build tool that can be extended using Java classes. The

    configuration files are XML-based, calling out a target tree where various tasksget executed.

    16. What is "attribute"A. A qualifier on an XML tag that provides additional information.

    17. What is authenticationA. The process that verifies the identity of a user, device, or other entity in acomputer system, usually as a prerequisite to allowing access to resources in asystem. The Java servlet specification requires three types of authentication-basic,form-based, and mutual-and supports digest authentication.

    18. What is authorization?A. The process by which access to a method or resource is determined.Authorization depends on the determination of whether the principal associatedwith a request through authentication is in a given security role. A security role isa logical grouping of users defined by the person who assembles the application.A deployer maps security roles to security identities. Security identities may beprincipals or groups in the operational environment.

    19. What is authorization constraintA. An authorization rule that determines who is permitted to access a Webresource collection.

    20. What is B2BA. B2B stands for Business-to-business.

    21. What is backing beanA. A JavaBeans component that corresponds to a JSP page that includesJavaServer Faces components. The backing bean defines properties for the

    39

  • 8/23/2019 Interview Questions on vlsi

    40/87

    components on the page and methods that perform processing for the component.This processing includesevent handling, validation, and processing associated with navigation.

    22. What is basic authentication

    A. An authentication mechanism in which a Web server authenticates an entityvia a user name and password obtained using the Web application's built-inauthentication mechanism.

    23. What is bean-managed persistenceA. The mechanism whereby data transfer between an entity bean's variables and aresource manager is managed by the entity bean.

    24. What is bean-managed transactionA. A transaction whose boundaries are defined by an enterprise bean.

    25. What is binary entityA. See unparsed entity.

    26. What is binding (XML)A. Generating the code needed to process a well-defined portion of XML data.

    27. What is binding (JavaServer Faces technology)Wiring UI components to back-end data sources such as backing bean properties.

    28. What is build file?A. The XML file that contains one or more asant targets. A target is a set of tasksyou want to be executed. When starting asant, you can select which targets youwant to have executed. When no target is given, the project's default target isexecuted.

    29. What is business logicA. The code that implements the functionality of an application. In the EnterpriseJavaBeans architecture, this logic is implemented by the methods of an enterprisebean.

    30. What is business method ?A. A method of an enterprise bean that implements the business logic or rules ofan application.

    31. What is callback methods?A. Component methods called by the container to notify the component ofimportant events in its life cycle.

    32. What is caller?

    40

  • 8/23/2019 Interview Questions on vlsi

    41/87

    A. Same as caller principal.

    33. What is caller principal?A. The principal that identifies the invoker of the enterprise bean method.34. What is cascade delete

    A. A deletion that triggers another deletion. A cascade delete can be specified foran entity bean that has container-managed persistence.

    35. What is CDATA?A. A predefined XML tag for character data that means "don't interpret thesecharacters," as opposed to parsed character data (PCDATA), in which the normalrules of XML syntax apply. CDATA sections are typically used to show examplesof XML syntax.

    36. What is certificate authority?A. A trusted organization that issues public key certificates and provides

    identification to the bearer.

    37. What is client-certificate authentication?A. An authentication mechanism that uses HTTP over SSL, in which the serverand, optionally, the client authenticate each other with a public key certificate thatconforms to a standard that is defined by X.509 Public Key Infrastructure.

    38. What is comment?A. In an XML document, text that is ignored unless the parser is specifically toldto recognize it.

    39. What is commit?A. The point in a transaction when all updates to any resources involved in thetransaction are made permanent.

    40. What is component?A. See what is J2EE component.

    41. What is component (JavaServer Faces technology)?A. See what is JavaServer Faces UI component.

    42. What is component contract?A. The contract between a J2EE component and its container. The contractincludes life-cycle management of the component, a context interface that theinstance uses to obtain various information and services from its container, and alist of services that every container must provide for its components.

    43. What is component-managed sign-on?A. A mechanism whereby security information needed for signing on to aresource is provided by an application component.

    41

  • 8/23/2019 Interview Questions on vlsi

    42/87

    44. What is connection?A. See what is resource manager connection.

    45. What is connection factory?A. See what is resource manager connection factory.

    46. What is connector?A. A standard extension mechanism for containers that provides connectivity toenterprise information systems. A connector is specific to an enterpriseinformation system and consists of a resource adapter and applicationdevelopment tools forenterprise information system connectivity. The resource adapter is plugged in toa container through its support for system-level contracts defined in the Connectorarchitecture.

    47. What is Connector architecture?A. An architecture for integration of J2EE products with enterprise informationsystems. There are two parts to this architecture: a resource adapter provided byan enterprise information system vendor and the J2EE product that allows thisresource adapter to plug in. This architecture defines a set of contracts that aresource adapter must support to plug in to a J2EE product-for example,transactions, security, and resource management.

    48. What is container?A. An entity that provides life-cycle management, security, deployment, andruntime services to J2EE components. Each type of container (EJB, Web, JSP,servlet, applet, and application client) also provides component-specific services.

    49. What is container-managed persistence?A. The mechanism whereby data transfer between an entity bean's variables and aresource manager is managed by the entity bean'scontainer.

    50. What is container-managed sign-on?A. The mechanism whereby security information needed for signing on to aresource is supplied by the container.

    51. What is container-managed transaction?A. A transaction whose boundaries are defined by an EJB container. An entitybean must use container-managed transactions.

    52. What is content?In an XML document, the part that occurs after the prolog, including the rootelement and everything it contains.

    42

  • 8/23/2019 Interview Questions on vlsi

    43/87

    53. What is context attribute ?A. An object bound into the context associated with a servlet.

    54. What is context root?

    A. A name that gets mapped to the document root of a Web application.

    55. What is conversational state?A. The field values of a session bean plus the transitive closure of the objectsreachable from the bean's fields. The transitive closure of a bean is defined interms of the serialization protocol for the Java programming language, that is, thefields that would be stored by serializing the bean instance.

    56. What is CORBA?Common Object Request Broker Architecture. A language-independentdistributed object model specified by the OMG.

    57. What is create method?A. A method defined in the home interface and invoked by a client to create anenterprise bean.

    58. What is credentials?A. The information describing the security attributes of a principal.

    59. What is CSS?A. Cascading style sheet. A stylesheet used with HTML and XML documents toadd a style to all elements marked with a particular tag, for the direction ofbrowsers or other presentation mechanisms.

    60. What is CTS?A. Compatibility test suite. A suite of compatibility tests for verifying that a J2EEproduct complies with the J2EE platform specification.

    61. What is data?A. The contents of an element in an XML stream, generally used when theelement does not contain any subelements. When it does, the term content isgenerally used. When the only text in an XML structure is contained in simpleelements and when elementsthat have subelements have little or no data mixed in, then that structure is oftenthought of as XML data, as opposed to an XML document.

    62. What is DDP?A. Document-driven programming. The use of XML to define applications.

    63. What is declaration?A. The very first thing in an XML document, which declares it as XML. The

    43

  • 8/23/2019 Interview Questions on vlsi

    44/87

    minimal declaration is . Thedeclaration is part of the document prolog.

    64. What is declarative security?A. Mechanisms used in an application that are expressed in a declarative syntax in

    a deployment descriptor.

    65. What is delegation?A. An act whereby one principal authorizes another principal to use its identity orprivileges with some restrictions.

    66. What is deployer?A. A person who installs J2EE modules and applications into an operationalenvironment.

    67. What is deployment?A. The process whereby software is installed into an operational environment.

    68. What is deployment descriptor?A. An XML file provided with each module and J2EE application that describeshow they should be deployed. The deployment descriptor directs a deploymenttool to deploy a module or application with specific container options anddescribes specific configuration requirements that a deployer must resolve.

    69. What is destination?A. A JMS administered object that encapsulates the identity of a JMS queue ortopic. See point-to-point messaging system, publish/subscribe messaging system.

    70. What is digest authentication?A. An authentication mechanism in which a Web application authenticates itselfto a Web server by sending the server a message digest along with its HTTPrequest message. The digest is computed by employing a one-way hash algorithmto a concatenation of the HTTP request message and the client's password. Thedigest is typically much smaller than the HTTP request and doesn't contain thepassword.

    71. What is distributed application?A. An application made up of distinct components running in separate runtimeenvironments, usually on different platforms connected via a network. Typicaldistributed applications are two-tier (client-server), three-tier (client-middleware-server), and multitier (client-multiple middleware-multiple servers).

    72. What is document?A. In general, an XML structure in which one or more elements contains textintermixed with subelements. See also data.

    44

  • 8/23/2019 Interview Questions on vlsi

    45/87

    73. What is Document Object Model?A. An API for accessing and manipulating XML documents as tree structures.DOM provides platform-neutral, language-neutral interfaces that enablesprograms and scripts to dynamically access and modify content and structure in

    XML documents.

    74. What is document root?A. The top-level directory of a WAR. The document root is where JSP pages,client-side classes and archives, and static Web resources are stored.75. What is DTD?A. Document type definition. An optional part of the XML document prolog, asspecified by the XML standard. The DTD specifies constraints on the valid tagsand tag sequences that can be in the document. The DTD has a number ofshortcomings, however,and this has led to various schema proposals. For example, the DTD entry

    ELEMENT username (#PCDATA)> says that the XML element called usernamecontains parsed character data-that is, text alone, with no other structural elementsunder it. The DTD includes both the local subset, defined in the current file, andthe external subset, which consists of the definitions contained in external DTDfiles that are referenced in the local subset using a parameter entity.

    76. What is durable subscription?A. In a JMS publish/subscribe messaging system, a subscription that continues toexist whether or not there is a current active subscriber object. If there is no activesubscriber, the JMS provider retains the subscription's messages until they arereceived by the subscription or until they expire.

    77. What is EAR file?A. Enterprise Archive file. A JAR archive that contains a J2EE application.

    78. What is eb XML?A. Electronic Business XML. A group of specifications designed to enableenterprises to conduct business through the exchange of XML-based messages. Itis sponsored by OASIS and the United Nations Centre for the Facilitation ofProcedures and Practicesin Administration, Commerce and Transport (U.N./CEFACT).

    79. What is EJB?A. Enterprise JavaBeans.

    80. What is EJB container?A. A container that implements the EJB component contract of the J2EEarchitecture. This contract specifies a runtime environment for enterprise beansthat includes security, concurrency, life-cycle management, transactions,deployment, naming, and other services. An EJB container is provided by an EJB

    45

  • 8/23/2019 Interview Questions on vlsi

    46/87

    or J2EE server. What is EJB container provider A vendor that supplies an EJBcontainer.

    81. What is EJB context?A. An object that allows an enterprise bean to invoke services provided by the

    container and to obtain the information about thecaller of a client-invoked method.

    82. What is EJB home object?A. An object that provides the life-cycle operations (create, remove, find) for anenterprise bean. The class for the EJB home object is generated by the container'sdeployment tools. The EJB home object implements the enterprise bean's homeinterface.The client references an EJB home object to perform life-cycle operations on anEJB object. The client uses JNDI to locate an EJB home object.

    83. What is EJB JAR file?A. A JAR archive that contains an EJB module.

    84. What is EJB module?A. A deployable unit that consists of one or more enterprise beans and an EJBdeployment descriptor.

    85. What is EJB object?A. An object whose class implements the enterprise bean's remote interface. Aclient never references an enterprise bean instance directly; a client alwaysreferences an EJB object. The class of an EJB object is generated by a container'sdeployment tools.What is EJB server Software that provides services to an EJB container. Forexample, an EJB container typically relies on a transaction manager that is part ofthe EJB server to perform the two-phase commit across all the participatingresource managers. The J2EEarchitecture assumes that an EJB container is hosted by an EJB server from thesame vendor, so it does not specify the contract between these two entities. AnEJB server can host one or more EJB containers.

    86. What is EJB server provider?A. A vendor that supplies an EJB server.

    87. What is element?A. A unit of XML data, delimited by tags. An XML element can enclose otherelements.

    88. What is empty tag?A. A tag that does not enclose any content.

    46

  • 8/23/2019 Interview Questions on vlsi

    47/87

    89 What is enterprise bean?A. A J2EE component that implements a business task or business entity and ishosted by an EJB container; either an entity bean, a session bean, or a message-driven bean.

    90. What is enterprise bean provider?A. An application developer who produces enterprise bean classes, remote andhome interfaces, and deployment descriptor files, and packages them in an EJBJAR file.What is enterprise information system. The applications that constitute anenterprise's existing system for handling companywide information. Theseapplicationsprovide an information infrastructure for an enterprise. An enterprise informationsystem offers a well-defined set of services to its clients. These services areexposed to clients as local or remote interfaces or both. Examples of enterpriseinformation systems include enterprise resource planning systems, mainframe

    transaction processing systems, and legacy database systems.

    91. What is enterprise information system resource?A. An entity that provides enterprise information system-specific functionality toits clients. Examples are a record or set of records in a database system, a businessobject in an enterprise resource planning system, and a transaction program in atransaction processing system.

    92. What is Enterprise JavaBeans (EJB