Pages

Friday, 2 January 2015

Java Programming

Java Programming



1.     What is Volatile variable in java?
Volatile keyword in Java is used as an indicator to Java compiler and Thread that do not cache value of this variable and always read it from main memory.
In Multi-threaded Programming, when multiple threads using the same variable, each thread will have its own copy of the local cache for that variable. So, when it's updating the value, it is actually updated in the local cache not in the main variable memory. The other thread which is using the same variable doesn't know anything about the values changed by another thread. To avoid this problem, if you declare a variable as volatile, then it will not be stored in the local cache. Whenever threads are updating the values, it is updated to the main memory. So, other threads can access the updated value. 
2.     What is Deadlock? How to avoid Deadlock in java?
Deadlock is a situation where a thread is waiting for an object lock that another thread holds, and this second thread is waiting for an object lock that the first thread holds.
3.     What is Transient Variable in java?
Transient variables cannot be serialized.  The fields marked as a Transient in a serializable object will not be transmitted in the byte stream. An Example would be a file handle, a database connection, a system thread etc. such objects are only meaningful locally. So, they should be marked as transient in a serializable class.

4.     What is Java Serial Version ID?
Say you create a “Car” class, instance it, and write it out to an object stream. The flattened car object sits in the file system for some time. Meanwhile, if the “car” class is modified by adding a new field. Later, when you try to deserialize the flattened “car” object, you get the java.io.InvalidClassException-because all serializable classes are automatically given a Unique Identifier. This exception is thrown when the identifier of the class is not equal to the identifier of the flattened object. If you really think about it, the exception is thrown because of addition of the new field. You can avoid this exception being thrown by controlling the versioning yourself by declaring an explicit serialVersionUID. There is a small performance benefit in explicitly declaring your serialVersionUID.
5.     What is URL Rewriting?
URL Rewriting is another way to support anonymous session tracking. With URL Rewriting, every local URL the user might click on is dynamically modified, or rewritten, to include extra information. The extra information can be in the form of extra path information, added parameters, or some custom, server-specific URL change. Due to limited space available in rewriting a URL, the extra information is usually limited to a unique session ID. For example, the following URL’s have been rewritten to pass the Session ID 123,
6.     Are Servlets Thread Safe? How to achieve thread safety in Servlets?
Servlets are not thread-safe by itself. You can make it thread-safe by making the service method synchronized, but this reduces the performance, as the servlet cannot process the request from other user until the service method is finished. The best way to keep your unsafe code thread-safe is keep the few lines of code inside synchronized block.
7.     How can I enable session tracking for JSP pages if the browser has disabled cookies?
We know that session tracking uses cookies by default to associate a session identifier with a unique user. If the browser does not support cookies or if cookies are disabled. You can still enable session tracking using URL Rewriting. URL rewriting essentially include the session ID within the link itself as name/value pair. However, for this effective, you need to embed the session ID for each and every link that is part of your Servlet response. Adding the session ID to a link is greatly simplified by means of a couple of methods: response.encodeURL() associates a session ID with a given URL and if you are using redirection, response.encodeRedirectURL() can be used by giving the redirected URL as input. Both encodeURL() and encodeRedirectURL() first determine whether supported by the browser. If so, the input URL is returned unchanged since the session ID will be persisted as cookie.
8.     What is the Difference between byte stream and Character streams?
To generate User reports, send attachments through mails and spill out data files from Java programs.
Byte stream: Byte stream classes have been designed to provide functional features for creating and manipulating streams and files for reading and writing in a form of bytes. Since the streams are unidirectional, they can transmit bytes in only one direction and, therefore, Java provides two kinds of byte stream classes:
Output stream classes
Input stream classes
  • Performing InputStream operations or OutputStream operations means generally having a loop that reads the input stream and writes the output stream one byte at a time.
  • You can use buffered I/O streams for an overhead reduction (overhead generated by each such request often triggers disk access, network activity, or some other operation that is relatively expensive).
