important mnc tech questions

Document Sample
important mnc tech questions Powered By Docstoc
					                      IMPORTANT MNC’s TECH QUESTIONS


Q : What is the difference between Java platform and other platforms?
A : The Java platform differs from most other platforms in that it's a software-only platform that
runs on top of other hardware-based platforms.
The Java platform has two components:
1. The Java Virtual Machine (Java VM)
2. The Java Application Programming Interface (Java API)
Q : What is Java Virtual Machine?
A : The Java Virtual Machine is a software that can be ported onto the various hardware-based
Q : What is the package? Define with an example?
A : A package is a grouping of related types providing access protection and name space
management. Note that types refers to classes, interfaces, enumerations, and annotation types.
Enumerations and annotation types are special kinds of classes and interfaces, respectively, so
types are often referred to in this lesson simply as classes and interfaces.
Package is a directory of related classes and interfaces.
Eg: java.lang.*
Here java is a directory,lang stands for language & it is a sub directory, * indicates collection of
related classes & interfaces
Q : What is the difference between the interface and abstract class?
A : An abstract class may contain code in method bodies, which is not allowed in an interface.
With abstract classes, you have to inherit your class from it and Java does not allow multiple
inheritance. On the other hand, you can implement multiple interfaces in your class…

Q : What is the thread?

A : A thread is an independent path of execution in a system.

Q :What is the multi-threading?
A: Multi-threading means various threads that runs in a system.

Q : What is the synchronization ? why is it important in Java Programming?
       A : With respect to multithreading, synchronization is the capability to control the access
of multiple threads to shared resources. Without synchronization, it is an possible for one thread
to modify a shared object while another thread is in the process of using or updating that
object’s value. This often causes dirty data and leads to significant errors.
Q : What is the purpose of Runtime class in Java Programming?
A :The purpose of Runtime class is to provide access to the Java runtime system in Java
Q :Describe difference between a static and a non-static inner class in Java
A non-static inner class may have object instances that are associated with instances of the
class’s outer class. A static inner class does not have any other object instances.
Q : Name the primitive Java types?
A : The primitive types are,
byte, char, short, int, long, float, double, and boolean.
Q : What is the casting in Java Programming?
A : There are two types of casting, casting between primitive numeric types and casting
between object references.
Casting between numeric types is used to convert larger values, such as double values, to
smaller values, such as byte values. Casting between object references is used to refer the
object by a compatible class, interface, or array type reference.

Q : What are the Encapsulation, Inheritance and Polymorphism?
A : Encapsulation is the mechanism that binds together code and data it manipulates and keeps
both safe from outside interference and misuse.
Inheritance is the process by which one object acquires the properties of another object.
Polymorphism is the feature that allows one interface to be used for general class actions.
Q : What is the difference between constructor and method?
A : Constructor will be automatically invoked when an object is created where as the method
has to be called explicitly.
Q: What is a UNICODE?-
A : A Unicode is used for internal representation of characters and strings and it uses 16 bits to
represent each other.
Q : What is a abstract class?
A :A abstract class is a class designed with implementation gaps for subclasses to fill in and is
deliberately incomplete.
Q : What is daemon thread ? which the method is used to create the daemon thread?-
A: Daemon thread is a low priority thread which runs intermittently in the back ground doing the
garbage collection operation for the java runtime system.
SetDaemon method is used to create a daemon thread.
Q: What are the wrapper classes?
A : The Wrapper classes are classes that allow primitive types to be accessed as objects.
Q : What is the difference between applet and a servlet?
A : Servlets are to servers what applets are to browsers.
Applets must have graphical user interfaces whereas servlets have no graphical user interfaces.
Q :What are the cookies ?
A : Cookies are a mechanism that a servlet uses to have a client hold a small amount of state-
information associated with the user.
Q :What is Java Bean?
A : Java Bean is a software component that has been designed to be reusable in a variety of
different environments.

