Pages

Sunday, November 27, 2011

Java Interview Questions

Java interview questions and answers

  1. What is garbage collection? What is the process that is responsible for doing that in java? Reclaiming the unused memory by the invalid objects. Garbage collector is responsible for this process
  2. What kind of thread is the Garbage collector thread? It is a daemon thread.
  3. What is a daemon thread? - These are the threads which can run without user intervention. The JVM can exit when there are daemon thread by killing them abruptly.
  4. How will you invoke any external process in Java? - Runtime.getRuntime().exec(….)
  5. What is the finalize method do? - Before the invalid objects get garbage collected, the JVM give the user a chance to clean up some resources before it got garbage collected.
  6. What is mutable object and immutable object? - If a object value is changeable then we can call it as Mutable object. (Ex., StringBuffer, …) If you are not allowed to change the value of an object, it is immutable object. (Ex., String, Integer, Float, …)
  7. What is the basic difference between string and stringbuffer object? - String is an immutable object. StringBuffer is a mutable object.
  8. What is the purpose of Void class? - The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the primitive Java type void.
  9. What is reflection? - Reflection allows programmatic access to information about the fields, methods and constructors of loaded classes, and the use reflected fields, methods, and constructors to operate on their underlying counterparts on objects, within security restrictions.
  10. What is the base class for Error and Exception? - Throwable
  11. What is the byte range? -128 to 127
  12. What is the implementation of destroy method in java.. is it native or java code? - This method is not implemented.
  13. What is a package? - To group set of classes into a single unit is known as packaging. Packages provides wide namespace ability.
  14. What are the approaches that you will follow for making a program very efficient? - By avoiding too much of static methods avoiding the excessive and unnecessary use of synchronized methods Selection of related classes based on the application (meaning synchronized classes for multiuser and non-synchronized classes for single user) Usage of appropriate design patterns Using cache methodologies for remote invocations Avoiding creation of variables within a loop and lot more.
  15. What is a DatabaseMetaData? - Comprehensive information about the database as a whole.
  16. What is Locale? - A Locale object represents a specific geographical, political, or cultural region
  17. How will you load a specific locale? - Using ResourceBundle.getBundle(…);
  18. What is JIT and its use? - Really, just a very fast compiler… In this incarnation, pretty much a one-pass compiler — no offline computations. So you can’t look at the whole method, rank the expressions according to which ones are re-used the most, and then generate code. In theory terms, it’s an on-line problem.
  19. Is JVM a compiler or an interpreter? - Interpreter
  20. When you think about optimization, what is the best way to findout the time/memory consuming process? - Using profiler
  21. What is the purpose of assert keyword used in JDK1.4.x? - In order to validate certain expressions. It effectively replaces the if block and automatically throws the AssertionError on failure. This keyword should be used for the critical arguments. Meaning, without that the method does nothing.
  22. How will you get the platform dependent values like line separator, path separator, etc., ? - Using Sytem.getProperty(…) (line.separator, path.separator, …)
  23. What is skeleton and stub? what is the purpose of those? - Stub is a client side representation of the server, which takes care of communicating with the remote server. Skeleton is the server side representation. But that is no more in use… it is deprecated long before in JDK.
  24. What is the final keyword denotes? - final keyword denotes that it is the final implementation for that method or variable or class. You can’t override that method/variable/class any more.
  25. What is the significance of ListIterator? - You can iterate back and forth.
  26. What is the major difference between LinkedList and ArrayList? - LinkedList are meant for sequential accessing. ArrayList are meant for random accessing.
  27. What is nested class? - If all the methods of a inner class is static then it is a nested class.
  28. What is inner class? - If the methods of the inner class can only be accessed via the instance of the inner class, then it is called inner class.
  29. What is composition? - Holding the reference of the other class within some other class is known as composition.
  30. What is aggregation? - It is a special type of composition. If you expose all the methods of a composite class and route the method call to the composite method through its reference, then it is called aggregation.
  31. What are the methods in Object? - clone, equals, wait, finalize, getClass, hashCode, notify, notifyAll, toString
  32. Can you instantiate the Math class? - You can’t instantiate the math class. All the methods in this class are static. And the constructor is not public.
  33. What is singleton? - It is one of the design pattern. This falls in the creational pattern of the design pattern. There will be only one instance for that entire JVM. You can achieve this by having the private constructor in the class. For eg., public class Singleton { private static final Singleton s = new Singleton(); private Singleton() { } public static Singleton getInstance() { return s; } // all non static methods … }
  34. What is DriverManager? - The basic service to manage set of JDBC drivers.
  35. What is Class.forName() does and how it is useful? - It loads the class into the ClassLoader. It returns the Class. Using that you can get the instance ( “class-instance”.newInstance() ).
  36. Inq adds a question: Expain the reason for each keyword of
    public static void main(String args[])

Friday, November 25, 2011

MATLAB - The Language Of Technical Computing

Introduction


MATLAB® is a high-level technical computing language and interactive environment for algorithm development, data visualization, data analysis, and numerical computation. Using MATLAB, you can solve technical computing problems faster than with traditional programming languages, such as C, C++, and Fortran.

You can use MATLAB in a wide range of applications, including signal and image processing, communications, control design, test and measurement, financial modeling and analysis, and computational biology. Add-on toolboxes (collections of special-purpose MATLAB functions) extend the MATLAB environment to solve particular classes of problems in these application areas.

MATLAB provides a number of features for documenting and sharing your work. You can integrate your MATLAB code with other languages and applications, and distribute your MATLAB algorithms and applications.

Key Features

  • High-level language for technical computing
  • Development environment for managing code, files, and data
  • Interactive tools for iterative exploration, design, and problem solving
  • Mathematical functions for linear algebra, statistics, Fourier analysis, filtering, optimization, and numerical integration
  • 2-D and 3-D graphics functions for visualizing data
  • Tools for building custom graphical user interfaces
  • Functions for integrating MATLAB based algorithms with external applications and languages, such as C, C++, Fortran, Java, COM, and Microsoft Excel

Developing Algorithms and Applications


MATLAB provides a high-level language and development tools that let you quickly develop and analyze your algorithms and applications.

Developing Algorithms and Applications


MATLAB provides a high-level language and development tools that let you quickly develop and analyze your algorithms and applications.

Developing Algorithms and Applications


MATLAB provides a high-level language and development tools that let you quickly develop and analyze your algorithms and applications.

The MATLAB Language


The MATLAB language supports the vector and matrix operations that are fundamental to engineering and scientific problems. It enables fast development and execution.

With the MATLAB language, you can program and develop algorithms faster than with traditional languages because you do not need to perform low-level administrative tasks, such as declaring variables, specifying data types, and allocating memory. In many cases, MATLAB eliminates the need for ‘for’ loops. As a result, one line of MATLAB code can often replace several lines of C or C++ code.

At the same time, MATLAB provides all the features of a traditional programming language, including arithmetic operators, flow control, data structures, data types, object-oriented programming (OOP), and debugging features.

The MATLAB Language


The MATLAB language supports the vector and matrix operations that are fundamental to engineering and scientific problems. It enables fast development and execution.

With the MATLAB language, you can program and develop algorithms faster than with traditional languages because you do not need to perform low-level administrative tasks, such as declaring variables, specifying data types, and allocating memory. In many cases, MATLAB eliminates the need for ‘for’ loops. As a result, one line of MATLAB code can often replace several lines of C or C++ code.

At the same time, MATLAB provides all the features of a traditional programming language, including arithmetic operators, flow control, data structures, data types, object-oriented programming (OOP), and debugging features.

The MATLAB Language


The MATLAB language supports the vector and matrix operations that are fundamental to engineering and scientific problems. It enables fast development and execution.

With the MATLAB language, you can program and develop algorithms faster than with traditional languages because you do not need to perform low-level administrative tasks, such as declaring variables, specifying data types, and allocating memory. In many cases, MATLAB eliminates the need for ‘for’ loops. As a result, one line of MATLAB code can often replace several lines of C or C++ code.

At the same time, MATLAB provides all the features of a traditional programming language, including arithmetic operators, flow control, data structures, data types, object-oriented programming (OOP), and debugging features.MATLAB lets you execute commands or groups of commands one at a time, without compiling and linking, enabling you to quickly iterate to the optimal solution.
For fast execution of heavy matrix and vector computations, MATLAB uses processor-optimized libraries. For general-purpose scalar computations, MATLAB generates machine-code instructions using its JIT (Just-In-Time) compilation technology.

This technology, which is available on most platforms, provides execution speeds that rival those of traditional programming languages.

Development Tools


MATLAB includes development tools that help you implement your algorithm efficiently. These include the following:

MATLAB Editor - Provides standard editing and debugging features, such as setting breakpoints and single stepping

Code Analyzer - Checks your code for problems and recommends modifications to maximize performance and maintainability

MATLAB Profiler - Records the time spent executing each line of code

Directory Reports - Scan all the files in a directory and report on code efficiency, file differences, file dependencies, and code coverage 

Comparing .Net and Java

Java or .NET?
Over the past several year, we’ve seen the Java platform and the .NET platform continue to converge and the gap between them in terms of features, libararies, and languages continue to shrink. Not only that, but both platforms have to a certain extent been ported from the official version and can run on systems not envisioned by the original designer. Carefully designed ASP.NET applications can run on almost as many platforms as Java with the Mono-based CLR (Common Language Runtime), and its JVM (Java Virtual Machine) counterpart can now run within .NET (or Mono) with the help of IKVM.NET. However, despite all this cross-pollination and convergence between the two platforms there still remain distinct advantages for choosing a certain platform for your next enterprise, web-based, desktop, or mobile application. Compiling a comprehensive list or chart of what makes one platform ideal for a scenario is impossible; however, there are these simple guidelines that can help you start down that path. We’ve broken down the high-level options into six categories, and we’ll discuss the options based on each one next.

Cloud Computing

Although this can usually be considered a subset of the next category (Web 2.0 Applications), cloud computing introduces several new constraints and a paradigm shift in the way development is approached. Microsoft is well aware of these implications and has already invested heavily in technologies that will align .NET more closely with the ideology behind cloud computing. However, the momentum, at least for the moment, is heavily in the favor of the entrenched technologies which are mainly built on top of open source software and commodity hardware. Amazon’s EC2, Google’s App Engine, and Salesforce.com’s Force.com are all built on technologies like Java, Python, and C++ and favor solutions that run on open source operating systems.
As we mentioned, however, Microsoft is not just sitting back and watching this huge market slip away from them, and is working feverishly to bring Azure, its entry into the cloud computing arena, to market. For the time being, however, the winner in this area between the two contestants is Java.

Web 2.0 Applications

As mentioned above, this category shares many of the features of the previous one so we will just mention that the topics of open source virtualization and operating systems still favor Java. There are, however, additional advantages that Java has in this realm, mainly in the form of open source libraries and frameworks that aid in the development of these applications. For example, the Java eco-system has hundreds of web application frameworks, content management systems, ecommerce systems, social network frameworks and so on, with a large amount of them being high quality as well as open source. Two exceptional Web 2.0 frameworks that are used to build successful Web 2.0 applications include JRuby on Rails and Grails.
Also, traditional ASP.NET applications had only one architectural option for build web apps, the classic Page controller pattern. Most interaction between the browser and the server happens through an HTTP POST action and session and page information is stored in a ViewState object that persists on every page. This architectural style creates a heavier load on the server and is more difficult to scale then the share-nothing architecture found in many Web 2.0 applications.
Microsoft has been working on alternative styles of web applications and is close to releasing an MVC architecture style for ASP.NET applications which uses the Front controller pattern found in most Java applications. Java, however, still has the advantage in this category.

Rich Internet Applications

Since the first release of Java in the mid-90s, the Java applet has been hailed as the ultimate platform for applications that can be written-once and run on any platform, easily distributed using a web-browser, and capable of high-quality graphics and animations. However, Sun stumbled early on with it’s browser plugin for the applet, and Java applets became synonymous with slow, buggy, and unwieldy applications. The promise behind them faded and although several really good applications using applets have been released the Java applet platform still hasn’t caught on. Flash became what Java should have been, and developers quickly switched their attention to that environment.
As the important of Rich Internet Applications started becoming apparent, Microsoft decided to take the technology it was building behind XAML and WPF (presentation frameworks for Windows and .NET) and build a Flash/Java killer that would provide all the benefits of Flash on the client side with all the benefits of .NET on the development end. Giving developers the powerful capabilities of Visual Studio and .NET libraries and a high-end graphics and animation framework quickly made Silverlight an important contender in the RIA arena. Although Sun is pouring a large amount of resources in its RIA player, JavaFX, it still remains to be seen whether it will have the success that Silverlight is enjoying, making .NET the winner in this category.

Enterprise Applications

We’ve been noticing a clear trend in many of the enterprise’s IT departments, and several surveys and studies have been confirming this. More enterprises are consolidation on the Microsoft platform, or at least clearly making it an equal partner where it was not a considered option before. From large enterprises to SMBs, IT departments are jumping at the opportunity to consolidate on a single platform for their mail, directory, ERP, CRM, document sharing, and so on. Exchange, SharePoint, Microsoft’s CRM and ERP offerings are becoming semi-standards in many companies and this starts to filter down to the development teams as they start using Visual Studio and .NET for integration and development projects. At the same time, Visual Studio has become an excellent IDE with some of the best support for XML/SOAP/WebServices that is the main glue available for both server to server as well as server to client communications.
Creating desktop applications in Visual Studio is also one of its strong spots, and with the (partially) controlled environment found in the enterprise it’s not a problem to quickly deploy the necessary .NET framework to all clients. With all these advantages, .NET is usually the safe bet for most enterprises and is the winner in this category.

Desktop Applications

As we just mentioned, Visual Studio is a top-notch IDE for building GUIs (graphical user interfaces) and desktop applications, especially with the data binding and component building support in Windows Forms and Windows Presentation Framework. However, there is a an important drawback, these applications (with the exception of those targeting Mono) will only work on Windows machines with the .NET framework pre-installed. For some developers this may be an acceptable assumption, especially if we’re targeting the enterprise as we mentioned above. However, for general purpose applications Java is a better option, considering that it usually comes pre-installed with most operating systems and OEMs, and can be easily installed on virtually any platform if it is not. In the future, Microsoft may extend Silverlight’s functionality with offline support and desktop integration but Java is a better option for now.

Mobile Applications

With the notable exception of Apple’s iPhone, the Java Mobile platform is available on almost every modern mobile device, and despite its fragmented and sometimes inconsistent implementation on the various platforms it’s still considered the one common tool for developers to take advantage of. If you want an application that runs on the most mobile platforms, Java is your platform to get there.

Monday, November 21, 2011

Top 50 Universities Of The World

Top 50 Universities Of The World

University Of Cambridge

Welcome to the QS World University Rankings® 2011/2012 - among the most trusted university rankings available. Here you will can find all you need about the QS World University Rankings® now including university fees information. View the world’s leading overall universities in the world, the best universities by subject rank area, and the best universities as voted by employers.


Rank
Institution
Country
Domestic Fees ($)
Score
undergrad
postgrad
1
United Kingdom
14,000 - 16,000
4,000 - 6,000
100
2
United States
38,000 - 40,000
36,000 - 38,000
99.34
3
United States
38,000 - 40,000
40,000 - 42,000
99.21
4
United States
38,000 - 40,000
32,000 - 34,000
98.84
5
United Kingdom
14,000 - 16,000
4,000 - 6,000
98
6
United Kingdom
14,000 - 16,000
4,000 - 6,000
97.64
7
United Kingdom
14,000 - 16,000
6,000 - 8,000
97.33
8
United States
42,000 - 44,000
42,000 - 44,000
96.08
9
United States
40,000 - 42,000
26,000 - 28,000
95.73
10
United States
42,000 - 44,000
38,000 - 40,000
95.28
11
United States
40,000 - 42,000
38,000 - 40,000
93.44
12
United States
36,000 - 38,000
36,000 - 38,000
93.02
13
United States
36,000 - 38,000
38,000 - 40,000
91.91
14
United States
10,000 - 12,000
16,000 - 18,000
91.28
15
United States
38,000 - 40,000
28,000 - 30,000
90.72
16
United States
40,000 - 42,000
40,000 - 42,000
89.96
17
Canada
4,000 - 6,000
4,000 - 6,000
89.56
18
Switzerland
1,000 - 2,000
1,000 - 2,000
89.5
19
United States
40,000 - 42,000
38,000 - 40,000
89.25
20
United Kingdom
14,000 - 16,000
6,000 - 8,000
87.83
21
United States
10,000 - 12,000
10,000 - 12,000
87.64
22
Hong Kong
4,000 - 6,000
4,000 - 6,000
87.04
23
Canada
6000 - 8000
6000 - 8000
86.16
24
United States
40,000 - 42,000
40,000 - 42,000
85.91
25
Japan
6,000 - 8,000
6,000 - 8,000
85.9
26
Australia
6,000 - 8,000
22,000 - 24,000
85.69
27
United Kingdom
14,000 - 16,000
6,000 - 8,000
84.96
28
Singapore
34,000 - 36,000
6,000 - 8,000
84.07
29
United Kingdom
14,000 - 16,000
8,000 - 10,000
83.97
30
United Kingdom
14,000 - 16,000
6,000 - 8,000
83.65
31
Australia
6,000 - 8,000
83.63
32
Japan
6,000 - 8,000
6,000 - 8,000
82.86
33
France
< 1,000
< 1,000
82.44
34
United States
10,000 - 12,000
10,000 - 12,000
81.86
35
Switzerland
1,000 - 2,000
1,000 - 2,000
81.75
36
France
0
6,000 - 8,000
80.54
37
Hong Kong
4,000 - 6,000
4,000 - 6,000
79.5
38
Australia
6,000 - 8,000
22,000 - 24,000
79.3
39
United States
40,000 - 42,000
40,000 - 42,000
79.23
40
Hong Kong
4,000 - 6,000
4,000 - 6,000
79.09
41
United States
8,000 - 10,000
10,000 - 12,000
78.98
42
Korea, South
4,000 - 6,000
6000 - 8000
78.65
43
United States
42,000 - 44,000
36,000 - 38,000
78.46
44
United States
40,000 - 42,000
34,000 - 36,000
77.71
45
Japan
6,000 - 8,000
6,000 - 8,000
77.55
46
China
< 1,000
2,000 - 4,000
77.44
47
China
1,000 - 2,000
1,000 - 2,000
76.25
48
Australia
6,000 - 8,000
75.88
49
Australia
6,000 - 8,000
8,000 - 10,000
75.67
50
United Kingdom
14,000 - 16,000
8,000 - 10,000
74.86