Character streams: Character streams work with the characters rather than the byte. In Java, characters are stored by following the Unicode (allows a unique number for every character) conventions. Like ByteStreams, there are two kinds of character stream classes
Reader stream classes
Writer stream classes
9.     What is Autoboxing?
Autoboxing is the process by which a primitive type is automatically encapsulated (boxed) into its equivalent type wrapper whenever an object of that type is needed. There is no need to explicitly construct an object. Auto unboxing is the process by which the value of a boxed object is automatically extracted (unboxed) from a type wrapper when its value is needed. There is no need to call a method such as intValue( ) or doubleValue( ).
10.              What's the difference between normal methods and constructors?
Normal method can be called anywhere and any more of times but constructors can be called only when an object is created. Normal method can have any name but constructor name should be same as that of a class name. Normal method should have a return type but constructor should not a have a return type.
11.              What is the difference between the ServletConfig and ServletContext interface?
•      ServletConfig is implemented by the servlet container to initialize a single servlet using init(). That is, you can pass initialization parameters to the servlet using the web.xml deployment descriptor. For understanding, this is similar to a constructor in a java class.
•      ServletContext is implemented by the servlet container for all servlet to communicate with its servlet container, for example, to get the MIME type of a file, to get dispatch requests, or to write to a log file. That is to get detail about its execution environment. It is applicable only within a single Java Virtual Machine. If a web applicationa is distributed between multiple JVM this will not work. For understanding, this is like a application global variable mechanism for a single web application deployed in only one JVM.
•      The ServletContext object is contained within the ServletConfig object. That is, the ServletContext can be accessed using the ServletConfig object within a servlet. You can specify param-value pairs for ServletContext object in <context-param> tags in web.xml file.
•      The scope of the ContextInitParameter is within a web containter, whereas  scope of the ServletInitParameter is for a specific servlet or jsp
•      The Servlet code of the ServletContext is getServletContext(). Whereas for ServletConfig is getServletConfig()
•      Deployment descriptor for ServletContext is  within the <Web-app> element byt not  within a specific <Servlet>element, whereas for ServletConfig within the <Servlet> element for each specific  servlet.

12.              What is the difference between forward() and sendRedirect() method?
A forward()  performs forward internally by the servlet. Whereas A redirect is performed in two steps process, where the web application instructs the browser to fetch a second URL, which differ from the original.
13.              Why session tracking is need in web application? How to perform Session tracking.
HTTP protocol is a “stateless” protocol. Each time a client retrieves a web page it establish a separate connection to the web server, and the server does bit automatically maintain contextual information about a client. Even with servers that support persistent HTTP connections and keep a socket open for multiple client requests that occur close together in time, there is no built-in support for maintaining contextual information. This lack of context causes a number of difficulties. For example, when clients at an on-line shopping add an item to their shopping carts, the server doesn’t know the things already in them. Similarly, when clients decide to proceed to checkout, the server cannot determine the previously created shopping carts.
There are three solutions to solve problem:
•        Cookies
•        URL-rewriting
•        Hidden form fields
14.              How to declare a method within a JSP page?
You can declare methods to use within your JSP pag as declarations. The methods can then be invoked within any other methods you declare, or within JSP scriptlets and expressions. We cannot access any JSP implicit objects like request, response, out, session directly from within JSP methods. However, we can able to pass any of the implicit JSP variables as parameters to the methods you declare.
For example:
<%!
 String displaydata(String name){
return name;
}
%>
<%=displaydata(“Hello”);%>
15.              What is the difference between JSP include directive and JSP action include tag?
When a JSP include directive is used the included file’s code is added into the added JSP page at the time of page translation, that is this happens before the JSP page is translated into a Servlet. Whereas in action include tag Includes a file at the time the page is requested.

Sakthi Software Solutions pvt ltd,
RVR Towers, 4th Floor, No.1, AA Block,
1st Street, 3rd Main Road, Annanagar, Chennai 600 040.
Landmark: Annanagar Roundtana, Behind Nalli Silks Showroom,
Phone: 9600035403
website: http://sssedu.in/java-training-in-chennai.html


Thursday, 1 January 2015

Software Development Life Cycle

1.What is SDLC ?

         It is a procedure to develop the software.
         SDLC is a process which includes various phases that are followed to develop the software application.
These Phases are :
Different procedures / models are available to develop a software namely,

Sakthi Software Solutions pvt ltd,
RVR Towers, 4th Floor, No.1, AA Block,
1st Street, 3rd Main Road, Annanagar, Chennai 600 040.
Landmark: Annanagar Roundtana, Behind Nalli Silks Showroom,
Phone: 9600035403
website: http://sssedu.in/software-testing-training-chennai.html

Pay for Course & get project free!!!

Pay for Course & get project free!!!

For - B.E/B.TECH/MCA/MSC/M.E
Courses offered:
       v Java
           v Dot net
               v Oracle
                    v Web Design
                         v Embedded System
                             v Power System
                                 v Power Electronics
                                      v PHP

IEEE - JAVA/.NET   APPLICATION - JAVA/.NETEMBEDDED SYSTEMSMAT LABVLSI ANDROIDNS-2ORACLEhttp://sssedu.in/oracle-training-in-chennai.html


Contact:
M/s. Sakthi Software Solutions Pvt Ltd,
RVR Towers, 1st Street, 3rd Main Road,
Annanagar, Behind Nalli Silks,Chennai 600 040.
Tel: 044-43016888 /9710780469

Wednesday, 31 December 2014

Project internships with course in chennai

Project internships with course