Q:u must use the new operator to instantiate an object of type Class: True or False? If
explain why.
A - False. There is no public constructor for the class Class. Class objects are constructed
automatically by the
Java Virtual Machine as classes are loaded and or by calls to the defineClass method in the
class loader.
Q - The Class class provides a toString() method which can be used to convert all
objects known
to the compiler to some appropriate string representation. The actual string
representation depends
on the type of object: True or False? If false, explain why.
A - False. The Object class (not the Class class) provides a toString() method which can be
used to convert all objects known to the compiler to some appropriate string representation. The
actual string representation
depends on the type of object.
Q - You can override the toString() method of the Class class to cause it to convert
objects of
your design to strings: True or False? If false, explain why.
A - False. The toString() method is a method of the Object class, not the Class class.
Q - By default, all classes in Java are either direct or indirect descendants of the Class
class which is
at the top of the inheritance hierarchy: True or False? If false, explain why.
A - False. By default, all classes in Java are either direct or indirect descendants of the Object
class (not the Class class) which is at the top of the inheritance hierarchy.
Q - To a limited extent, the interface concept allows you to treat a number of objects,
from different classes, as if they were all of the same type: True or False? If false, explain
A - True.
Q - At its simplest level, an interface definition has a name, and declares one or more
True or False? If false, explain why.
A - True.
Q- In an interface definition, both the method signatures and the actual implementations
(bodies) of
the methods are provided: True or False? If false, explain why.
A - False. Only the method signatures are provided. The actual implementations (bodies) of the
methods are not provided.
Q - An interface definition can contain only method declarations: True or False? If false,
A - False. In addition to method declarations, an interface can also declare constants. Nothing
else may be
included inside the body of an interface definition.
Q - If classes P, D, and Q all implement interface X, a reference variable for an object of
class P,
D, or Q could be assigned to a reference variable of type X: True or False? If false,
explain why.
A - True.
Q - If classes P, D, and Q all implement interface X, then all of the methods declared in X
must be
exactly the same in classes P, D, and Q: True or False? If false, explain why.
A - False. The interface simply declares the signatures for methods. Classes that implement the
interface are free to provide a body for those methods which best suits the needs of the class.
Q - If classes P, D, and Q all implement interface X a reference variable for an object of
class P,
D, or Q could be assigned to a reference variable of type X and that reference variable
could be
used to access all of the methods of the class (which are not excluded using public,
private, or
protected): True or False? If false, explain why.
A - False. If one or more of the classes P, D, and Q, define instance methods which are not
declared in the
interface X, then a variable of type X cannot be used to access those instance methods. Those
methods can only be accessed using a reference variable of the class in which the method is
defined. Reference variables of the type X can only be used to access methods declared in the
interface X (or one of its superinterfaces).
Q - The new operator must be used to instantiate an object which is of the type of an
interface: True
or False? If false, explain why.
A - False. Even though you can consider the interface name as a type for purposes of storing
references to
objects, you cannot instantiate an object of the interface type itself.
Q - One of the difficulties of implementing interfaces is the requirement to coordinate the
definition of
interface methods among the classes that implement the interface: True or False? If
false, explain
A - False. In defining interface methods, each class defines the methods in a manner that is
appropriate to its own
class without concern for how it is defined in other classes.
Q - As with classes, multiple interface definitions can be combined into the same source
file: True or
False? If false, explain why.
A- False. The compiler requires interface definitions to be in separate files.
Q - List four ways in which interfaces are useful:
A - See the following list:
To a limited extent, the interface concept allows you to treat a number of objects, instantiated
different classes, as if they were all of the same type
Capturing similarities between unrelated classes without forcing a class relationship
Declaring methods that one or more classes are expected to implement
Revealing an object's programming interface without revealing its class (objects such as these
are called
anonymous objects and can be useful when shipping a package of classes to other developers)

           1. What is a class? A class is a blueprint, or prototype, that defines the
              variables and the methods common to all objects of a certain kind.
           2. What is a object? An object is a software bundle of variables and
              related methods.An instance of a class depicting the state and
              behavior at that particular time in real world.
           3. What is a method? Encapsulation of a functionality which can be
              called to perform specific tasks.
           4. What is encapsulation? Explain with an example. Encapsulation is
              the term given to the process of hiding the implementation details of
              the object. Once an object is encapsulated, its implementation details
              are not immediately accessible any more. Instead they are packaged
              and are only indirectly accessible via the interface of the object
5. What is inheritance? Explain with an example. Inheritance in
   object oriented programming means that a class of objects can inherit
   properties and methods from another class of objects.
6. What is polymorphism? Explain with an example. In object-
   oriented programming, polymorphism refers to a programming
   language's ability to process objects differently depending on their
   data type or class. More specifically, it is the ability to redefine
   methods for derived classes. For example, given a base class shape,
   polymorphism enables the programmer to define different area
   methods for any number of derived classes, such as circles, rectangles
   and triangles. No matter what shape an object is, applying the area
   method to it will return the correct results. Polymorphism is considered
   to be a requirement of any true object-oriented programming
7. Is multiple inheritance allowed in Java? No, multiple inheritance is
   not allowed in Java.
8. What is interpreter and compiler? Java interpreter converts the
   high level language code into a intermediate form in Java called as
   bytecode, and then executes it, where as a compiler converts the high
   level language code to machine language making it very hardware
9. What is JVM? The Java interpreter along with the runtime
   environment required to run the Java application in called as Java
   virtual machine(JVM)
10.What are the different types of modifiers? There are access
   modifiers and there are other identifiers. Access modifiers are public,
   protected and private. Other are final and static.
11.What are the access modifiers in Java? There are 3 access
   modifiers. Public, protected and private, and the default one if no
   identifier is specified is called friendly, but programmer cannot specify
   the friendly identifier explicitly.
12.What is a wrapper class? They are classes that wrap a primitive
   data type so it can be used as a object
13.What is a static variable and static method? What's the
   difference between two? The modifier static can be used with a
   variable and method. When declared as static variable, there is only
   one variable no matter how instances are created, this variable is
   initialized when the class is loaded. Static method do not need a class
   to be instantiated to be called, also a non static method cannot be
   called from static method.
14.What is garbage collection? Garbage Collection is a thread that
   runs to reclaim the memory by destroying the objects that cannot be
   referenced anymore.
