Question & Answer



Question : 1
What do you know about Java?


Answer : Java is a high-level programming language originally developed by Sun Microsystems and released in 1995. Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.

Question : 2
What are the supported platform by Java Programming Language?


Answer : Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX/Linux like HP-Unix, Sun Solaris, Redhat Linux, Ubuntu, CentOS etc.

Question : 3
List any five features of Java?


Answer : Some features include Object Oriented, Platform Independent, Robust, Interpreted, Multi-threaded

Question : 4
Why is Java Architectural Neutral?


Answer : Its compiler generates an architecture-neutral object file format which makes the compiled code to be executable on many processors, with the presence Java runtime system.

Question : 5
How Java enabled High Performance?


Answer : Java uses Just-In-Time compiler to enable high performance. Just-In-Time compiler is a program that turns Java bytecode which is a program that contains instructions that must be interpreted into instructions that can be sent directly to the processor.

Question : 6
Why Java is considered dynamic?


Answer : It is designed to adapt to an evolving environment. Java programs can carry extensive amount of run-time information that can be used to verify and resolve accesses to objects on run-time.

Question : 7
What do you mean by Object?


Answer : Object is a runtime entity and its state is stored in fields and behavior is shown via methods. Methods operate on an object's internal state and serve as the primary mechanism for object-to-object communication.

Question : 8
Define class?


Answer : A class is a blue print from which individual objects are created. A class can contain fields and methods to describe the behavior of an object.

Question : 9
What kind of variables a class can consist of?


Answer : A class consist of Local variable, instance variables and class variables.

Question : 10
What is a Local Variable


Answer : Variables defined inside methods, constructors or blocks are called local variables. The variable will be declared and initialized within the method and it will be destroyed when the method has completed.

Question : 11
What is a Class Variable


Answer : These are variables declared with in a class, outside any method, with the static keyword.

Question : 12
What do you mean by Constructor?


Answer : Constructor gets invoked when a new object is created. Every class has a constructor. If we do not explicitly write a constructor for a class the java compiler builds a default constructor for that class.

Question : 13
List the three steps for creating an Object for a class?


Answer : An Object is first declared, then instantiated and then it is initialized.

Question : 14
What is the default value of byte datatype in Java?


Answer : Default value of byte datatype is 0.

Question : 15
When a byte datatype is used?


Answer : This data type is used to save space in large arrays, mainly in place of integers, since a byte is four times smaller than an int.

Question : 16
What is a static variable?


Answer : Class variables also known as static variables are declared with the static keyword in a class, but outside a method, constructor or a block.

Question : 17
What do you mean by Access Modifier?


Answer : Java provides access modifiers to set access levels for classes, variables, methods and constructors. A member has package or default accessibility when no accessibility modifier is specified

Question : 18
What is protected access modifier?


Answer : Variables, methods and constructors which are declared protected in a superclass can be accessed only by the subclasses in other package or any class within the package of the protected members' class.

Question : 19
What do you mean by synchronized Non Access Modifier?


Answer : Java provides these modifiers for providing functionalities other than Access Modifiers, synchronized used to indicate that a method can be accessed by only one thread at a time.

Question : 20
: According to Java Operator precedence, which operator is considered to be with highest precedence?


Answer : Postfix operators i.e () [] . is at the highest precedence.

Question : 21
Variables used in a switch statement can be used with which datatypes?


Answer : Variables used in a switch statement can only be a byte, short, int, or char.

Question : 22
When parseInt() method can be used?


Answer : This method is used to get the primitive data type of a certain String.

Question : 23
Why is String class considered immutable?


Answer : The String class is immutable, so that once it is created a String object cannot be changed. Since String is immutable it can safely be shared between many threads ,which is considered very important for multithreaded programming.

Question : 24
Why is StringBuffer called mutable?


Answer : The String class is considered as immutable, so that once it is created a String object cannot be changed. If there is a necessity to make alot of modifications to Strings of characters then StringBuffer should be used.

Question : 25
What is the difference between StringBuffer and StringBuilder class?


Answer : Use StringBuilder whenever possible because it is faster than StringBuffer. But, if thread safety is necessary then use StringBuffer objects.

Question : 26
Which package is used for pattern matching with regular expressions?


Answer : java.util.regex package is used for this purpose.

Question : 27
java.util.regex consists of which classes?


Answer : java.util.regex consists of three classes: Pattern class, Matcher class and PatternSyntaxException class.

Question : 28
What is finalize() method?


Answer : It is possible to define a method that will be called just before an object's final destruction by the garbage collector. This method is called finalize( ), and it can be used to ensure that an object terminates cleanly.

Question : 29
What is an Exception?


Answer : An exception is a problem that arises during the execution of a program. Exceptions are caught by handlers positioned along the thread's method invocation stack

Question : 30
What do you mean by Checked Exceptions?


Answer : It is an exception that is typically a user error or a problem that cannot be foreseen by the programmer. For example, if a file is to be opened, but the file cannot be found, an exception occurs. These exceptions cannot simply be ignored at the time of compilation.

Question : 31
What do you mean by Checked Exceptions?


Answer : It is an exception that is typically a user error or a problem that cannot be foreseen by the programmer. For example, if a file is to be opened, but the file cannot be found, an exception occurs. These exceptions cannot simply be ignored at the time of compilation.

Question : 32
Explain Runtime Exceptions?


Answer : It is an exception that occurs that probably could have been avoided by the programmer. As opposed to checked exceptions, runtime exceptions are ignored at the time of compliation.

Question : 33
Which are the two subclasses under Exception class?


Answer : The Exception class has two main subclasses : IOException class and RuntimeException Class.

Question : 34
When throws keyword is used?


Answer : If a method does not handle a checked exception, the method must declare it using the throwskeyword. The throws keyword appears at the end of a method's signature.

Question : 35
When throw keyword is used?


Answer : An exception can be thrown, either a newly instantiated one or an exception that you just caught, by using throw keyword.

Question : 36
How finally used under Exception Handling?


Answer : The finally keyword is used to create a block of code that follows a try block. A finally block of code always executes, whether or not an exception has occurred.

Question : 37
What things should be kept in mind while creating your own exceptions in Java?


Answer : While creating your own exception: All exceptions must be a child of Throwable. If you want to write a checked exception that is automatically enforced by the Handle or Declare Rule, you need to extend the Exception class. You want to write a runtime exception, you need to extend the RuntimeException class.

Question : 38
Define Inheritance?


Answer : It is the process where one object acquires the properties of another. With the use of inheritance the information is made manageable in a hierarchical order.

Question : 39
When super keyword is used?


