Tuesday, 16 September 2014

Important key questions on Java basics


1) Java was first developed in...
  • 1991
3) Old name of Java is...
  • Oak
3) Is Java purely object oriented?
  • No
 
 4)  Can we declare abstract static method?
  •  No
5) What is difference between == and equal()  ?
  • == compares reference of objects.
  • equal() compares values of objects.
6) Does Java supports operator overloading?
  • No
7) What is generated after Java source code is compiled ?
  • Byte code
 

Monday, 15 September 2014

Important interview questions on basics of Java

1)  What makes java a platform independent language ?
  • First of all, here platform independent means compiled java programs can run on any platform, not depending on which platform it was built. The reason behind this is, compilation of java source code is converted into byte code, which can run on any platform.
                          // More on Java byte code(Java byte code, made easy
2)  Does java support multiple inheritance ? If yes, why? If no, why not?

  • No, Java does not support multiple inheritance. (We can use multiple inheritance through interface)
  • James gosling in "Java: an overview" gave idea on why multiple inheritance is not supported in Java that as per designer's view multiple inheritance causes more problems and confusions than it solves. So, to let the Java language be simple, multiple inheritance feature is omitted.
3)  Difference between overloading and overriding of methods in java.
  • Over-loading of methods :- When there are two methods in a class having same name but different types of parameters or different numbers of parameters, it is called over-loading of methods
  • Over-riding of methods :- When a method in child class has same method as in parent class, it is called over-riding of methods. Here, same method means, same name of methods, same parameters type and number.

Saturday, 13 September 2014

Swap two numbers without using temporary variable

1st method(using arithmetic operators) :-

#include <stdio.h>
int main()
{
  int x = 10, y = 5;
  x = x + y;  // x is now 15
  y = x - y;  // y is 10
  x = x - y;  // and swapped, x is 5
 printf("swapped values :- x is %d, y is %d", x, y);
   
 return 0;
}

2nd method(using Bitwise XOR) :-

#include <stdio.h>
int main()
{
  int x = 10, y = 5;
  x = x ^ y;  // x is now 15(1111)
  y = y ^ x;  // y is 10(1010)
  x = x ^ y;  // and swapped, x is 5(0101)

  printf("swapped values :- x is %d, y is %d", x, y);
  return 0;
}

Differences between common terms used in INTERNET PROGRAMMING.

1) Container tag vs. Empty tag.
* Container tag :-
  • Container tag are the one which need an opening tag as well as a closing tag.
  • for example, <html> </html> or <ul> </ul>
* Empty tag :-

  • Unlike container tag, Empty tags do not need an closing tag.
  • for example <br> or <hr>
2) Local link vs. External link.
 * Local link :-
  • Local link are the links which are linked to another web-page of the same website.
  • for example, <a href="geeksandgeeks.blogspot.in/2014/09/spend-your-precious-time-on-internet.html"> link </a>
* External link :-
  • External links are the one which are linked to another website on internet.
  • for example, <a href="google.com"> google </a>
3) Image vs Image map.
* Image :-
  • An image tag is used to hold a simple image on your webpage.
  • for example, <img src="image.jpg">
* Image map :-
  • An image map is a tag used to map out specific region on a image which provides links to other pages, based on where on the image is clicked.
  • for example, <img src="image.jpg" usemap="#imap">                                                      
                           <map name="imap">                                                                                     
                            <area shape="rect/cicle/poly" coords="..." href="link.html">
                          </map>
4) Static websites vs. Dynamic websites.
* Static websites :-
  • Static websites contains fixed number of pages, format and content.
  • This type of sites are created with HTML, CSS
  • For example, Any organizational site.
* Dynamic websites :-
  • Dynamic webpages can change their content dynamically while the page is running on browser.
  • For example, Any E-commerce website.
5) Internet vs. Intranet.
* Internet :-
  • Internet is a worldwide interconnection of all smart communication devices.
* Intranet :-
  • Intranet is privately owned pat of internet under which only selected IPs are allowed to communicate.
6) Relative path vs. Absolute path.
* Relative path :-
  • If the file referred is on same/current server, the path of the file is relative path.
  • For example, D/studies/Internetprogramming/file.html
 * Absolute path :-
  • If the file referred is on other server or on internet, the path of the file is absolute path.
  • for example, google.images/worldmap.jpg
7) HTTP vs. HTTPS.
* HTTP :-
  • HTTP( hyper text transfer protocol) takes care of communication between a web server and a web browser,
*HTTPS:- 
  • It does the same task as HTTP, securely.
8) href vs. src.
*href:-
  • href attribute specifies the location of a web resource, thus defining a link
  • for example, <a href="geeksandgeeks.blogspot.in"> My blog </a>
* src:- 
  • src attribute embeds the resource in the current document at the location of defination.
  • for example, <img src="image.jpg">
9) Frameset vs. frame.
* Frameset:-
  • Frameset tag is used for grouping of frames