15.What is abstract class? Abstract class is a class that needs to be
   extended and its methods implemented, aclass has to be declared
   abstract if it has one or more abstract methods.
16.What is meant by final class, methods and variables? This
   modifier can be applied to class method and variable. When declared
   as final class the class cannot be extended. When declared as final
   variable, its value cannot be changed if is primitive value, if it is a
   reference to the object it will always refer to the same object, internal
   attributes of the object can be changed.
17.What is interface? Interface is a contact that can be implemented by
   a class, it has method that need implementation.
18.What is method overloading? Overloading is declaring multiple
   method with the same name, but with different argument list.
19.What is method overriding? Overriding has same method name,
   identical arguments used in subclass.
20.What is singleton class? Singleton class means that any given time
   only one instance of the class is present, in one JVM.
21.What is the difference between an array and a vector? Number
   of elements in an array are fixed at the construction time, whereas the
   number of elements in vector can grow dynamically.
22.What is a constructor? In Java, the class designer can guarantee
   initialization of every object by providing a special method called a
   constructor. If a class has a constructor, Java automatically calls that
   constructor when an object is created, before users can even get their
   hands on it. So initialization is guaranteed.
23.What is casting? Conversion of one type of data to another when
   appropriate. Casting makes explicitly converting of data.
24.What is the difference between final, finally and finalize? The
   modifier final is used on class variable and methods to specify certain
   behaviour explained above. And finally is used as one of the loop in
   the try catch blocks, It is used to hold code that needs to be executed
   whether or not the exception occurs in the try catch block. Java
   provides a method called finalize( ) that can be defined in the class.
   When the garbage collector is ready to release the storage ed for your
   object, it will first call finalize( ), and only on the next garbage-
   collection pass will it reclaim the objects memory. So finalize( ), gives
   you the ability to perform some important cleanup at the time of
   garbage collection.
25.What is are packages? A package is a collection of related classes
   and interfaces providing access protection and namespace
26.What is a super class and how can you call a super class? When
   a class is extended that is derived from another class there is a
   relationship is created, the parent class is referred to as the super
   class by the derived class that is the child. The derived class can make
   a call to the super class using the keyword super. If used in the
   constructor of the derived class it has to be the first statement.
27.What is meant by a Thread? Thread is defined as an instantiated
   parallel process of a given program.
28.What is multi-threading? Multi-threading as the name suggest is
   the scenario where more than one threads are running.
29.What are two ways of creating a thread? Which is the best way
   and why? Two ways of creating threads are, one can extend from the
            Java.lang.Thread and can implement the rum method or the run
            method of a different class can be called which implements the
            interface Runnable, and the then implement the run() method. The
            latter one is mostly used as first due to Java rule of only one class
            inheritance, with implementing the Runnable interface that problem is
            sorted out.
         30.What is deadlock? Deadlock is a situation when two threads are
            waiting on each other to release a resource. Each thread waiting for a
            resource which is held by the other waiting thread. In Java, this
            resource is usually the object lock obtained by the synchronized
         31.What are the three types of priority? MAX_PRIORITY which is 10,
            MIN_PRIORITY which is 1, NORM_PRIORITY which is 5.

What is the use of synchronizations? Every object has a lock, when a
synchronized keyword is used on a piece of code the, lock must be obtained by the
thread first to execute that code, other threads will not be allowed to execute that
piece of code till this lock is released.

         1. What are synchronized methods and synchronized statements?
            Synchronized methods are methods that are used to control access to
            an object. For example, a thread only executes a synchronized method
            after it has acquired the lock for the method's object or class.
            Synchronized statements are similar to synchronized methods. A
            synchronized statement can only be executed after a thread has
            acquired the lock for the object or class referenced in the synchronized
         2. What are different ways in which a thread can enter the
            waiting state? A thread can enter the waiting state by invoking its
            sleep() method, blocking on I/O, unsuccessfully attempting to acquire
            an object's lock, or invoking an object's wait() method. It can also
            enter the waiting state by invoking its (deprecated) suspend() method.
         3. Can a lock be acquired on a class? Yes, a lock can be acquired on a
            class. This lock is acquired on the class's Class object.
         4. What's new with the stop(), suspend() and resume() methods
            in new JDK 1.2? The stop(), suspend() and resume() methods have
            been deprecated in JDK 1.2.
         5. What is the preferred size of a component? The preferred size of
            a component is the minimum component size that will allow the
            component to display normally.
         6. What method is used to specify a container's layout? The
            setLayout() method is used to specify a container's layout. For
            example, setLayout(new FlowLayout()); will be set the layout as
         7. Which containers use a FlowLayout as their default layout? The
            Panel and Applet classes use the FlowLayout as their default layout.
8. What state does a thread enter when it terminates its
   processing? When a thread terminates its processing, it enters the
   dead state.
9. What is the Collections API? The Collections API is a set of classes
   and interfaces that support operations on collections of objects. One
   example of class in Collections API is Vector and Set and List are
   examples of interfaces in Collections API.
10.What is the List interface? The List interface provides support for
   ordered collections of objects. It may or may not allow duplicate
   elements but the elements must be ordered.