Answer : If the method overrides one of its superclass's methods, overridden method can be invoked through the use of the keyword super. It can be also used to refer to a hidden field

Question : 40
What is Polymorphism?


Answer : Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object.

Question : 41
What is Abstraction?


Answer : It refers to the ability to make a class abstract in OOP. It helps to reduce the complexity and also improves the maintainability of the system.

Question : 42
What is Abstract class


Answer : These classes cannot be instantiated and are either partially implemented or not at all implemented. This class contains one or more abstract methods which are simply method declarations without a body.

Question : 43
When Abstract methods are used?


Answer : If you want a class to contain a particular method but you want the actual implementation of that method to be determined by child classes, you can declare the method in the parent class as abstract.

Question : 44
What is Encapsulation?


Answer : It is the technique of making the fields in a class private and providing access to the fields via public methods. If a field is declared private, it cannot be accessed by anyone outside the class, thereby hiding the fields within the class. Therefore encapsulation is also referred to as data hiding.

Question : 45
What is the primary benefit of Encapsulation?


Answer : The main benefit of encapsulation is the ability to modify our implemented code without breaking the code of others who use our code. With this Encapsulation gives maintainability, flexibility and extensibility to our code.

Question : 46
What is an Interface?


Answer : An interface is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface.

Question : 47
Give some features of Interface?


Answer : It includes: Interface cannot be instantiated An interface does not contain any constructors. All of the methods in an interface are abstract.

Question : 48
Define Packages in Java?


Answer : A Package can be defined as a grouping of related types(classes, interfaces, enumerations and annotations ) providing access protection and name space management.

Question : 49
Why Packages are used?


Answer : Packages are used in Java in-order to prevent naming conflicts, to control access, to make searching/locating and usage of classes, interfaces, enumerations and annotations easier etc.

Question : 50
What do you mean by Multithreaded program?


Answer : A multithreaded program contains two or more parts that can run concurrently. Each part of such a program is called a thread, and each thread defines a separate path of execution.

Question : 51
What are the two ways in which Thread can be created?


Answer : Thread can be created by: implementing Runnable interface, extending the Thread class.

Question : 52
What is an applet?


Answer : An applet is a Java program that runs in a Web browser. An applet can be a fully functional Java application because it has the entire Java API at its disposal.

Question : 53
An applet extend which class?


Answer : An applet extends java.applet.Applet class.

Question : 54
Explain garbage collection in Java?


Answer : It uses garbage collection to free the memory. By cleaning those objects that is no longer reference by any of the program.

Question : 55
Define immutable object?


Answer : An immutable object cant be changed once it is created.

Question : 56
Explain the usage of this() with constructors?


Answer : It is used with variables or methods and used to call constructer of same class.

Question : 57
Explain Set Interface?


Answer : It is a collection of element which cannot contain duplicate elements. The Set interface contains only methods inherited from Collection and adds the restriction that duplicate elements are prohibited.

Question : 58
Explain TreeSet?


Answer : It is a Set implemented when we want elements in a sorted order.

Question : 59
What is Comparable Interface?


Answer : It is used to sort collections and arrays of objects using the collections.sort() and java.utils. The objects of the class implementing the Comparable interface can be ordered.

Question : 60
Difference between throw and throws?


Answer : It includes:
Throw is used to trigger an exception where as throws is used in declaration of exception.
Without throws, Checked exception cannot be handled where as checked exception can be propagated with throws.

Question : 61
Explain the following line used under Java Program: public static void main (String args[ ])


Answer : The following shows the explanation individually:
public: it is the access specifier.
static: it allows main() to be called without instantiating a particular instance of a class.
void: it affirns the compiler that no value is returned by main().
main(): this method is called at the beginning of a Java program.
String args[ ]: args parameter is an instance array of class String


Question : 62
Define JRE i.e. Java Runtime Environment?


Answer : Java Runtime Environment is an implementation of the Java Virtual Machine which executes Java programs. It provides the minimum requirements for executing a Java application.

Question : 63
What is JAR file?


Answer : JAR files is Java Archive fles and it aggregates many files into one. It holds Java classes in a library. JAR files are built on ZIP file format and have .jar file extension.

Question : 64
What is a WAR file?


Answer : This is Web Archive File and used to store XML, java classes, and JavaServer pages. which is used to distribute a collection of JavaServer Pages, Java Servlets, Java classes, XML files, static Web pages etc.

Question : 65
Define JIT compiler?


Answer : It improves the runtime performance of computer programs based on bytecode.

Question : 66
What is the difference between object oriented programming language and object based programming language?


Answer : Object based programming languages follow all the features of OOPs except Inheritance. JavaScript is an example of object based programming languages

Question : 67
What is the purpose of default constructor?


Answer : The java compiler creates a default constructor only if there is no constructor in the class.

Question : 68
Can a constructor be made final?


Answer : No, this is not possible.

Question : 69
What is static block?


Answer : It is used to initialize the static data member, It is excuted before main method at the time of classloading.

Question : 70
Define composition?


Answer : Holding the reference of the other class within some other class is known as composition.

Question : 71
What is function overloading?


Answer : If a class has multiple functions by same name but different parameters, it is known as Method Overloading.

Question : 72
What is function overriding?


Answer : If a subclass provides a specific implementation of a method that is already provided by its parent class, it is known as Method Overriding.

Question : 73
Difference between Overloading and Overriding?


Answer : Method overloading increases the readability of the program. Method overriding provides the specific implementation of the method that is already provided by its super class parameter must be different in case of overloading, parameter must be same in case of overriding.

Question : 74
What is final class?


Answer : Final classes are created so the methods implemented by that class cannot be overridden. It cant be inherited.

Question : 75
What is NullPointerException?


Answer : A NullPointerException is thrown when calling the instance method of a null object, accessing or modifying the field of a null object etc.

Question : 76
What are the ways in which a thread can enter the waiting state?


Answer : A thread can enter the waiting state by invoking its sleep() method, by blocking on IO, by unsuccessfully attempting to acquire an object's lock, or by invoking an object's wait() method. It can also enter the waiting state by invoking its (deprecated) suspend() method.

Question : 77
How does multi-threading take place on a computer with a single CPU?


Answer : The operating system's task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially.

Question : 78
What invokes a thread's run() method?


Answer : After a thread is started, via its start() method of the Thread class, the JVM invokes the thread's run() method when the thread is initially executed.

Question : 79
Does it matter in what order catch statements for FileNotFoundException and IOException are written?


Answer : Yes, it does. The FileNoFoundException is inherited from the IOException. Exception's subclasses have to be caught first.

Question : 80
What is the difference between yielding and sleeping?


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