*Frame :-
  • Frame defines what document is going to be in the frame

Friday, 12 September 2014

Introduction to interface in Java with a simple powerpoint presentation tutorial

Don't know what interfaces are ?
Want to learn how to imply an interface in java?
Confused, what is difference between class and interface ?
learn every basic thing about interface in this power-point slide

Wednesday, 10 September 2014

Spend your precious time on internet, Productively!

In this advanced era, getting some sort of information is just one touch away from you. The internet lets you see the information from every aspect of it. But how to get the information in the best way is upon you. So, here are some sites listed which will help you spend your time on the internet "The productive way".

1)  Ted
As its slogan says, "Ideas worth spreading", the site owned by a private non-profit foundation offers videos to view online. The videos are global conferences about topics related to technology, entertainment and design. They basically make videos of the conference led by a speaker related to the above-mentioned topics. Some famous TED speakers include Bono, J. J. Abrams, Bill Gates, Jane Goodall, and Stephen Hawking. Here is the link to some of the best ted-talks(Top 20 TED Talks That Can Improve Your Life).

2) Quora
* Personal favourite
Quora is a question and answer website, where you can ask questions, answer them as well as edit them. You can get best of the web on any topic here. And, the best thing about quora is you get smart answers. I've also seen cases where the founder of Quora, Product designer of Facebook messenger,CEO of Netflix, Creator of the hashtag answered questions related to their topics. Which makes Quora a great platform to use. Here is the link to best answers on quora(271 Best Answers on Quora)
3) Duolingo
There are millions of people around the globe who can't get better educational or job opportunities because of not knowing of some particular foreign language. Duolingo is there to help those people out. It is a free language learning platform offering Latin American Spanish, French, German, Brazilian Portugese, Italian and Dutch for English speakers as well as American English for Spanish, French, German, Portuguese, Italian, Dutch, Russian, Polish, Turkish, Hungarian, Romanian, Japanese, Hindi, Indonesian, and Korean speakers. Duolingo is available on ios, android and on the web platform. The best thing about Duolingo is that the information is taught such a way that it becomes very easy to learn.
4) Codecademy
"Codecademy is an education company. But not one in the way you might think. We're committed to building the best learning experience inside and out, making Codecademy the best place for our team to learn, teach, and create the online learning experience of the future." Says the team of codecademy about themselves. You can learn many skills like Html & css, javascript, jquery, Python, ruby, PHP and also many API's on codecademy.
5) Calm
The way our lifestyles are, we always are in hurries. But it's necessary to take out some time to step back and relax. This site called calm.com helps you get relaxed by listening to some sort of relaxing music with many function.
6) Marc and angel 
* Personal favourite
This site gives you the best of "Inspirational advice and practical tips for life". As stated by the writer Marc and angel the site currently contains over 600 articles on happiness, productivity, emotional intelligence, relationships, and general self-improvement, and has attracted over 100 million page views and 100 thousand subscribers since its inception in 2006.
7) Mathway
Mathway provides students with the tools they need to understand and solve their math problems. With hundreds of millions of problems already solved, Mathway is the #1 problem solving resource available for students, parents, and teachers. All the types of math problems like Basic Math, Pre-Algebra, Algebra, Geometry, Trigonometry, Precalculus, Calculus, Statistics, Finite Math, Linear Algebra could be solved here.

8) Dumb little man
* Personal favourite
This website contains articles full of awesome tips and advice. Each article on this site is so productive that, each one can change your life.
9) Lifehacker
As the name says, this is a website on software and personal productivity tips which helps you work smarter.

10) Lifehack
I don't think there's a need to describe this one!
Some bonus links :-
1) minutes.io - Quickly capture effective notes.
2) privnote.com - Write a note to someone that will self-destruct after they read it!
3) virustotal.com –Scan any suspicious file or email attachment for viruses.
4) Mind tools - A blog that teaches you practical career skills.
5) wetransfer.com –For sharing really big files online.
6) Time Zones– A less confusing view of the world time zones.
7) bubbl.us – Create mind-maps, brainstorm ideas in the browser.
8) omegle.com - A random-chat website that you'll definitely enjoy
9) rainymood.com - Relax with the sound of rain.
10) FutureMe.org - Futureme allows you to send yourself an email at any date up to 30 years in the future.

A picture can clear your ideas about Java BYTE CODE.


Say "Hello world!" in Java without main method!

The first question that would come into your mind is, is it really possible to make a running program in Java without a main method? So, YES, it is possible with using “static initialization blocks”. Below is the running program code without a main method.

public class HelloWorld {
static {
System.out.println(“Hello World!”);
System.exit(0);
}
}


Say "Hello world!" in C without main method!

The first question that would come into your mind is, is it really possible to make a running program in C without a main method? So, YES, it is possible. Below is the running program code without a main method.

#include<stdio.h>
#define fun main
int fun(void)
{
    printf("Hello world!");
    return 0;
}

How to make a Java program without a main method ?