11.How does Java handle integer overflows and underflows? It
   uses those low order bytes of the result that can fit into the size of the
   type allowed by the operation.
12.What is the Vector class? The Vector class provides the capability to
   implement a growable array of objects. The main visible advantage of
   this class is programmer needn't to worry about the number of
   elements in the Vector.
13.What modifiers may be used with an inner class that is a
   member of an outer class? A (non-local) inner class may be
   declared as public, protected, private, static, final, or abstract.
14.If a method is declared as protected, where may the method be
   accessed? A protected method may only be accessed by classes or
   interfaces of the same package or by subclasses of the class in which it
   is declared.
15.What is an Iterator interface? The Iterator interface is used to step
   through the elements of a Collection.
16.How many bits are used to represent Unicode, ASCII, UTF-16,
   and UTF-8 characters? Unicode requires 16 bits, ASCII require 7 bits
   (although the ASCII character set uses only 7 bits, it is usually
   represented as 8 bits), UTF-8 represents characters using 8, 16, and
   18 bit patterns, UTF-16 uses 16-bit and larger bit patterns
17.What is the difference between yielding and sleeping? Yielding
   means a thread returning to a ready state either from waiting, running
   or after creation, where as sleeping refers a thread going to a waiting
   state from running state. With reference to Java, when a task invokes
   its yield() method, it returns to the ready state and when a task
   invokes its sleep() method, it returns to the waiting state
18.What are wrapper classes? Wrapper classes are classes that allow
   primitive types to be accessed as objects. For example, Integer,
   Double. These classes contain many methods which can be used to
   manipulate basic data types
19.Does garbage collection guarantee that a program will not run
   out of memory? No, it doesn't. It is possible for programs to use up
   memory resources faster than they are garbage collected. It is also
   possible for programs to create objects that are not subject to garbage
   collection. The main purpose of Garbage Collector is recover the
   memory from the objects which are no longer required when more
   memory is needed.
         20.Name Component subclasses that support painting? The
            following classes support painting: Canvas, Frame, Panel, and Applet.
         21.What is a native method? A native method is a method that is
            implemented in a language other than Java. For example, one method
            may be written in C and can be called in Java.
         22.How can you write a loop indefinitely?

for(;;) //for loop
while(true); //always true

         1. Can an anonymous class be declared as implementing an
            interface and extending a class? An anonymous class may
            implement an interface or extend a superclass, but may not be
            declared to do both.
         2. What is the purpose of finalization? The purpose of finalization is
            to give an unreachable object the opportunity to perform any cleanup
            processing before the object is garbage collected. For example, closing
            a opened file, closing a opened database Connection.
         3. What invokes a thread's run() method? After a thread is started,
            via its start() method or that of the Thread class, the JVM invokes the
            thread's run() method when the thread is initially executed.
         4. What is the GregorianCalendar class? The GregorianCalendar
            provides support for traditional Western calendars.
         5. What is the SimpleTimeZone class? The SimpleTimeZone class
            provides support for a Gregorian calendar.
         6. What is the Properties class? The properties class is a subclass of
            Hashtable that can be read from or written to a stream. It also
            provides the capability to specify a set of default values to be used.
         7. What is the purpose of the Runtime class? The purpose of the
            Runtime class is to provide access to the Java runtime system.
         8. What is the purpose of the System class? The purpose of the
            System class is to provide access to system resources.
         9. What is the purpose of the finally clause of a try-catch-finally
            statement? The finally clause is used to provide the capability to
            execute code no matter whether or not an exception is thrown or
            caught. For example,

//some statements
// statements when exception is cought
//statements executed whether exception occurs or not

           1. What is the Locale class? The Locale class is used to tailor program
              output to the conventions of a particular geographic, political, or
              cultural region.
           2. What must a class do to implement an interface? It must provide
              all of the methods in the interface and identify the interface in its
              implements clause.