For - B.E/B.TECH/MCA/MSC/M.E

Courses offered:

            v Java
                v Dot net
                     v Oracle
                            v Web Design
                               v Embedded System
                                   v Power System
                                       v Power Electronics
                                            v PHP

Contact:
M/s. Sakthi Software Solutions Pvt Ltd,
RVR Towers, 1st Street, 3rd Main Road,
Annanagar, Behind Nalli Silks,Chennai 600 040.
Tel: 044-43016888 /9710780469

Important Interview Tips in ASP.NET



Important Interview Tips in ASP.NET


1. Explain page directives?


The first line of an Asp.Net page is the page directive; you can see it on all Asp.Net pages. These directives are instructions for the page. It starts with the @Page directive and continues with the different attributes available to this directive list.

The basic syntax for a Page directive is:


<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
The attributes of the Page directive are:

Title

Specifies a title for the page that is rendered within the HTML <title> tags in the response. The title can also be accessed programmatically as a property of the page.

Language

Specifies the language used when compiling all inline rendering (<% %> and <%= %>) and code declaration blocks within the page, From  VB.net, C#.net, Jscript  only one language can be used  per page.

MasterPageFile

Sets the path to the master page for the content page or nested master page

AutoEventWireup

Indicates whether the page's events are autowired. true if event autowiring is enabled; otherwise, false.

CodeBehind  name of the code behind file

Inherits     the name of the code behind or other class

2. Hyperlink Vs LinkButton in ASP.NET?

A Hyperlink just redirects to a given URL identified by “NavigateURL” property. LinkButton which actually displays a Hyperlink style button causes a postback to the same page but it doesn’t redirect to a given URL.

3. Label Control Vs Literal Control in ASP.NET?

A Label control in ASP.NET renders text inside <span> tags while a Literal Control renders just the text without any tags.
With Label controls we can easily apply styles using it’s CssClass property, however, if we don’t want to apply style/formatting, it’s better to go for a Literal control.

4. Difference between WCF and ASMX Web Services?

Web service is designed to send and receive messages using SOAP over HTTP only. While WCF can exchange messages using any format (SOAP is default) over any transport protocol (HTTP, TCP/IP, MSMQ, NamedPipes etc.
Web Services                                     WCF
Hosted in IIS only                               Hosted in IIS, WAS, Console, WinNT Services, WCF provided
Host Support for HTTP only              Support for HTTP, TCP, MSMQ, Named Pipes
Limited Security                                 A consistent security Programming Model
Uses XMSerializer                             uses DataContractSerializer

5. Custom controls Vs User controls in ASP.NET?


Custom controls are basically compiled code i.e. DLLs. These can be easily added to toolbox, so it can be easily used across multiple projects using drag and drop approach. These controls are comparatively hard to create.

User Controls (.ascx) are just like pages (.aspx). These are comparatively easy to create but tightly couple with respect to User Interface and code. In order to use across multiple projects, we need to copy and paste to the other project as well.

6. Difference between a Postback and a Callback in ASP.NET?

A postback is a request sent from a client to server from the same page, user is already working with.
A callback is generally a call for execution of a function after another function has completed.


7. Explain Global.asax in ASP.NET?

Global.asax is basically ASP.NET Application file. It’s a place to write code for Application-level events such as Application start, Application end, Session start , Session end, Application error, Application begin request,, Application end request etc.

8. Can we Enable/Disable ViewState?

Yes, ViewState can be enabled or disable at different levels:
Control Level ViewState for a specific control can be enabled or disabled by setting  EnableViewState property
         aControl.EnableViewState = false;
Page Level we can enable/disable ViewState for a complete page
            <%@ Page Language=”C#” EnableViewState=”false” %>
Application Level For whole application, we can enable/disable views in configuration file
<pages enableViewState=”false”>
    ….
</pages>

9. Difference between Globalization Vs Localization

When we need to create an application that work for multiple cultures e.g en-US, ar-SAetc, the process of designing and building applications that work on more than one cultures is called globalization. However, customizing an application for a specific culture is localization.

10. Session.Clear() Vs Session.Abandon() in ASP.NET?

Session.Clear() clears all the session values but doesn’t destroy the Session.
Session.Clear() is like deleting all files inside a folder (say “Root”)

 Session.Abandon() destroys the session object.
Session.Abandon() means deleting the “Root” folder.

--------------------------------------------------------------------------------------------------------

For more details:
Sakthi Software Solutions Pvt Ltd,
RVR Towers, 4th Floor, No.1, AA Block,
1st Street, 3rd Main Road,
Annanagar, Chennai 600 040.
Landmark: Annanagar Roundtana,
Behind Nalli Silks Showroom,
Contact: 9840533344, Email: contactus@sssedu.in
website: www.sssedu.in