Question : 81
Why Vector class is used?


Answer : The Vector class provides the capability to implement a growable array of objects. Vector proves to be very useful if you don't know the size of the array in advance, or you just need one that can change sizes over the lifetime of a program.

Question : 82
How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?


Answer : Unicode requires 16 bits and 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.

Question : 83
What are Wrapper classes?


Answer : These are classes that allow primitive types to be accessed as objects. Example: Integer, Character, Double, Boolean etc.

Question : 84
What is the difference between a Window and a Frame?


Answer : The Frame class extends Window to define a main application window that can have a menu bar.

Question : 85
Which package has light weight components?


Answer : javax.Swing package. All components in Swing, except JApplet, JDialog, JFrame and JWindow are lightweight components.

Question : 86
What is the difference between the paint() and repaint() methods?


Answer : 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.

Question : 87
What is the purpose of File class?


Answer : It is used to create objects that provide access to the files and directories of a local file system.

Question : 88
What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?


Answer : The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented.

Question : 89
Which class should you use to obtain design information about an object?


Answer : The Class class is used to obtain information about an object's design and java.lang.Class class instance represent classes, interfaces in a running Java application.

Question : 90
What is the difference between static and non-static variables?


Answer : A static variable is associated with the class as a whole rather than with specific instances of a class. Non-static variables take on unique values with each object instance.

Question : 91
What is Serialization and deserialization?


Answer : Serialization is the process of writing the state of an object to a byte stream. Deserialization is the process of restoring these objects.

Question : 92
What are use cases?


Answer : It is part of the analysis of a program and describes a situation that a program might encounter and what behavior the program should exhibit in that circumstance

Question : 93
Explain the use of sublass in a Java program?


Answer : Sub class inherits all the public and protected methods and the implementation. It also inherits all the default modifier methods and their implementation.

Question : 94
How to add menushortcut to menu item?


Answer : If there is a button instance called b1, you may add menu short cut by calling b1.setMnemonic('F'), so the user may be able to use Alt+F to click the button.

Question : 95
Can you write a Java class that could be used both as an applet as well as an application?


Answer : Yes, just add a main() method to the applet.

Question : 96
What is the difference between Swing and AWT components?


Answer : AWT components are heavy-weight, whereas Swing components are lightweight. Heavy weight components depend on the local windowing toolkit. For example, java.awt.Button is a heavy weight component, when it is running on the Java platform for Unix platform, it maps to a real Motif button.

Question : 97
What's the difference between constructors and other methods?


Answer : Constructors must have the same name as the class and can not return a value. They are only called once while regular methods could be called many times.

Question : 98
Is there any limitation of using Inheritance?


Answer : Yes, since inheritance inherits everything from the super class and interface, it may make the subclass too clustering and sometimes error-prone when dynamic overriding or dynamic overloading in some situation.

Question : 99
When is the ArrayStoreException thrown?


Answer : When copying elements between different arrays, if the source or destination arguments are not arrays or their types are not compatible, an ArrayStoreException will be thrown.

Question : 100
Can you call one constructor from another if a class has multiple constructors?


Answer : Yes, use this() syntax

Question : 101
the difference between the methods sleep() and wait()?


Answer : The code sleep(2000); puts thread aside for exactly two seconds. The code wait(2000), causes a wait of up to two second. A thread could stop waiting earlier if it receives the notify() or notifyAll() call. The method wait() is defined in the class Object and the method sleep() is defined in the class Thread.

Question : 102
When ArithmeticException is thrown?


Answer : The ArithmeticException is thrown when integer is divided by zero or taking the remainder of a number by zero. It is never thrown in floating-point operations.

Question : 103
What is a transient variable?


Answer : A transient variable is a variable that may not be serialized during Serialization and which is initialized by its default value during de-serialization,

Question : 104
What is synchronization?


Answer : Synchronization is the capability to control the access of multiple threads to shared resources. synchronized keyword in java provides locking which ensures mutual exclusive access of shared resource and prevent data race.

Question : 105
What is the Collections API?


Answer : The Collections API is a set of classes and interfaces that support operations on collections of objects.

Question : 106
Does garbage collection guarantee that a program will not run out of memory?


Answer : 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 they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection.

Question : 107
The immediate superclass of the Applet class?


Answer : Panel is the immediate superclass. A panel provides space in which an application can attach any other component, including other panels.

Question : 108
Which Java operator is right associative?


Answer : The = operator is right associative.

Question : 109
What is the difference between a break statement and a continue statement?


Answer : 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 loop iteration and return control to the loop statement.

Question : 110
If a variable is declared as private, where may the variable be accessed?


Answer : A private variable may only be accessed within the class in which it is declared.

Question : 111
What is the purpose of the System class?


Answer : The purpose of the System class is to provide access to system resources.

Question : 112
List primitive Java types?


Answer : The eight primitive types are byte, char, short, int, long, float, double, and boolean.

Question : 113
What is the relationship between clipping and repainting under AWT?


Answer : When a window is repainted by the AWT painting thread, it sets the clipping regions to the area of the window that requires repainting.

Question : 114
Which class is the immediate superclass of the Container class?


Answer : Component class is the immediate super class.

Question : 115
What class of exceptions are generated by the Java run-time system?


Answer : The Java runtime system generates RuntimeException and Error exceptions.

Question : 116
Under what conditions is an object's finalize() method invoked by the garbage collector?


Answer : The garbage collector invokes an object's finalize() method when it detects that the object has become unreachable.

Question : 117
How can a dead thread be restarted?


Answer : A dead thread cannot be restarted.

Question : 118
Which arithmetic operations can result in the throwing of an ArithmeticException?


Answer : Integer / and % can result in the throwing of an ArithmeticException.

Question : 119
Variable of the boolean type is automatically initialized as?


Answer : The default value of the boolean type is false.

Question : 120
Can try statements be nested?


Answer : Yes

Question : 121
What are ClassLoaders?


Answer : A class loader is an object that is responsible for loading classes. The class ClassLoader is an abstract class.

Question : 122
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.

Question : 123
What will happen if static modifier is removed from the signature of the main method?


Answer : Program throws "NoSuchMethodError" error at runtime .

Question : 124
What is the default value of an object reference declared as an instance variable?


Answer : Null, unless it is defined explicitly.

Question : 125
Can a top level class be private or protected?


Answer : No, a top level class can not be private or protected. It can have either "public" or no modifier.

Question : 126
Why do we need wrapper classes?


Answer : We can pass them around as method parameters where a method expects an object. It also provides utility methods.

Question : 127
What is the difference between error and an exception?