Q.What is an Iterator?
Answer: Some of the collection classes provide traversal of their contents via a java.util.Iterator
interface. This interface allows you to walk through a collection of objects, operating on each
object in turn. Remember when using Iterators that they contain a snapshot of the collection at
the time the Iterator was obtained; generally it is not advisable to modify the collection itself
while traversing an Iterator.
Q.What is the difference between an Interface and an Abstract class?
Answer: An abstract class can have instance methods that implement a default behavior. An
Interface can only declare constants and instance methods, but cannot implement default
behavior and all methods are implicitly abstract. An interface has all public members and no
implementation. An abstract class is a class which may have the usual flavors of class members
(private, protected, etc.), but has some abstract methods.
Q.What is the purpose of garbage collection in Java, and when is it used?
Answer: The purpose of garbage collection is to identify and discard objects that are no longer
needed by a program so that their resources can be reclaimed and reused. A Java object is
subject to garbage collection when it becomes unreachable to the program in which it is used.
Q.Describe synchronization in respect to multi threading.
Answer: With respect to multi threading, synchronization is the capability to control the access
of multiple threads to shared resources. Without synchronization, it is possible for one thread to
modify a shared variable while another thread is in the process of using or updating same
shared variable. This usually leads to significant errors.
Q. Explain different way of using thread?
Answer: The thread could be implemented by using runnable interface or by inheriting from the
Thread class. The former is more advantageous, 'cause when you are going for multiple
inheritance..the only interface can help.
Q.What are pass by reference and pass by value?
Answer: Pass By Reference means the passing the address itself rather than passing the value.
Pass by Value means passing a copy of the value to be passed.
Q. What is HashMap and Map?
Answer: Map is Interface and Hashmap is class that implements that.
Q.Difference between HashMap and HashTable?
Answer: The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized
and permits nulls. (HashMap allows null values as key and value whereas Hashtable doesnt
allow). HashMap does not guarantee that the order of the map will remain constant over time.
HashMap is unsynchronized and Hashtable is synchronized.
Q.Difference between Vector and ArrayList?
Answer:Vector is synchronized whereas arraylist is not.
Q.Difference between Swing and Awt?
Answer: AWT are heavy-weight componenets. Swings are light-weight components. Hence
swing works faster than AWT.
Q.State the significance of public, private, protected, default modifiers both singly and in
combination and state the effect of package relationships on declared items qualified by
these modifiers.
Answer: public : Public class is visible in other packages, field is visible everywhere (class must
be public too)
private : Private variables or methods may be used only by an instance of the same class that
declares the variable or method, A private feature may only be accessed by the class that owns
the feature.
protected : Is available to all classes in the same package and also available to all subclasses of
the class that owns the protected feature.This access is provided even to subclasses that reside
in a different package from the class that owns the protected feature.
default :What you get by default ie, without any access modifier (ie, public private or
protected).It means that it is visible to all within a particular package.
Q.What is an abstract class?
Answer: Abstract class must be extended/subclassed (to be useful). It serves as a template. A
class that is abstract may not be instantiated (ie, you may not call its constructor), abstract class
may contain static data. Any class with an abstract method is automatically abstract itself, and
must be declared as such.
A class may be declared abstract even if it has no abstract methods. This prevents it from being
Q.What is final?
Answer:A final class can't be extended ie., final class may not be subclassed. A final method
can't be overridden when its class is inherited. You can't change value of a final variable (is a
Q.The Java read() method reads and returns a single byte from the standard input device.
stores that byte according to what type. What does the method return if the user enters
an eof?
Answer:The Java read() method reads and returns a single byte from the standard input device
and stores that byte
in an integer. It returns an integer value of -1 if the user enters an eof.
Q.What keystroke combination can be used to simulate an eof at the keyboard of a DOS
Answer:An eof can be simulated on a DOS system keyboard by holding down the ctrl key and
pressing the z key.
Q.Provide a Java code fragment illustrating how you would read a stream of bytes from
standard input device until encountering an eof and quit reading when the eof is
Answer:The following Java code fragment will read a stream of bytes from the standard input
device until
encountering an eof.
while( != -1) { //do something }
This code fragment accesses the read()method of the object referred to by the class variable
named in of the
class named System.
Q. Provide a Java code fragment illustrating two different ways to display a String
argument on the
Java standard output device. Explain how your code works in object-oriented terms.
Make certain
that you explain the difference between the two.
Answer:The following two code fragments will each display a string argument on the Java
standard output device.
System.out.println("String argument")
System.out.print("String argument")
In the first case, the code fragment accesses the println() method of the object referred to by the
class variable
named out of the class named System. In the second case, the print() method is accessed
instead of the println() method.
The difference between the two is that the println() method automatically inserts a newlineat the
end of the
string argument whereas the print() method leaves the display cursor at the end of the string

Q : How do youn delete an element in array of string?
A : Reduce the array size.
delete[] stringarryname;
delete stringarryname;
stringarryname = NULL;
Q : What is the difference between an overload assignment operator and an a copy
A :. An overloaded assignment operator assigns the contents of an existing object to another
existing object of the same class. A copy constructor constructs a new object by using the
content of the argument object
Q :What is the virtual destructor?
A : The virtual destructor is one that is declared with the virtual attribute.
The behavior of a virtual destructor is what is important. If you destroy an object through a baler
or reference to a base class, and the base-class destructor is not virtual, the derived-class
destructors are not executed, and the destruction might not be compile.
Q: What is the Difference between C and C ++?
A : C is a structured programming language. The C++ is an object oriented language. C++ is
also called as C with Classes.
both C and C++ are programming languages. C++ is termed as superset of C.
C is a powerful and elegent language.almost all c PROGRAMS ARE ALSO c++ PROGRAMS.
C, it facilitates--" topdown structured design" as against C++ provides bottom-up object-oriented
design. C language is built from functions (like printf)that execute different tasks.
Q : Difference between a template class and class template in C++?
A : Template class: A generic definition or a parametrized class not instantiated until the client
provides the needed information. It is the jargon for plain templates.
Class template: A class template specifies how individual classes can be constructed much like
the way a class specifies how individual objects can be constructed. It is jargon for plain
Q : What is the polymorphism in C++?
A : Polymorphism in the C++ is the idea that a base class can be inherited by several classes. A
base class pointer can point to its child class and base class array can store different child class

Q:Explain in void pointer using C++?
A : In C++, void represents the absence of type, so void the pointers are pointers that point to a
value that has no type. The void pointers can point to any data type.
We can declare void pointer as follows.
Void *p;

Q : What is the function overloading in C++?
A : You can have the multiple functions with same name using function overloading facility of
C++. You can use same name for multiple functions when all these functions are doing same

Q : What is virtual function?
Answer - Virtual function is the member function of a class that can be overridden in its derived
class. It is declared with virtual keyword. Virtual function call is resolved at run-time (dynamic
binding) whereas the non-virtual member functions are resolved at compile time (static binding).

Q : What is Null object in C++?
A : Null Object is an object of some class whose purpose is to indicate that a real object of that
class does not exist. One common use for a null object is a return value from a member of
function that is supposed to return an object with some specified properties but cannot find such
an object.

Q : What is virtual function? where is it used?
A : Virtual function is a member of function that is declared by with in a base class and redefined
by the derived class. to make a function virtual prefix the function name by the "virtual" keyword.
It helps in polymorphism.
Q : what is a template
A template function defines a set of operations to performed on the various data types This data
is passed to the function as an argument

Q : What do you mean by the inheritance?
A : The Inheritance is the process by which one can aquire the properties of another object

Q : Explain the scope resolution operator?
A: The scope resolution operator is a permits of a program to reference an identifier in the
global scope that has been hidden by another identifier with the same name in the local scope.

Q : What is parameterized type?
A : : A template is a parameterized construct or type containing the generic code that can use or
manipulate any type. It is called the parameterized because an actual type is a parameter of the
code body. Polymorphism may be achieved through parameterized types. This type of
polymorphism is called parameteric polymorphism. Parameteric polymorphism is the
mechanism by which the same code is used on different types passed as parameters.

Q : Explain the scope resolution operator?
A :Resolution operator permits a program to reference an identifier in the global scope that has
been hidden by another identifier with the same name in the local scope.

Q : Name of the some pure object oriented languages?
A : Some pure object oriented languages are
• Smalltalk,
• Java,
• Eiffel,
• Sather.

Q : Differentiate between a C++ struct and C++ class?
A : The default member and base-class access specifies are different. This is one of the
commonly misunderstood aspects of C++. Believe it is or not, many programmers think that a
C++ struct is just like a C struct, while a C++ class has inheritance, access specifies, member
functions, overloaded operators, and so on. Actually, the C++ struct has all the features of the
class. The only differences are that a struct defaults to public member access and public base-
class inheritance, and a class defaults to the private access specified and private base-class

Q : Why do C++ compilers need the name mangling?
A : Name mangling is the rule of according to which is the C++ changes function's name into
function signature before the passing that the function to a linker. This is how the linker
differentiates between different functions with the same name.

Q : What is protocol class?
A : An abstract class is a protocol class if:
1.Protocol neither contains nor inherits from the classes that contain member data, non-virtual
functions, or private (or protected) members of any kind.
2. It has a non-inline virtual destructor defined with an empty implementation,
3. All member functions other than the destructor including inherited functions, are declared
pure the virtual functions and left undefined.
Q : What is the difference between the message and method?
A: Method: Provides response to a message.It is an implementation of an operation..
Message: Objects communicate by sending the messages to each other.A message is sent to
invoke a method.

Q : What is an adaptor class ?
A : A class that has no functionality of its own. It is the member functions hide the use of a third
party software component or an object with the non-compatible interface or a non- object-
oriented implementation.

Q : What’s the difference between char a[] = “string”; and char *p = “string”;?
A : In the first case six bytes are allocated to the variable in a which is fixed, where as in the
second case if *p is assigned to the some other value the allocate memory can change.

Q : What is conversion constructor?
A : A conversion constructor is that accepts one argument of a different type.

Q : What’s an explicit constructor?
A : A conversion constructor declared with the explicit keyword. The compiler does’nt use an
explicit constructor to implement an implied conversion of types. It is the purpose of is reserved
explicitly for construction.

Q: What’s the difference between the HTML form methods GET and POST?
A : The method parameter specifies which method the client is using to send information to the WEB
server. The method determines which parameter you will search the CGI request data in:
* POST - post_args
* GET - http_search_args

Q : What is a tag?
A : In HTML, a tag tells the browser what to do. When you write an HTML page, you enter tags for
many reasons -- to change the appearance of text, to show a graphic, or to make a link to one page
to another page.

Q : What are meta tags and why it is used?
A: Html tag in the header section of a web page, intended to offer content to search engines. Among
them are the keyword and description tags, but these days are most true search engines de-
emphasize or completely ignore META tags. ...

Q : What are the differences between DIV and SPAN?
A : DIV is used to select a block of text so that one can apply styles to it. SPAN is used to select inline
text and let users to apply styles to it. The main difference between DIV and SPAN is SPAN does not
do formatting by itself. Also the DIV tag is used as a paragraph break as it creates a logical division of
the document in which it is applied. This is in contrast to the SPAN as SPAN simply dos the
functionality of applying the style and alignment whatever was specified in it. DIV has ALIGN attribute
in it which is not present in case of SPAN. Thus DIV is used in cases where one wants to apply styles
to a block of text. But there may be situations in which that the there might not be clear well
structured block of text to work with. In those cases one can do opt to apply SPAN which is used to
apply styles inline. That is in other words DIV is generally used for block of text and SPAN is generally
used for words or sentences.

Q : How do you change the title of a framed document?
A : The title displayed is the title of the frameset document rather than the titles of any of the pages
within frames. To change the title displayed, a link to a new frameset document using
TARGET="_top" (replacing the entire frameset).

Q : How do you link to a location in the middle of an HTML document?
A : First, label the destination of the link. The old way to label the destination of the link was with an
anchor using the NAME attribute.
For example:<h2><a name="section2">Section 2: Web Page</a></h2>

The modern way to the label destination of the link is with an ID attribute.
For example:<h2 id="section2">Section 2: Web page</h2>

Second, link to the labeled destination. The URL is the URL of the document, with "#" and the value of
the NAME or ID attribute appended. Continuing the above examples, elsewhere in the same document
you could use:
<a href="#section2">go to Section 2</a>

Q : How do you remove the border around frames?
A : Removing the border around frames involves both not drawing the frame borders and eliminating
the space between the frames. The most widely supported way to display borderless frames is
Note that these attributes are proprietary and not part of the HTML 4.01 specifications. (HTML 4.01
does define the FRAMEBORDER attribute for the FRAME element, but not for the FRAMESET element.)
Also, removing the border around a frame makes it is difficult to resize it, as this border is also used in
most GUIs to change the size of the frame.

Q : Explain in brief about the term CSS.
A : A stylesheet language is used to describe the presentation of a document written in a markup
language. Cascading Style Sheets are a big breakthrough in Web design because they allow
developers to control the style and layout of multiple Web pages all at once.

Q : What are the attributes that make up a DHTML?
A : DHTML is called as a Dynamic HTML. This is used to increase the interactive ability and the visual
effect of the web pages which is loaded in the browser. The main technologies that are used in DHTML
are namely:

CSS which is also called as Cascading Style Sheet
DOM also called as Document Object Model

Let see the DHTML namely briefly about

This is also known as hyper text markup language. This is widely used in web pages. This along with
JavaScript plays a vital role for enhancing the features of web pages. In other words the JavaScript is
inside the HTML page and this is read by the browser as soon as the page gets loaded.
JavaScript is the most popularly used scripting language for client-side. The use of JavaScript within
the HTML page adds interactivity ability to web pages and this was introduced by Netscape.

DOM is called as Document Object Model. This is platform and also language independent. This is used
for dynamic access and updating of contents in documents

CSS is called as Cascading Style Sheet. This is used to enhance the features of web pages like
formatting styles say bold, font size and so on and there by increase the visual appearance of web
pages. These are specified inside an HTML tag.

Q : Why is there extra space before or after the table?
A : This is often caused by invalid HTML syntax. Specifically, it is often caused by loose content within
the table (i.e., content that is not inside a TD or TH element). There is no standard way to the handle
loose content within a table. Some browsers display all loose content before or after the table. When
the loose content contains only multiple line breaks or empty paragraphs, then these browsers will
display all this empty space before or after the table itself.
The solution is to fix the HTML syntax errors. All content within a table must be within a TD or TH

Q : What’s the difference between jscript and javascript?
A : JScript & javascript are both scripting languages that facilitate
development of web pages. It is similar to javascript with subtle difference in objects & functions
exposed. JScript is supported and shipped by Microsoft and may be work best only on IE where as
Javascript was initiated by netscape and can do work across all browsers consistent

1.     void main()
          extern int a;
         1. Give linker error- a not defined ans
         2. Print 10
         3. Give compiler error

 2.      int a[10];
         will compiler show any
         ans no

 3.      socket() is a
            1. system call ans
            2. library function
            3. both
            4. none

     In c++ there were conceptual ques on virtualfunctions , operator
overloading etc. in section B some ques were
     as follows microprocessor over clocking will result in
         1. overheating
         2. malfunctioning ans(check)
         3. life would be half

4.    Cache is
        1. ROM
        2. RAM ans
        3. PRAM
        4. EPRAM

5.     How can pass an array to a fns.
        1. desgin(**a)
        2. desgin (*a)
        3. dasgien(&a[0]);

6.    Unix has pipelining fromatted &
         a. high level
          b. low "
          c . mid level
          d. none "

7.    Task switching is
         1.process switching
         4.all of the above ans

8.    Thread arev ans .light weight process+(c).......................

9.    virual fns are defined as ................

10.    which is not bus interface
        a. pci
        b. ide
        c. age
        d. none

11. switch statement use
       a. char
       b. int
       c. both
       d. all of the above

12. Multiple inheritence can not be used in a

13.   What is difference b/w simple SQDL & Object oriented SQDL.

14.   Virtual Destructor is used...........................

15.   Question on two pass assembler.........................

16.   Link list uses
        a. countiguos memory allocation
        b. non coun. " "
        c. both
        d. none

17.   Non linear structure a. q & stack
       ans:- b.tree & graph
         c. tree & stack
         d. tree & linklist
18.     E ncryption is
           ans a. change readable code to cipher text
19.     Sizeof () operator is used for
         a. data type
        b. data type & veriable
         ans c. both
        d. none

20.     deadlock condition
        ans. no process knows exactly that both are waiting for each other.

21.    static
      ans:- it's initial value is one --- not true
22.    new can be overloaded ------ true
23.    virtual function------- ans a and c means no code and forceful
24.     for(;;)
       ans:- infinite loop
O nly three unix questions were there
1. socket() is a answer: a) system call

2. two types of pipeline in unix one is formatted and other one   is
highlevel middle level lowlevel none
( i don't answer for this question pls check it out) RDBMS
1. CAN foreign key have null values??
answer: YES



. Which of following operator can't be overloaded?

a) ==

b) ++

d) <=

2. For the following C program

     1. include<iostream.h>


{printf("Hello World");}

The program prints Hello World without changing main() ,the output should



Hello World


The changes should be

a) IOstream operator<<(iostream os, char*s)

os<<'intialisation'<<(Hello World)<<Destruct



d) none of the above

3. CDPATH shell variable is in(c-shell)

4. The term stickily bit is related to

a) Kernel

b) Undeletable file
c) Both (a) and (b)

d) None

5. Semaphore variable is different from ordinary variable by

6. For the following C program:

swap(int x,y)

{ int temp;





{int x=2;y=3;


After calling swap, what are the values x & y?

7. Static variable will be visible in

a) Function. in which they are defined

b) Module in which they are defined

c) All the program

d) None

8. Unix system is

a) Multi processing

b) Multi processing, multiuser
c) Multi processing, multiuser, multitasking

d) Multiuser, multitasking

9. X.25 protocol encapsulates the following layers

a) Network

b) Datalink

c) Physical

d) All of the above

e) None of the above

10. TCP/IP can work on

a) Ethernet

b) Tokenring

c) (a) & (b)

d) None

11. A node has the IP address and

But it is transmitting data from node1 to node 2only.

The reason may be

a) A node cannot have more than one address

b) class A should have second octet different