Answer : An error is an irrecoverable condition occurring at runtime. Such as OutOfMemory error. Exceptions are conditions that occur because of bad input etc. e.g. FileNotFoundException will be thrown if the specified file does not exist.

Question : 128
Is it necessary that each try block must be followed by a catch block?


Answer : It is not necessary that each try block must be followed by a catch block. It should be followed by either a catch block or a finally block.

Question : 129
When a thread is created and started, what is its initial state?


Answer : A thread is in the ready state as initial state after it has been created and started.

Question : 130
What is the Locale class?


Answer : The Locale class is used to tailor program output to the conventions of a particular geographic, political, or cultural region.

Question : 131
What are synchronized methods and synchronized statements?


Answer : Synchronized methods are methods that are used to control access to an object. A synchronized statement can only be executed after a thread has acquired the lock for the object or class referenced in the synchronized statement.

Question : 132
What is runtime polymorphism or dynamic method dispatch?


Answer : Runtime polymorphism or dynamic method dispatch is a process in which a call to an overridden method is resolved at runtime rather than at compile-time. In this process, an overridden method is called through the reference variable of a superclass.

Question : 133
What is Dynamic Binding(late binding)?


Answer : Binding refers to the linking of a procedure call to the code to be executed in response to the call. Dynamic binding means that the code associated with a given procedure call is not known until the time of the call at run-time.

Question : 134
Can constructor be inherited?


Answer : No, constructor cannot be inherited.

Question : 135
What are the advantages of ArrayList over arrays?


Answer : ArrayList can grow dynamically and provides more powerful insertion and search mechanisms than arrays.

Question : 136
Why deletion in LinkedList is fast than ArrayList?


Answer : : Deletion in linked list is fast because it involves only updating the next pointer in the node before the deleted node and updating the previous pointer in the node after the deleted node.

Question : 137
How do you decide when to use ArrayList and LinkedList?


Answer : If you need to frequently add and remove elements from the middle of the list and only access the list elements sequentially, then LinkedList should be used. If you need to support random access, without inserting or removing elements from any place other than the end, then ArrayList should be used.

Question : 138
What is a Values Collection View ?


Answer : It is a collection returned by the values() method of the Map Interface, It contains all the objects present as values in the map.

Question : 139
What is dot operator?


Answer : The dot operator(.) is used to access the instance variables and methods of class objects.It is also used to access classes and sub-packages from a package.

Question : 140
Where and how can you use a private constructor?


Answer : Private constructor is used if you do not want other classes to instantiate the object and to prevent subclassing.T

Question : 141
What is type casting?


Answer : casting means treating a variable of one type as though it is another type.

Question : 142
Describe life cycle of thread?


Answer : A thread is a execution in a program. The life cycle of a thread include:
Newborn state
Runnable state
Running state
Blocked state
Dead state


Question : 143
What is the difference between the >> and >>> operators?


Answer : The >> operator carries the sign bit when shifting right. The >>> zero-fills bits that have been shifted out.

Question : 144
Which method of the Component class is used to set the position and size of a component?


Answer : setBounds() method is used for this purpose.

Question : 145
What is the range of the short type?


Answer : The range of the short type is -(2^15) to 2^15 - 1.

Question : 146
What is the immediate superclass of Menu?


Answer : MenuItem class

Question : 147
Does Java allow Default Arguments?


Answer : No, Java does not allow Default Arguments.

Question : 148
Which number is denoted by leading zero in java?


Answer : Octal Numbers are denoted by leading zero in java, example: 06

Question : 149
Which number is denoted by leading 0x or 0X in java?


Answer : Hexadecimal Numbers are denoted by leading 0x or 0X in java, example: 0XF

Question : 150
Break statement can be used as labels in Java?


Answer : Yes, an example can be break one;

Question : 151
Where import statement is used in a Java program?


Answer : Import statement is allowed at the beginning of the program file after package statement.

Question : 152
Explain suspend() method under Thread class>


Answer : It is used to pause or temporarily stop the execution of the thread.

Question : 153
Explain isAlive() method under Thread class?


Answer : It is used to find out whether a thread is still running or not.

Question : 154
What is currentThread()?


Answer : It is a public static method used to obtain a reference to the current thread.

Question : 155
Explain main thread under Thread class execution?


Answer : The main thread is created automatically and it begins to execute immediately when a program starts. It ia thread from which all other child threads originate.

Question : 156
Life cycle of an applet includes which steps?


Answer : Life cycle involves the following steps:
Initialization
Starting
Stopping
Destroying
Painting


Question : 157
Why is the role of init() method under applets?


Answer : It initializes the applet and is the first method to be called.

Question : 158
Which method is called by Applet class to load an image?


Answer : getImage(URL object, filename) is used for this purpose.

Question : 159
Define code as an attribute of Applet?


Answer : It is used to specify the name of the applet class.

Question : 160
Define canvas?


Answer : It is a simple drawing surface which are used for painting images or to perform other graphical operations.

Question : 161
Define Network Programming?


Answer : It refers to writing programs that execute across multiple devices (computers), in which the devices are all connected to each other using a network.

Question : 162
What is a Socket?


Answer : Sockets provide the communication mechanism between two computers using TCP. A client program creates a socket on its end of the communication and attempts to connect that socket to a server.

Question : 163
Advantages of Java Sockets?


Answer : Sockets are flexible and sufficient. Efficient socket based programming can be easily implemented for general communications. It cause low network traffic.

Question : 164
Disadvantages of Java Sockets?


Answer : Socket based communications allows only to send packets of raw data between applications. Both the client-side and server-side have to provide mechanisms to make the data useful in any way.

Question : 165
Which class is used by server applications to obtain a port and listen for client requests?


Answer : java.net.ServerSocket class is used by server applications to obtain a port and listen for client requests.

Question : 166
Which class represents the socket that both the client and server use to communicate with each other?


Answer : java.net.Socket class represents the socket that both the client and server use to communicate with each other.

Question : 167
Why Generics are used in Java?


Answer : Generics provide compile-time type safety that allows programmers to catch invalid types at compile time. Java Generic methods and generic classes enable programmers to specify, with a single method declaration, a set of related methods or, with a single class declaration, a set of related types.

Question : 168
What environment variables do I need to set on my machine in order to be able to run Java programs?


Answer : CLASSPATH and PATH are the two variables.

Question : 169
Is there any need to import java.lang package?


Answer : No, there is no need to import this package. It is by default loaded internally by the JVM.

Question : 170
What is Nested top-level class?


Answer : If a class is declared within a class and specify the static modifier, the compiler treats the class just like any other top-level class. Nested top-level class is an Inner class.