c) class B should have second octed different

d) All of the above
12. The OSI layer from bottom to top

13. For an application which exceeds 64k the memory model should be

a) Medium

b) Huge

c) Large

d) None

14. The condition required for dead lock in unix system is

15. Set-user-id is related to (in unix)

16. Bourne shell has

a) History record****other choices not given

17. Which of the following is not true about C++

a) Code removably

b) Encapsulation of data and code

c) Program easy maintenance

d) Program runs faster

18. For the following C program

struct base {int a,b;

int virtual function1();}

struct derv1:base

{int b,c,d;


int virtual function1();}

struct derv2 : base

{int a,e;
















base ba;
derv1 d1,d2;

printf("%d %d",d1.a,d1.b)

Output of the program is:

a) a=2;b=3;

b) a=3; b=2;

c) a=5; b=10;

d) none

19. For the above program answer the following q's


base da;

derv1 d1;

derv2 d2;

printf("%d %d %d",da.function1(),d1.function1(),d2.function1());

Output is:

a) 100,200,200;

b) 200,100,200;

c) 200,200,100;

d) None of the above

20. For the following C program

struct {

int x;
int y;


x cannot be accessed by the following





a )1, 2, 3

b) 2 & 3

c) 1 & 2

d) 1, 3, 4

21. Automatic variables are destroyed after fn. ends because