Question : 171
What is Externalizable interface?


Answer : What is Externalizable interface?

Question : 172
If System.exit (0); is written at the end of the try block, will the finally block still execute?


Answer : No in this case the finally block will not execute because when you say System.exit (0); the control immediately goes out of the program, and thus finally never executes.

Question : 173
What is daemon thread?


Answer : Daemon thread is a low priority thread which runs intermittently in the back ground doing the garbage collection operation for the java runtime system.

Question : 174
Which method is used to create the daemon thread?


Answer : setDaemon method is used to create a daemon thread.

Question : 175
Which method must be implemented by all threads?


Answer : All tasks must implement the run() method

Question : 176
What is the GregorianCalendar class?


Answer : The GregorianCalendar provides support for traditional Western calendars

Question : 177
What is the SimpleTimeZone class?


Answer : The SimpleTimeZone class provides support for a Gregorian calendar

Question : 178
What is the difference between the size and capacity of a Vector?


Answer : The size is the number of elements actually stored in the vector, while capacity is the maximum number of elements it can store at a given instance of time.

Question : 179
Can a vector contain heterogenous objects?


Answer : Yes a Vector can contain heterogenous objects. Because a Vector stores everything in terms of Object.

Question : 180
What is an enumeration?


Answer : An enumeration is an interface containing methods for accessing the underlying data structure from which the enumeration is obtained. It allows sequential access to all the elements stored in the collection.

Question : 181
What is difference between Path and Classpath?


Answer : Path and Classpath are operating system level environment variales. Path is defines where the system can find the executables(.exe) files and classpath is used to specify the location of .class files.

Question : 182
Can a class declared as private be accessed outside it's package?


Answer : No, it's not possible to accessed outside it's package.

Question : 183
What are the restriction imposed on a static method or a static block of code?


Answer : A static method should not refer to instance variables without creating an instance and cannot use "this" operator to refer the instance.

Question : 184
Can an Interface extend another Interface?


Answer : Yes an Interface can inherit another Interface, for that matter an Interface can extend more than one Interface.

Question : 185
Which object oriented Concept is achieved by using overloading and overriding?


Answer : Polymorphism

Question : 186
What is an object's lock and which object's have locks?


Answer : An object's lock is a mechanism that is used by multiple threads to obtain synchronized access to the object. A thread may execute a synchronized method of an object only after it has acquired the object's lock.

Question : 187
What is Downcasting?


Answer : It is the casting from a general to a more specific type, i.e. casting down the hierarchy.

Question : 188
What are order of precedence and associativity and how are they used?


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

Question : 189
If a method is declared as protected, where may the method be accessed?


Answer : 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.

Question : 190
What is the difference between inner class and nested class?


Answer : When a class is defined within a scope of another class, then it becomes inner class. If the access modifier of the inner class is static, then it becomes nested class.

Question : 191
What restrictions are placed on method overriding?


Answer : 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.

Question : 192
What is constructor chaining and how is it achieved in Java?


Answer : A child object constructor always first needs to construct its parent. In Java it is done via an implicit call to the no-args constructor as the first statement.

Question : 193
Can a double value be cast to a byte?


Answer : Yes, a double value can be cast to a byte.

Question : 194
How does a try statement determine which catch clause should be used to handle an exception?


Answer : When an exception is thrown within the body of a try statement, the catch clauses of the try statement are examined in the order in which they appear. The first catch clause that is capable of handling the exception is executed. The remaining catch clauses are ignored.

Question : 195
What will be the default values of all the elements of an array defined as an instance variable?


Answer : If the array is an array of primitive types, then all the elements of the array will be initialized to the default value corresponding to that primitive type.

Question : 196
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.

Question : 197
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.

Question : 198
Describe synchronization in respect to multithreading.


Answer : With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchonization, 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.

Question : 199
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.

Question : 200
What is the difference between a "where" clause and a "having" clause?


Answer : "Where" is a kind of restiriction statement. You use where clause to restrict all the data from DB.Where clause is using before result retrieving. But Having clause is using after retrieving the data.Having clause is a kind of filtering command.

Question : 201
What is the basic form of a SQL statement to read data out of a table?


Answer : The basic form to read data out of table is SELECT * FROM table_name; An answer: SELECT * FROM table_name WHERE xyz= whatever; cannot be called basic form because of WHERE clause.

Question : 202
What structure can you implement for the database to speed up table reads?


Answer : Follow the rules of DB tuning we have to:
Properly use indexes ( different types of indexes)
properly locate different DB objects across different tablespaces, files and so on
create a special space (tablespace) to locate some of the data with special datatype ( for example CLOB, LOB and )

Question : 203
What are the tradeoffs with having indexes?


Answer : Faster selects, slower updates.

Extra storage space to store indexes. Updates are slower because in addition to updating the table you have to update the index.

Question : 204
What is a "join"?


Answer : Join used to connect two or more tables logically with or without common field.

Question : 205
What is "normalization"? "Denormalization"? Why do you sometimes want to denormalize?


Answer : Normalizing data means eliminating redundant information from a table and organizing the data so that future changes to the table are easier. Denormalization means allowing redundancy in a table. The main benefit of denormalization is improved performance with simplified data retrieval and manipulation. This is done by reduction in the number of joins needed for data processing.

Question : 206
What is a "constraint"?


Answer : A constraint allows you to apply simple referential integrity checks to a table. There are four primary types of constraints that are currently supported by SQL Server: PRIMARY/UNIQUE - enforces uniqueness of a particular table column. DEFAULT - specifies a default value for a column in case an insert operation does not provide one. FOREIGN KEY - validates that every value in a column exists in a column of another table. CHECK - checks that every value stored in a column is in some specified list. Each type of constraint performs a specific type of action. Default is not a constraint. NOT NULL is one more constraint which does not allow values in the specific column to be null. And also it is the only constraint which is not a table level constraint.

Question : 207
What types of index data structures can you have?