a) Stored in swap

b) Stored in stack and poped out after fn. returns

c) Stored in data area

d) Stored in disk

22. Relation between x-application and x-server (x-win)

23. What is UIL(user interface language) (x-win)

24)Which of the following is right in ms-windows
a) Application has single qvalue system has multiple qvalue

b) Application has multiple qvalue system has single qvalue

c) Application has multipleqvalue system has multiple qvalue

d) none

25. Widget in x-windows is

26. Gadget in x_windows is

27. Variable DESTDIR in make program is accessed as




28. The keystroke mouse entrie are interpreted in ms windows as

a) Interrupt

b) Message

c) Event

d) None of the above

29. Link between program and outside world (ms -win)

a) Device driver and hardware disk

b) Application and device driver

c) Application and hardware device
d) None

30. Ms -windows is

a) multitasking

b) multi-user

c) both of the above

d) none of the above

31. Dynamic scoping is

32. After logout the process still runs in the background by giving the command

33. Which process dies out but still waits

a) Exit

b) Wakeup

c) Zombie

d) Sleep

34. in dynamic memory allocation we use

a) Doubly linked list

b) Circularly linked

c) B trees

d) L trees

e) None
35. To find the key of search the data structure is

a) Hash key

b) Trees

c) Linked lists

d) Records

36. Which of the following is true?

a) Bridge connects dissimilar LAN and protocol insensitive

b) Router connects dissimilar LAN and protocol insensitive

c) Gateway connects dissimilar LAN and protocol insensitive

d) None of the above

37. Read types of tree traversals.

38. Read about SQL/Databases

39. A DBMS table is given along with simple SQL statements. Find the output.

40. Simple programs on pointers in c

Shared By:
Tags: interview