Answer : An index helps to faster search values in tables. The three most commonly used index-types are: - B-Tree: builds a tree of possible values with a list of row IDs that have the leaf value. Needs a lot of space and is the default index type for most databases. - Bitmap: string of bits for each possible value of the column. Each bit string has one bit for each row. Needs only few space and is very fast.(however, domain of value cannot be large, e.g. SEX(m,f); degree(BS,MS,PHD) - Hash: A hashing algorithm is used to assign a set of characters to represent a text string such as a composite of keys or partial keys, and compresses the underlying data. Takes longer to build and is supported by relatively few databases.

Question : 208
What is a "primary key"?


Answer : A PRIMARY INDEX or PRIMARY KEY is something which comes mainly from database theory. From its behavior is almost the same as an UNIQUE INDEX, i.e. there may only be one of each value in this column. If you call such an INDEX PRIMARY instead of UNIQUE, you say something about your table design, which I am not able to explain in few words. Primary Key is a type of a constraint enforcing uniqueness and data integrity for each row of a table. All columns participating in a primary key constraint must possess the NOT NULL property.

Question : 209
What is a "functional dependency"? How does it relate to database table design?


Answer : Functional dependency relates to how one object depends upon the other in the database. for example, procedure/function sp2 may be called by procedure sp1. Then we say that sp1 has functional dependency on sp2.

Question : 210
What is a "trigger"?


Answer : Triggers are stored procedures created in order to enforce integrity rules in a database. A trigger is executed every time a data-modification operation occurs (i.e.,insert, update or delete). Triggers are executed automatically on occurance of one of the data-modification operations. A trigger is a database object directly associated

Question : 211
Why can a "group by" or "order by" clause be expensive to process?


Answer : Processing of "group by" or "order by" clause often requires creation of temporary tables to process the results of the query, which is depending of the resultset can be very expensive.

Question : 212
What is "index covering" of a query?


Answer : Index covering means that "Data can be found only using indexes, without touching the tables"

Question : 213
Explain MySQL architecture.


Answer : The front layer takes care of network connections and security authentications, the middle layer does the SQL query parsing, and then the query is handled off to the storage engine. A storage engine could be either a default one supplied with MySQL (MyISAM) or a commercial one supplied by a third-party vendor (ScaleDB, InnoDB, etc.)

Question : 214
Explain MySQL locks.


Answer : Table-level locks allow the user to lock the entire table, page-level locks allow locking of certain portions of the tables (those portions are referred to as tables),row-level locks are the most granular and allow locking of specific rows.

Question : 215
Explain multi-version concurrency control in MySQL.


Answer : Each row has two additional columns associated with it - creation time and deletion time, but instead of storing timestamps, MySQL stores version numbers.

Question : 216
What are MySQL transactions?


Answer : A set of instructions/queries that should be executed or rolled back as a single atomic unit.

Question : 217
Which property of a Web page automatically saves the values of the page and of each control prior to rendering of the page?


Answer : ViewState property

Question : 218
What are persistent cookies?


Answer : Persistent cookies are cookies that are stored on the hard disk of the client computer. Persistent cookies have a name and an expiry date.

Question : 219
How does a Web browser access a cookie?


Answer : A web browser can access a cookie from HttpCookieCollection by using the Request object.

Question : 220
In which type of authentication mechanism, the user credentials are transmitted over the network in an encrypted form?


Answer : Digest

Question : 221
Which file is used to specify the authorization details of a Web site?


Answer : Web.config

Question : 222
What are the two types of configuration files supported by ASP.NET? What is the difference between the two types of file?


Answer : The two types of configuration files are machine.config and Web.config. The machine.config file is automatically installed when you install Visual Studio .NET. The machine.config file is installed on the server in the %windir%\Microsoft.NET\Framework\ v1.0.3328\Config file.

Question : 223
Why should we use the XML format to store data in an ASP.NET application?


Answer : eXtensible Markup Language (XML) enables you to store data in a structured, hardware- and software-independent, text-based format that can be described and exchanged by multiple Web applications. Therefore, to enable different Web applications to use your data, we should use the XML data format to store data in an ASP.NET application.

Question : 224
What is an XML Web server control?


Answer : An XML Web server control is used to display the contents of an XML document without formatting or using XSL transformations.

Question : 225
Can the Index Server point to documents residing on other servers?


Answer : Yes. Because the Index Server can index any virtual directory, it can work with a central index for applications such as ISP by pointing to files on other servers.

Question : 226
What are server-side scripts?


Answer : Code written in any server-side scripting language, such as Active Server Pages (ASPs) and Java Server Pages (JSPs) are known as server-side scripts.

Question : 227
What is the role of Internet Information Services (IIS) in relation to a Web page developed using ASP.NET?


Answer : After you have developed a Web page, you need to publish it. To publish a Web page that you developed by using ASP.NET, you need to store the Web page in the virtual directory of a Web server. Since ASP.NET is built for the Windows platform, you need to have IIS, the default Web server for Windows, to publish a Web page.

Question : 228
What is ASP.NET?


Answer : Active Server Pages.NET (ASP.NET) is the .NET version of ASP provided by Microsoft that helps develop real world Web applications.

Question : 229
Which platforms are required to run ASP.NET?


Answer : ASP.NET runs on either IIS5 or IIS4. VS6 or Notepad can be used to edit ASP.NET applications. You can also use VS7 that has WYSIWYG Designers and Debuggers for VB, C#,and C++.

Question : 230
What is the difference between a Weak Entity and a Sub Entity?


Answer : A Weak entity depends upon a regular entity for its existence whereas a Sub entity is part of a Regular entity. For example, an entity called Students is used to store all student details. Now, every student is enrolled for a course and there are some students who have taken a break from the course. In this kind of a scenario, we can have a Sub entity called Break-Students, which stores details of all students who have currently taken a break. Note that a Sub entity will contain all the columns of the super-entity from which it is derived. A Weak entity on the other hand has attributes that are different from those of the regular entity on which it is dependent.

Question : 231
What is the difference between a Weak entity and a Regular entity?


Answer : A Weak entity depends upon a regular entity for its existence. For example, the entity called Children depends on the entity Employee for its existence. If an Employee resigns, then the corresponding records for the specific employee from the table Children is also removed.

Question : 232
What is JDK?


Answer : JDK stands for Java Development Kit. One of the reasons why Java is so popular is the availability of rich sets of packages that make the development of Web-based applications easier. Some of the classes in these packages are reusable and therefore can be enhanced to suit our application specific requirements.

Question : 233
What is the significance of the .class file?


Answer : The .class file contains the Java bytecode. You can invoke a Java program by loading the .class file into Java Runtime Environment. You can show the contents of a .class file by giving the command, javap c

Question : 234
How many classes can be declared in a Java program?


Answer : One public class and infinite non-public classes.

Question : 235
How is the main() method invoked?


Answer : The main() method is invoked by the Class Loader component of Java Virtual Machine.

Question : 236
How many classes can contain the main() method in a Java program?


Answer : Only one class can contain the main() method.

Question : 237
What is the out object?


Answer : out is a static instance of the PrintStream class declared in the System class.

Question : 238
Why do you need to put an f' literal after a floating point constant?


Answer : The 'f' suffix directs the compiler to create a float value from a sequence of characters representing a float literal. The compiler will otherwise, by default, create a double value or an int value.

Question : 239
Does Java support multiple inheritance?


Answer : No. In Java you can inherit only from one immediate superclass but can implement any number of interfaces.

Question : 240
Can I instantiate an interface?


Answer : No. You can instantiate a class which implements an interface.

Question : 241
What is the return value of the getContentPane()method?


Answer : The return value of the getContentPane() method returns a Container, which refers to the contentPane object.

Question : 242
What is the difference between a frame and a dialog box?


Answer : The frames can contain menus and are resizable but the dialog box can neither contain menus nor be resized.

Question : 243
Can you write a java code that works both as an applet and an application?


Answer : Yes. You simply need to add the main() method in your applet program and create a frame in the main() method.

Question : 244
Can I put more than one applet on a Web page?


Answer : Yes. You would require to put multiple applet tags in the Web page in which you want to have more than one applet.

Question : 245
How do I determine the width and the height of my applet?


Answer : Use the getSize()method to determine the dimensions of your applet.

Question : 246
Should applets have constructors?


Answer : The init() method can be used to initialize an applet. However, it is not wrong if constructors are coded in applets.

Question : 247
Why do I get RuntimeAccessPermission exception when I am trying to execute a Java program which will load an image?


Answer : Use the PolicyTool utility to specify the permission.

Question : 248
Why does my program not load the image even when the gif files are present in the specified directory?


Answer : Your monitor should support a minimum of 256 colors to load the image.

Question : 249
When do I need to flush an output stream?


Answer : Invoke flush on a stream whenever you want the output to be sent to the other end of the output connection immediately.

Question : 250
What is the advantage of Buffered streams over normal streams?


Answer : Better performance (similar to that offered by the cache).

Question : 251
How do I read a line of input at a time?


Answer : Use the readLine member functions of the BufferedReader class.

Question : 252
What is meant by Serialization?


Answer : The saving of an object for implementing persistence is known as serialization.

Question : 253
What is the difference between a "where" clause and a "having" clause?


Answer : "Where" is a kind of restiriction statement. You use where clause to restrict all the data from DB.Where clause is using before result retrieving. But Having clause is using after retrieving the data.Having clause is a kind of filtering command.

Question : 254
What is the basic form of a SQL statement to read data out of a table?


Answer : The basic form to read data out of table is SELECT * FROM table_name; An answer: SELECT * FROM table_name WHERE xyz= whatever; cannot be called basic form because of WHERE clause.

Question : 255
What structure can you implement for the database to speed up table reads?


Answer : Follow the rules of DB tuning we have to: Properly use indexes ( different types of indexes) properly locate different DB objects across different tablespaces, files and so on create a special space (tablespace) to locate some of the data with special datatype ( for example CLOB, LOB and )

Question : 256
What are the tradeoffs with having indexes?


Answer : Faster selects, slower updates. Extra storage space to store indexes. Updates are slower because in addition to updating the table you have to update the index.

Question : 257
What is database?


Answer : A database is a logically coherent collection of data with some inherent meaning, representing some aspect of real world and which is designed, built and populated with data for a specific purpose.

Question : 258
Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables?


Answer : Data Definition Language (DDL)

Question : 259
What operator performs pattern matching?


Answer : LIKE operator

Question : 260
What operator tests column for the absence of data?


Answer : IS NULL operator

Question : 261
Which command executes the contents of a specified file?


Answer : START or @

Question : 262
What are the wildcards used for pattern matching?


Answer : _ for single character substitution and % for multi-character substitution

Question : 263
State true or false. EXISTS, SOME, ANY are operators in SQL.


Answer : True

Question : 264
State true or false. !=, <>, ^= all denote the same operation.


Answer : True

Question : 265
What are the privileges that can be granted on a table by a user to others?


Answer : Insert, update, delete, select, references, index, execute, alter, all

Question : 266
What command is used to get back the privileges offered by the GRANT command?


Answer : REVOKE

Question : 267
Which system tables contain information on privileges granted and privileges obtained?


Answer : USER_TAB_PRIVS_MADE, USER_TAB_PRIVS_RECD

Question : 268
Which system table contains information on constraints on all the tables created?


Answer : USER_CONSTRAINTS

Question : 269
What is the difference between TRUNCATE and DELETE commands?


Answer : TRUNCATE is a DDL command whereas DELETE is a DML command. Hence DELETE operation can be rolled back, but TRUNCATE operation cannot be rolled back. WHERE clause can be used with DELETE and not with TRUNCATE.

Question : 270
What command is used to create a table by copying the structure of another table?


Answer : CREATE TABLE .. AS SELECT command

Question : 271
What does the following query do? SELECT SAL + NVL(COMM,0) FROM EMP;


Answer : This displays the total salary of all employees. The null values in the commission column will be replaced by 0 and added to salary.

Question : 272
Which date function is used to find the difference between two dates?


Answer : MONTHS_BETWEEN

Question : 273
Why does the following command give a compilation error?


Answer : DROP TABLE &TABLE_NAME;

Question : 274
What is the advantage of specifying WITH GRANT OPTION in the GRANT command?


Answer : The privilege receiver can further grant the privileges he/she has obtained from the owner to any other user.

Question : 275
What is the difference between strstr & stristr?


Answer : For strstr, the syntax is: string strstr(string $string,string $str ); The function strstr will search $str in $string. If it finds the string, it will return string from where it finds the $str upto end of $string. For Example: $string = "http://yahoomail.com"; $str="yahoomail"; The output is "yahoomail.com". The main difference between strstr and stristr is of case sensitivity. The former consider the case difference and later ignore the case difference.

Question : 276
What is the difference between explode and split?


Answer : Split function splits string into array by regular expression. Explode splits a string into array by string. For Example: explode(" and", "India and Pakistan and Srilanka"); split(" :", "India : Pakistan : Srilanka"); Both of these functions will return an array that contains India, Pakistan, and Srilanka.

Question : 277
How can you avoid execution time out error while fetching record from MySQL?


Answer : set_time_limit - Limits the maximum execution time For Example: set_time_limit(0); If you set to 0 you say that there is not limit.

Question : 278
What is the difference between require() and include()?


Answer : Both of these constructs includes and evaluates the specific file. The two functions are identical in every way except how they handle failure. If filepath not found,require() terminates the program and gives fatal error, but include() does not terminate the program; It gives warning message and continues to program. include() produces a Warning while require() results in a Fatal Error if the filepath is not correct.

Question : 279
What is the difference between echo and print?


Answer : Main difference between echo() and print() is that echo is just an statement not a function and doesn't return's value or it just prints a value whereas print() is an function which prints a value and also it returns value. We cannot pass arguments to echo since it is just a statement whereas print is a function and we can pass arguments to it and it returns true or false. print can be used as part of a more complex expression whereas echo cannot. echo is marginally faster since it doesn't set a return value.

Question : 280
What's the difference between COPY OF A FILE & MOVE_UPLOAD_FILE in file uploading?


Answer : Move: This function checks to ensure that the file designated by filename is a valid upload file (meaning that it was uploaded via PHP's HTTP POST upload mechanism). If the file is valid, it will be moved to the filename given by destination. If filename is not a valid upload file, then no action will occur, and move_uploaded_file() will return FALSE. Copy: Makes a copy of a file. Returns TRUE if the copy succeeded, FALSE otherwise.

Question : 281
How do you insert single & double quotes in MySQL db without using PHP?


Answer : & / "e; Alternately, escape single quote using forward slash ' . In double quote you don't need to escape quotes. Insert double quotes as "".

Question : 282
What do you need to do to improve the performance (speedy execution) for the script you have written?


Answer : If your script is to retrieve data from Database, you should use "Limit" syntax. Break down the non dynamic sections of website which need not be repeated over a period of time as include files.

Question : 283
How do you capture audio/video in PHP?


Answer : You need a module installed - FFMPEG. FFmpeg is a complete solution to record,convert and stream audio and video. It includes libavcodec, the leading audio/video codec library. FFmpeg is developed under Linux, but it can be compiled under most operating systems, including Windows.

Question : 284
How do you know (status) whether the recipient of your mail had opened the mail i.e. read the mail?


Answer : Embed an URL in a say 0-byte image tag may be the better way to go. In other word,you embed an invisible image on you html email and when the src URL is being rendered by the server, you can track whether your recipients have view the emails or not.

Question : 285
What is a random number?


Answer : A random number is a number generated by a process, whose outcome is unpredictable, and which cannot be sub sequentially reliably reproduced.

Question : 286
What is difference between srand & shuffle?


Answer : The srand function seeds the random number generator with seed and shuffle is used for shuffling the array values. shuffle - This function shuffles (randomizes the order of the elements in) an array. This function assigns new keys for the elements in array. It will remove any existing keys you may have assigned, rather than just reordering the keys. srand - Seed the random number generator

Question : 287
How can we remove duplicate values from an array?


Answer : array_unique() funciton can be used for the purpose.

Question : 288
How can we submit a form without a submit button?


Answer : We can submit a form using the JavaScript. Example: document.formname.submit();

Question : 289
What is difference between mysql_connect and mysql_pconnect?


Answer : mysql_connect opens up a database connection every time a page is loaded. mysql_pconnect opens up a connection, and keeps it open across multiple requests. mysql_pconnect uses less resources, because it does not need to establish a database connection every time a page is loaded.

Question : 290
How I can get IP address?


Answer : getenv("REMOTE_ADDR");

Question : 291
What is CAPTCHA?


Answer : CAPTCHA stands for Completely Automated Public Turing Test to tell Computers and Humans Apart. To prevent spammers from using bots to automatically fill out forms, CAPTCHA programmers will generate an image containing distorted images of a string of numbers and letters. Computers cannot determine what the numbers and letters are from the image but humans have great pattern recognition abilities and will be able to fairly accurately determine the string of numbers and letters. By entering the numbers and letters from the image in the validation field, the application can be fairly assured that there is a human client using it.

Question : 292
What is the difference between sizeof($array) and count($array)?


Answer : sizeof($array) - This function is an alias of count() count($array) - If you just pass a simple variable instead of an array it will return 1.

Question : 293
What are the different types of errors in PHP?


Answer : 1. Notices: These are trivial, non-critical errors that PHP encounters while executing a script - for example, accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all - although you can change this default behavior. 2. Warnings: These are more serious errors - for example, attempting to include() a file which does not exist. By default, these errors are displayed to the user, but they do not result in script termination. 3. Fatal errors: These are critical errors - for example, instantiating an object of a nonexistent class, or calling a non-existent function. These errors cause the immediate termination of the script, and PHPs default behavior is to display them to the user when they take place.

Question : 294
What is the difference between the functions unlink and unset?


Answer : unlink is a function for file system handling. It will simply delete the file in context. unset will set UNSET the specified variable. unlink is used to delete a file. unset is used to destroy an earlier declared variable.

Question : 295
What is meant by urlencode() and urldecode()?


Answer : string urlencode(str) When str contains a string like this hello world and the return value will be URL encoded and can be use to append with URLs, normally used to append data for GET like someurl.com?var=hello%world string urldocode(str) This will simple decode the GET variables value. Example: echo (urldecode($_GET_VARS[var])) will output hello world

Question : 296
How do you define a constant?


Answer : Constants in PHP are defined using define() directive, like define("MYCONSTANT", 100);

-and-via-">Question : 297
What"s the difference between accessing a class method via -> and via ::?


Answer : In PHP, :: is allowed to access methods that can perform static operations, i.e. those, which do not require object initialization.

Question : 298
What"s the difference between htmlentities() and htmlspecialchars()?


Answer : htmlspecialchars only takes care of <, >, single quote ", double quote " and ampersand. htmlentities translates all occurrences of character sequences that have different meaning in HTML.

Question : 299
What"s the difference between md5(), crc32() and sha1() crypto on PHP?


Answer : The major difference is the length of the hash generated. CRC32 is, evidently, 32 bits, while sha1()returns a 128 bit value, and md5() returns a 160 bit value. This is important when avoiding collisions.

Question : 300
What is the difference between HTML and HTML5 ?


Answer : HTML5 is nothing more then upgreaded version of HTML where in HTML5 Lot of new future like Video, Audio/mp3, date select function , placeholder , Canvas, 2D/3D Graphics, Local SQL Database added so that no need to do external plugin like Flash player or other library

Question : 301
What is the ? Is it necessary to use in HTML5 ?


Answer : The is an instruction to the web browser about what version of HTML the page is written in. AND The tag does not have an end tag and It is not case sensitive. The declaration must be the very first thing in HTML5 document, before the tag. As In HTML 4.01, all declarations require a reference to a Document Type Definition (DTD), because HTML 4.01 was based on Standard Generalized Markup Language (SGML). WHERE AS HTML5 is not based on SGML, and therefore does not require a reference to a Document Type Definition (DTD).

Question : 302
How many New Markup Elements you know in HTML5


Answer : Below are the New Markup Elements added in HTML5 Tag Description ===================================================================
Specifies independent, self-contained content, could be a newsarticle, blog post, forum post, or other articles which can be distributed independently from the rest of the site.
CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad